Commit 560d7bcd authored by unknown's avatar unknown
Browse files

Merge with 4.0


BitKeeper/etc/logging_ok:
  auto-union
Docs/Support/texi2html:
  Auto merged
innobase/trx/trx0rec.c:
  Auto merged
libmysql/libmysql.c:
  Auto merged
myisam/myisampack.c:
  Auto merged
mysql-test/t/innodb-lock.test:
  Auto merged
mysys/thr_lock.c:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/lock.cc:
  Auto merged
sql/sql_acl.cc:
  Keep old code
parents 7bdb93aa ec8779e9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -44,12 +44,12 @@ do
  case $host_os in
    netware* | modesto*)
      echo "$i/errmsg.sys: $i/errmsg.txt
	\$(top_builddir)/extra/comp_err.linux -C\$(srcdir)/charsets/ \$^ $i/errmsg.sys" \
	\$(top_builddir)/extra/comp_err.linux -C\$(srcdir)/charsets/ $i/errmsg.txt $i/errmsg.sys" \
      >> $AVAILABLE_LANGUAGES_ERRORS_RULES
      ;;
    *)
  echo "$i/errmsg.sys: $i/errmsg.txt
	\$(top_builddir)/extra/comp_err -C\$(srcdir)/charsets/ \$^ $i/errmsg.sys" \
	\$(top_builddir)/extra/comp_err -C\$(srcdir)/charsets/ $i/errmsg.txt $i/errmsg.sys" \
    >> $AVAILABLE_LANGUAGES_ERRORS_RULES
      ;;
  esac
+18 −12
Original line number Diff line number Diff line
@@ -1258,7 +1258,7 @@ trx_undo_prev_version_build(
	ibool		dummy_extern;
	byte*		buf;
	ulint		err;
	ulint		i;

#ifdef UNIV_SYNC_DEBUG
	ut_ad(rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
@@ -1363,7 +1363,18 @@ trx_undo_prev_version_build(
	}

	if (row_upd_changes_field_size_or_external(rec, index, update)) {

		ulint*	ext_vect;
		ulint	n_ext_vect;

		/* We have to set the appropriate extern storage bits in the
		old version of the record: the extern bits in rec for those
		fields that update does NOT update, as well as the the bits for
		those fields that update updates to become externally stored
		fields. Store the info to ext_vect: */

		ext_vect = mem_alloc(sizeof(ulint) * rec_get_n_fields(rec));
		n_ext_vect = btr_push_update_extern_fields(ext_vect, rec,
								update);
		entry = row_rec_to_index_entry(ROW_COPY_DATA, index, rec,
								     heap);
		row_upd_index_replace_new_col_vals(entry, index, update, heap);
@@ -1371,6 +1382,11 @@ trx_undo_prev_version_build(
		buf = mem_heap_alloc(heap, rec_get_converted_size(entry));

		*old_vers = rec_convert_dtuple_to_rec(buf, entry);

		/* Now set the extern bits in the old version of the record */
		rec_set_field_extern_bits(*old_vers, ext_vect, n_ext_vect,
									NULL);
		mem_free(ext_vect);
	} else {
		buf = mem_heap_alloc(heap, rec_get_size(rec));

@@ -1379,15 +1395,5 @@ trx_undo_prev_version_build(
		row_upd_rec_in_place(*old_vers, update);
	}

	for (i = 0; i < upd_get_n_fields(update); i++) {

		if (upd_get_nth_field(update, i)->extern_storage) {

			rec_set_nth_field_extern_bit(*old_vers,
				upd_get_nth_field(update, i)->field_no,
				TRUE, NULL);
		}
	}

	return(DB_SUCCESS);
}
+34 −0
Original line number Diff line number Diff line
@@ -1543,6 +1543,40 @@ void my_net_local_init(NET *net)
  net->max_packet_size= max(net_buffer_length, max_allowed_packet);
}

/*
  This function is used to create HEX string that you
  can use in a SQL statement in of the either ways:
    INSERT INTO blob_column VALUES (0xAABBCC);  (any MySQL version)
    INSERT INTO blob_column VALUES (X'AABBCC'); (4.1 and higher)
  
  The string in "from" is encoded to a HEX string.
  The result is placed in "to" and a terminating null byte is appended.
  
  The string pointed to by "from" must be "length" bytes long.
  You must allocate the "to" buffer to be at least length*2+1 bytes long.
  Each character needs two bytes, and you need room for the terminating
  null byte. When mysql_hex_string() returns, the contents of "to" will
  be a null-terminated string. The return value is the length of the
  encoded string, not including the terminating null character.

  The return value does not contain any leading 0x or a leading X' and
  trailing '. The caller must supply whichever of those is desired.
*/

ulong mysql_hex_string(char *to, const char *from, ulong length)
{
  char *to0= to;
  const char *end;
            
  for (end= from + length; from < end; from++)
  {
    *to++= _dig_vec[((unsigned char) *from) >> 4];
    *to++= _dig_vec[((unsigned char) *from) & 0x0F];
  }
  *to= '\0';
  return (ulong) (to-to0);
}

/*
  Add escape characters to a string (blob?) to make it suitable for a insert
  to should at least have place for length*2+1 chars
+27 −7
Original line number Diff line number Diff line
@@ -111,6 +111,8 @@ typedef struct st_isam_mrg {
  uint	ref_length;
  uint	max_blob_length;
  my_off_t records;
  /* true if at least one source file has at least one disabled index */
  my_bool src_file_has_indexes_disabled;
} PACK_MRG_INFO;


@@ -413,10 +415,15 @@ static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count)
  mrg->current=0;
  mrg->file=(MI_INFO**) my_malloc(sizeof(MI_INFO*)*count,MYF(MY_FAE));
  mrg->free_file=1;
  mrg->src_file_has_indexes_disabled= 0;
  for (i=0; i < count ; i++)
  {
    if (!(mrg->file[i]=open_isam_file(names[i],O_RDONLY)))
      goto error;

    mrg->src_file_has_indexes_disabled|= ((mrg->file[i]->s->state.key_map != 
                                           (((ulonglong) 1) <<
                                            mrg->file[i]->s->base. keys) - 1));
  }
  /* Check that files are identical */
  for (j=0 ; j < count-1 ; j++)
@@ -2043,12 +2050,21 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
  share->state.dellink= HA_OFFSET_ERROR;
  share->state.split=(ha_rows) mrg->records;
  share->state.version=(ulong) time((time_t*) 0);
  share->state.key_map=0;
  if (share->state.key_map != (1ULL << share->base.keys) - 1)
  {
    /*
    Don't save key_file_length here, keep key_file_length of original file
    so "myisamchk -rq" can use this value (this is necessary because index 
    size cannot be easily calculated for fulltext keys)
      Some indexes are disabled, cannot use current key_file_length value
      as an estimate of upper bound of index file size. Use packed data file 
      size instead.
    */
    share->state.state.key_file_length= new_length;
  }
  /*
    If there are no disabled indexes, keep key_file_length value from 
    original file so "myisamchk -rq" can use this value (this is necessary 
    because index size cannot be easily calculated for fulltext keys)
  */
  share->state.key_map=0;
  for (key=0 ; key < share->base.keys ; key++)
    share->state.key_root[key]= HA_OFFSET_ERROR;
  for (key=0 ; key < share->state.header.max_block_size ; key++)
@@ -2057,8 +2073,7 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
  share->changed=1;			/* Force write of header */
  share->state.open_count=0;
  share->global_changed=0;
  VOID(my_chsize(share->kfile, share->state.state.key_file_length, 0,
		 MYF(0)));
  VOID(my_chsize(share->kfile, share->base.keystart, 0, MYF(0)));
  if (share->base.keys)
    isamchk_neaded=1;
  DBUG_RETURN(mi_state_info_write(share->kfile,&share->state,1+2));
@@ -2081,7 +2096,12 @@ static int save_state_mrg(File file,PACK_MRG_INFO *mrg,my_off_t new_length,
  state.state.del=0;
  state.state.empty=0;
  state.state.records=state.split=(ha_rows) mrg->records;
  state.state.key_file_length=isam_file->s->base.keystart;
  /* See comment above in save_state about key_file_length handling. */
  if (mrg->src_file_has_indexes_disabled)
  {
    isam_file->s->state.state.key_file_length=
      max(isam_file->s->state.state.key_file_length, new_length);
  }
  state.dellink= HA_OFFSET_ERROR;
  state.version=(ulong) time((time_t*) 0);
  state.key_map=0;
+34 −0
Original line number Diff line number Diff line
select @@innodb_table_locks;
@@innodb_table_locks
1
drop table if exists t1;
set @@innodb_table_locks=1;
create table t1 (id integer, x integer) engine=INNODB;
insert into t1 values(0, 0);
set autocommit=0;
@@ -20,3 +24,33 @@ id x
0	2
commit;
drop table t1;
set @@innodb_table_locks=0;
create table t1 (id integer primary key, x integer) engine=INNODB;
insert into t1 values(0, 0),(1,1),(2,2);
commit;
SELECT * from t1 where id = 0 FOR UPDATE;
id	x
0	0
set autocommit=0;
set @@innodb_table_locks=0;
lock table t1 write;
update t1 set x=10 where id = 2;
SELECT * from t1 where id = 2;
id	x
2	2
UPDATE t1 set x=3 where id = 2;
commit;
SELECT * from t1;
id	x
0	0
1	1
2	3
commit;
unlock tables;
commit;
select * from t1;
id	x
0	0
1	1
2	10
drop table t1;
Loading