From 5497a05a983f2b64f185ae99d94d265357a8d3c4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 15 Jan 2006 14:50:47 +0300 Subject: [PATCH 1/4] Changes from innodb-4.1-ss14 snapshot Fixed BUG#14056: Column prefix index on UTF-8 primary key causes "Can't find record.." Also fixed bug 15991. innobase/include/os0file.h: Changes from innodb-4.1-ss14 snapshot os_file_hadle_error(): Map the error codes EXDEV, ENOTDIR, and EISDIR to the new code OS_FILE_PATH_ERROR. Treat this code as OS_FILE_PATH_ERROR. This fixes the crash on RENAME TABLE when the .ibd file is a symbolic link to a different file system. (Bug 15991) innobase/os/os0file.c: Changes from innodb-4.1-ss14 snapshot os_file_hadle_error(): Map the error codes EXDEV, ENOTDIR, and EISDIR to the new code OS_FILE_PATH_ERROR. Treat this code as OS_FILE_PATH_ERROR. This fixes the crash on RENAME TABLE when the .ibd file is a symbolic link to a different file system. (Bug 15991) mysql-test/r/innodb.result: Changes from innodb-4.1-ss14 snapshot Fixed BUG#14056: Column prefix index on UTF-8 primary key causes "Can't find record.." mysql-test/t/innodb.test: Changes from innodb-4.1-ss14 snapshot Fixed BUG#14056: Column prefix index on UTF-8 primary key causes "Can't find record.." sql/ha_innodb.cc: Changes from innodb-4.1-ss14 snapshot Fixed BUG#14056: Column prefix index on UTF-8 primary key causes "Can't find record.." --- innobase/include/os0file.h | 5 +- innobase/os/os0file.c | 8 ++- mysql-test/r/innodb.result | 40 +++++++++++ mysql-test/t/innodb.test | 36 ++++++++++ sql/ha_innodb.cc | 131 +++++++++++++++++++++++++++++++++---- 5 files changed, 203 insertions(+), 17 deletions(-) diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h index cd07eb49cd6..0091e942d2c 100644 --- a/innobase/include/os0file.h +++ b/innobase/include/os0file.h @@ -86,9 +86,10 @@ log. */ #define OS_FILE_NOT_FOUND 71 #define OS_FILE_DISK_FULL 72 #define OS_FILE_ALREADY_EXISTS 73 -#define OS_FILE_AIO_RESOURCES_RESERVED 74 /* wait for OS aio resources +#define OS_FILE_PATH_ERROR 74 +#define OS_FILE_AIO_RESOURCES_RESERVED 75 /* wait for OS aio resources to become available again */ -#define OS_FILE_ERROR_NOT_SPECIFIED 75 +#define OS_FILE_ERROR_NOT_SPECIFIED 76 /* Types for aio operations */ #define OS_FILE_READ 10 diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index 49f88c0d62a..6ef6f7cd545 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -303,6 +303,8 @@ os_file_get_last_error( return(OS_FILE_NOT_FOUND); } else if (err == EEXIST) { return(OS_FILE_ALREADY_EXISTS); + } else if (err == EXDEV || err == ENOTDIR || err == EISDIR) { + return(OS_FILE_PATH_ERROR); } else { return(100 + err); } @@ -352,7 +354,8 @@ os_file_handle_error( return(TRUE); - } else if (err == OS_FILE_ALREADY_EXISTS) { + } else if (err == OS_FILE_ALREADY_EXISTS + || err == OS_FILE_PATH_ERROR) { return(FALSE); } else { @@ -456,7 +459,8 @@ os_file_handle_error_no_exit( return(TRUE); - } else if (err == OS_FILE_ALREADY_EXISTS) { + } else if (err == OS_FILE_ALREADY_EXISTS + || err == OS_FILE_PATH_ERROR) { return(FALSE); } else { diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index b43d00bda1c..3ec78c518fc 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1754,3 +1754,43 @@ rename table t3 to t1; ERROR HY000: Error on rename of './test/t3' to './test/t1' (errno: 150) set foreign_key_checks=1; drop table t2,t3; +create table t2 ( +a int, b char(10), filler char(10), primary key(a, b(2)) +) character set utf8 engine = innodb; +insert into t2 values (1,'abcdefg','one'); +insert into t2 values (2,'ijkilmn','two'); +insert into t2 values (3, 'qrstuvw','three'); +update t2 set a=5, filler='booo' where a=1; +drop table t2; +create table t2 ( +a int, b char(10), filler char(10), primary key(a, b(2)) +) character set ucs2 engine = innodb; +insert into t2 values (1,'abcdefg','one'); +insert into t2 values (2,'ijkilmn','two'); +insert into t2 values (3, 'qrstuvw','three'); +update t2 set a=5, filler='booo' where a=1; +drop table t2; +create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8; +insert into t1 values(1,'abcdefg'),(2,'defghijk'); +insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); +insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); +select a,hex(b) from t1 order by b; +a hex(b) +1 61626364656667 +2 6465666768696A6B +6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1 +7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2 +update t1 set b = 'three' where a = 6; +drop table t1; +create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8; +insert into t1 values(1,'abcdefg'),(2,'defghijk'); +insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); +insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); +select a,hex(b) from t1 order by b; +a hex(b) +1 61626364656667 +2 6465666768696A6B +6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1 +7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2 +update t1 set b = 'three' where a = 6; +drop table t1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 03aa113c662..e2c12eedcae 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1329,4 +1329,40 @@ create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; rename table t3 to t1; set foreign_key_checks=1; drop table t2,t3; + +# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..' + +create table t2 ( + a int, b char(10), filler char(10), primary key(a, b(2)) +) character set utf8 engine = innodb; + +insert into t2 values (1,'abcdefg','one'); +insert into t2 values (2,'ijkilmn','two'); +insert into t2 values (3, 'qrstuvw','three'); +update t2 set a=5, filler='booo' where a=1; +drop table t2; +create table t2 ( + a int, b char(10), filler char(10), primary key(a, b(2)) +) character set ucs2 engine = innodb; + +insert into t2 values (1,'abcdefg','one'); +insert into t2 values (2,'ijkilmn','two'); +insert into t2 values (3, 'qrstuvw','three'); +update t2 set a=5, filler='booo' where a=1; +drop table t2; + +create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8; +insert into t1 values(1,'abcdefg'),(2,'defghijk'); +insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); +insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); +select a,hex(b) from t1 order by b; +update t1 set b = 'three' where a = 6; +drop table t1; +create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8; +insert into t1 values(1,'abcdefg'),(2,'defghijk'); +insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); +insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); +select a,hex(b) from t1 order by b; +update t1 set b = 'three' where a = 6; +drop table t1; # End of 4.1 tests diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index b188cfcba21..d24587e23ea 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2015,6 +2015,22 @@ get_innobase_type_from_mysql_type( return(0); } +/*********************************************************************** +Writes an unsigned integer value < 64k to 2 bytes, in the little-endian +storage format. */ +inline +void +innobase_write_to_2_little_endian( +/*==============================*/ + byte* buf, /* in: where to store */ + ulint val) /* in: value to write, must be < 64k */ +{ + ut_a(val < 256 * 256); + + buf[0] = (byte)(val & 0xFF); + buf[1] = (byte)(val / 256); +} + /*********************************************************************** Stores a key value for a row to a buffer. */ @@ -2034,8 +2050,6 @@ ha_innobase::store_key_val_for_row( char* buff_start = buff; enum_field_types mysql_type; Field* field; - ulint blob_len; - byte* blob_data; ibool is_null; DBUG_ENTER("store_key_val_for_row"); @@ -2084,13 +2098,25 @@ ha_innobase::store_key_val_for_row( || mysql_type == FIELD_TYPE_BLOB || mysql_type == FIELD_TYPE_LONG_BLOB) { + CHARSET_INFO* cs; + ulint key_len; + ulint len; + ulint true_len; + int error=0; + ulint blob_len; + byte* blob_data; + ut_a(key_part->key_part_flag & HA_PART_KEY_SEG); + key_len = key_part->length; + if (is_null) { - buff += key_part->length + 2; + buff += key_len + 2; continue; } + + cs = field->charset(); blob_data = row_mysql_read_blob_ref(&blob_len, (byte*) (record @@ -2099,29 +2125,108 @@ ha_innobase::store_key_val_for_row( ut_a(get_field_offset(table, field) == key_part->offset); - if (blob_len > key_part->length) { - blob_len = key_part->length; + + true_len = blob_len; + + /* For multi byte character sets we need to calculate + the true length of the key */ + + if (key_len > 0 && cs->mbmaxlen > 1) { + true_len = (ulint) cs->cset->well_formed_len(cs, + (const char *) blob_data, + (const char *) blob_data + + blob_len, + key_len / cs->mbmaxlen, + &error); + } + + /* All indexes on BLOB and TEXT are column prefix + indexes, and we may need to truncate the data to be + stored in the key value: */ + + if (true_len > key_len) { + true_len = key_len; } /* MySQL reserves 2 bytes for the length and the storage of the number is little-endian */ - ut_a(blob_len < 256); - *((byte*)buff) = (byte)blob_len; + innobase_write_to_2_little_endian( + (byte*)buff, true_len); buff += 2; - memcpy(buff, blob_data, blob_len); + memcpy(buff, blob_data, true_len); - buff += key_part->length; + /* Note that we always reserve the maximum possible + length of the BLOB prefix in the key value. */ + + buff += key_len; } else { + /* Here we handle all other data types except the + true VARCHAR, BLOB and TEXT. Note that the column + value we store may be also in a column prefix + index. */ + + CHARSET_INFO* cs; + ulint true_len; + ulint key_len; + const mysql_byte* src_start; + int error=0; + enum_field_types real_type; + + key_len = key_part->length; + if (is_null) { - buff += key_part->length; + buff += key_len; continue; } - memcpy(buff, record + key_part->offset, - key_part->length); - buff += key_part->length; + + src_start = record + key_part->offset; + real_type = field->real_type(); + true_len = key_len; + + /* Character set for the field is defined only + to fields whose type is string and real field + type is not enum or set. For these fields check + if character set is multi byte. */ + + if (real_type != FIELD_TYPE_ENUM + && real_type != FIELD_TYPE_SET + && ( mysql_type == MYSQL_TYPE_VAR_STRING + || mysql_type == MYSQL_TYPE_STRING)) { + + cs = field->charset(); + + /* For multi byte character sets we need to + calculate the true length of the key */ + + if (key_len > 0 && cs->mbmaxlen > 1) { + + true_len = (ulint) + cs->cset->well_formed_len(cs, + (const char *)src_start, + (const char *)src_start + + key_len, + key_len / cs->mbmaxlen, + &error); + } + } + + memcpy(buff, src_start, true_len); + buff += true_len; + + /* Pad the unused space with spaces. Note that no + padding is ever needed for UCS-2 because in MySQL, + all UCS2 characters are 2 bytes, as MySQL does not + support surrogate pairs, which are needed to represent + characters in the range U+10000 to U+10FFFF. */ + + if (true_len < key_len) { + ulint pad_len = key_len - true_len; + memset(buff, ' ', pad_len); + buff += pad_len; + } } } From bf38d0077096280bea615feb1a77200a93fe2624 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 16 Jan 2006 09:56:10 +0100 Subject: [PATCH 2/4] Windows Visual Studio 2003 fixes. VC++Files/client/mysqldump.vcproj: Add new file that was missing from .vcproj. VC++Files/sql/mysqld.vcproj: Add new file that was missing from .vcproj. --- VC++Files/client/mysqldump.vcproj | 27 +++++++++++ VC++Files/sql/mysqld.vcproj | 75 +++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) diff --git a/VC++Files/client/mysqldump.vcproj b/VC++Files/client/mysqldump.vcproj index b6a33596083..39b83fd46f3 100644 --- a/VC++Files/client/mysqldump.vcproj +++ b/VC++Files/client/mysqldump.vcproj @@ -226,6 +226,33 @@ PreprocessorDefinitions=""/> + + + + + + + + + + + diff --git a/VC++Files/sql/mysqld.vcproj b/VC++Files/sql/mysqld.vcproj index 49bf74ae5a2..d5a10db380a 100644 --- a/VC++Files/sql/mysqld.vcproj +++ b/VC++Files/sql/mysqld.vcproj @@ -3744,6 +3744,81 @@ PreprocessorDefinitions=""/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Date: Mon, 30 Jan 2006 13:09:08 +0100 Subject: [PATCH 3/4] Windows compile fixes in preparation for 5.1.6 beta. VC++Files/client/mysqldump.vcproj: Add missing source file. VC++Files/mysql.sln: Fix configuration mismatch. VC++Files/sql/mysqld.vcproj: Enable row-based replication. Add missing source files. scripts/make_win_src_distribution.sh: Add copying of missing directory. sql/event.h: Fix type conflict only visible on Windows. sql/event_executor.cc: Fix non-portable thread stuff. sql/event_timed.cc: Fix type conflict only visible on Windows. sql/ha_archive.cc: Add cast needed for Windows. sql/handler.h: Fix Windows byte * <-> char * mismatch. sql/opt_range.cc: Fix Windows byte * <-> char * mismatch. sql/set_var.cc: BUG#16811 Fix Windows compilation by making the cast-away of volatile implicit (Windows linker does not like volatile <-> non-volatile mismatch, in contrast to Unix) sql/sql_partition.cc: Fix Windows byte * <-> char * mismatch. --- VC++Files/client/mysqldump.vcproj | 27 ++ VC++Files/mysql.sln | 28 +- VC++Files/sql/mysqld.vcproj | 468 ++++++++++++++++++++++++++- scripts/make_win_src_distribution.sh | 2 +- sql/event.h | 2 +- sql/event_executor.cc | 2 +- sql/event_timed.cc | 2 +- sql/ha_archive.cc | 2 +- sql/handler.h | 2 +- sql/opt_range.cc | 4 +- sql/set_var.cc | 4 +- sql/sql_partition.cc | 8 +- 12 files changed, 517 insertions(+), 34 deletions(-) diff --git a/VC++Files/client/mysqldump.vcproj b/VC++Files/client/mysqldump.vcproj index b6a33596083..3585374eea5 100644 --- a/VC++Files/client/mysqldump.vcproj +++ b/VC++Files/client/mysqldump.vcproj @@ -226,6 +226,33 @@ PreprocessorDefinitions=""/> + + + + + + + + + + + diff --git a/VC++Files/mysql.sln b/VC++Files/mysql.sln index 44409aff48c..afe09897ace 100644 --- a/VC++Files/mysql.sln +++ b/VC++Files/mysql.sln @@ -1048,8 +1048,8 @@ Global {44D9C7DC-6636-4B82-BD01-6876C64017DF}.classic.Build.0 = TLS|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.classic nt.ActiveCfg = TLS|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.classic nt.Build.0 = TLS|Win32 - {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Debug.ActiveCfg = TLS_DEBUG|Win32 - {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Debug.Build.0 = TLS_DEBUG|Win32 + {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Debug.ActiveCfg = Debug|Win32 + {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Debug.Build.0 = Debug|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_Classic.ActiveCfg = Release|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_Classic.Build.0 = Release|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_Debug.ActiveCfg = Debug|Win32 @@ -1060,10 +1060,10 @@ Global {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_ProGPL.Build.0 = Release|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_Release.ActiveCfg = Release|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_Release.Build.0 = Release|Win32 - {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max.ActiveCfg = TLS|Win32 - {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max.Build.0 = TLS|Win32 - {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max nt.ActiveCfg = TLS|Win32 - {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max nt.Build.0 = TLS|Win32 + {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max.ActiveCfg = Max|Win32 + {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max.Build.0 = Max|Win32 + {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max nt.ActiveCfg = Max|Win32 + {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max nt.Build.0 = Max|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.nt.ActiveCfg = TLS|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.nt.Build.0 = TLS|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.pro.ActiveCfg = TLS|Win32 @@ -1542,10 +1542,10 @@ Global {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Embedded_ProGPL.Build.0 = Release|Win32 {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Embedded_Release.ActiveCfg = Release|Win32 {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Embedded_Release.Build.0 = Release|Win32 - {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max.ActiveCfg = TLS|Win32 - {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max.Build.0 = TLS|Win32 - {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max nt.ActiveCfg = TLS|Win32 - {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max nt.Build.0 = TLS|Win32 + {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max.ActiveCfg = Release|Win32 + {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max.Build.0 = Release|Win32 + {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max nt.ActiveCfg = Release|Win32 + {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max nt.Build.0 = Release|Win32 {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.nt.ActiveCfg = TLS|Win32 {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.nt.Build.0 = TLS|Win32 {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.pro.ActiveCfg = TLS|Win32 @@ -1686,10 +1686,10 @@ Global {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_ProGPL.Build.0 = Debug|Win32 {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_Release.ActiveCfg = Release|Win32 {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_Release.Build.0 = Release|Win32 - {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max.ActiveCfg = Debug|Win32 - {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max.Build.0 = Debug|Win32 - {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max nt.ActiveCfg = Debug|Win32 - {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max nt.Build.0 = Debug|Win32 + {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max.ActiveCfg = Release|Win32 + {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max.Build.0 = Release|Win32 + {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max nt.ActiveCfg = Release|Win32 + {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max nt.Build.0 = Release|Win32 {2E9332CF-072A-4381-BF37-17C5AB4F8583}.nt.ActiveCfg = Debug|Win32 {2E9332CF-072A-4381-BF37-17C5AB4F8583}.nt.Build.0 = Debug|Win32 {2E9332CF-072A-4381-BF37-17C5AB4F8583}.pro.ActiveCfg = Debug|Win32 diff --git a/VC++Files/sql/mysqld.vcproj b/VC++Files/sql/mysqld.vcproj index 6002fb5d815..8dc7843b66e 100644 --- a/VC++Files/sql/mysqld.vcproj +++ b/VC++Files/sql/mysqld.vcproj @@ -25,7 +25,7 @@ InlineFunctionExpansion="1" OptimizeForProcessor="2" AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include" - PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;LICENSE=Commercial" + PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;LICENSE=Commercial;HAVE_ROW_BASED_REPLICATION" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -212,7 +212,7 @@ InlineFunctionExpansion="1" OptimizeForProcessor="2" AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include" - PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE" + PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -276,7 +276,7 @@ InlineFunctionExpansion="1" OptimizeForProcessor="2" AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include" - PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;LICENSE=Commercial;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE" + PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;LICENSE=Commercial;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -398,7 +398,7 @@ InlineFunctionExpansion="1" OptimizeForProcessor="2" AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include" - PreprocessorDefinitions="MYSQL_SERVER;LICENSE=Commercial;HAVE_DLOPEN;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE" + PreprocessorDefinitions="MYSQL_SERVER;LICENSE=Commercial;HAVE_DLOPEN;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -460,7 +460,7 @@ InlineFunctionExpansion="1" OptimizeForProcessor="2" AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include" - PreprocessorDefinitions="LICENSE=Commercial;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;DBUG_OFF;NDEBUG" + PreprocessorDefinitions="LICENSE=Commercial;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;DBUG_OFF;NDEBUG;HAVE_ROW_BASED_REPLICATION" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -521,7 +521,7 @@ InlineFunctionExpansion="1" OptimizeForProcessor="2" AdditionalIncludeDirectories="../zlib,../include,../regex,../extra/yassl/include" - PreprocessorDefinitions="NDEBUG;DBUG_OFF;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE" + PreprocessorDefinitions="NDEBUG;DBUG_OFF;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -9137,6 +9137,462 @@ PreprocessorDefinitions=""/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index 2f2d6bb393e..12237795a8f 100644 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -249,7 +249,7 @@ copy_dir_dirs() { # Input directories to be copied # -for i in client dbug extra storage/heap include storage/archive \ +for i in client dbug extra storage/heap include storage/archive storage/example \ libmysql libmysqld storage/myisam \ storage/myisammrg mysys regex sql strings sql-common sql/examples \ tools vio zlib diff --git a/sql/event.h b/sql/event.h index 80629fa0a70..c3f3b44d557 100644 --- a/sql/event.h +++ b/sql/event.h @@ -157,7 +157,7 @@ public: update_fields(THD *thd); char * - get_show_create_event(THD *thd, uint *length); + get_show_create_event(THD *thd, uint32 *length); int execute(THD *thd, MEM_ROOT *mem_root= NULL); diff --git a/sql/event_executor.cc b/sql/event_executor.cc index 4eb92f9e430..7a74a81e9fa 100644 --- a/sql/event_executor.cc +++ b/sql/event_executor.cc @@ -460,7 +460,7 @@ event_executor_worker(void *event_void) thd->thread_stack = (char*)&thd; // remember where our stack is thd->mem_root= &worker_mem_root; - pthread_detach(pthread_self()); + pthread_detach_this_thread(); if (init_event_thread(thd)) goto err; diff --git a/sql/event_timed.cc b/sql/event_timed.cc index 3b59bb33596..cce96f93b90 100644 --- a/sql/event_timed.cc +++ b/sql/event_timed.cc @@ -934,7 +934,7 @@ done: char * -event_timed::get_show_create_event(THD *thd, uint *length) +event_timed::get_show_create_event(THD *thd, uint32 *length) { char *dst, *ret; uint len, tmp_len; diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc index 06130f31504..65049bac135 100644 --- a/sql/ha_archive.cc +++ b/sql/ha_archive.cc @@ -801,7 +801,7 @@ int ha_archive::write_row(byte *buf) error: pthread_mutex_unlock(&share->mutex); if (read_buf) - my_free(read_buf, MYF(0)); + my_free((gptr) read_buf, MYF(0)); DBUG_RETURN(rc); } diff --git a/sql/handler.h b/sql/handler.h index 43495b46cce..17131ee556c 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -795,7 +795,7 @@ typedef struct st_partition_iter typedef int (*get_partitions_in_range_iter)(partition_info *part_info, bool is_subpart, - byte *min_val, byte *max_val, + char *min_val, char *max_val, uint flags, PARTITION_ITERATOR *part_iter); diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 96e73dc465a..db228f076ca 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -338,8 +338,8 @@ public: */ if (min_flag || max_flag) return FALSE; - byte *min_val= min_value; - byte *max_val= min_value; + byte *min_val= (byte *)min_value; + byte *max_val= (byte *)min_value; if (maybe_null) { diff --git a/sql/set_var.cc b/sql/set_var.cc index b85b2576b83..1a86cd1aef7 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -109,7 +109,7 @@ extern ulong ndb_report_thresh_binlog_mem_usage; -extern my_bool event_executor_running_global_var; +extern volatile my_bool event_executor_running_global_var; static HASH system_variable_hash; const char *bool_type_names[]= { "OFF", "ON", NullS }; @@ -216,7 +216,7 @@ sys_var_long_ptr sys_delayed_insert_timeout("delayed_insert_timeout", sys_var_long_ptr sys_delayed_queue_size("delayed_queue_size", &delayed_queue_size); sys_var_event_executor sys_event_executor("event_scheduler", - &event_executor_running_global_var); + (my_bool *)&event_executor_running_global_var); sys_var_long_ptr sys_expire_logs_days("expire_logs_days", &expire_logs_days); sys_var_bool_ptr sys_flush("flush", &myisam_flush); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 52d2d61e843..6c4e1eddbfb 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -116,12 +116,12 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter); uint32 get_next_partition_id_list(PARTITION_ITERATOR* part_iter); int get_part_iter_for_interval_via_mapping(partition_info *part_info, bool is_subpart, - byte *min_value, byte *max_value, + char *min_value, char *max_value, uint flags, PARTITION_ITERATOR *part_iter); int get_part_iter_for_interval_via_walking(partition_info *part_info, bool is_subpart, - byte *min_value, byte *max_value, + char *min_value, char *max_value, uint flags, PARTITION_ITERATOR *part_iter); static void set_up_range_analysis_info(partition_info *part_info); @@ -5731,7 +5731,7 @@ typedef uint32 (*get_endpoint_func)(partition_info*, bool left_endpoint, int get_part_iter_for_interval_via_mapping(partition_info *part_info, bool is_subpart, - byte *min_value, byte *max_value, + char *min_value, char *max_value, uint flags, PARTITION_ITERATOR *part_iter) { @@ -5847,7 +5847,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, int get_part_iter_for_interval_via_walking(partition_info *part_info, bool is_subpart, - byte *min_value, byte *max_value, + char *min_value, char *max_value, uint flags, PARTITION_ITERATOR *part_iter) { From e65d02e005fce8ec543a64e802272c3c9ba877b9 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Jan 2006 14:10:12 +0100 Subject: [PATCH 4/4] Fix mysqlslap.vcproj dependencies also for Release and classic configuration. VC++Files/client/mysqlslap.vcproj: Fix dependencies also for Release and classic configuration. --- VC++Files/client/mysqlslap.vcproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VC++Files/client/mysqlslap.vcproj b/VC++Files/client/mysqlslap.vcproj index ff0d9a437ed..072c7957f11 100644 --- a/VC++Files/client/mysqlslap.vcproj +++ b/VC++Files/client/mysqlslap.vcproj @@ -40,7 +40,7 @@ Name="VCCustomBuildTool"/>