From bb26549bc0f5abf85c5528913ab394af749f645a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Feb 2006 00:29:50 +0100 Subject: [PATCH 01/12] fix for bug #16400 scripts/mysql_fix_privilege_tables.sh: fix the message as per #16399 sql/sql_acl.cc: fix the priv per review comment by Serg --- scripts/mysql_fix_privilege_tables.sh | 6 +----- scripts/mysql_fix_privilege_tables.sql | 5 +++++ sql/sql_acl.cc | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh index 073964d4bde..8c0c539f3f2 100644 --- a/scripts/mysql_fix_privilege_tables.sh +++ b/scripts/mysql_fix_privilege_tables.sh @@ -163,11 +163,7 @@ s_echo() } s_echo "This script updates all the mysql privilege tables to be usable by" -s_echo "MySQL 4.0 and above." -s_echo "" -s_echo "This is needed if you want to use the new GRANT functions," -s_echo "CREATE AGGREGATE FUNCTION, stored procedures, or" -s_echo "more secure passwords in 4.1" +s_echo "MySQL 5.1 and above." s_echo "" if test $verbose = 1 diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql index 0fbaf7bec8a..0d45728dda3 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql @@ -630,6 +630,9 @@ CREATE TABLE event ( # EVENT privilege # +SET @hadEventPriv := 0; +SELECT @hadEventPriv :=1 FROM user WHERE Event_priv LIKE '%'; + ALTER TABLE user add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL AFTER Create_user_priv; ALTER TABLE db add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL; ALTER TABLE event DROP PRIMARY KEY; @@ -667,6 +670,8 @@ ALTER TABLE event ADD sql_mode 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL AFTER on_completion; +UPDATE user SET Event_priv=Super_priv WHERE @hadEventPriv = 0; + -- -- TRIGGER privilege -- diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index bebee7df8b2..b9bfe7b508b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -471,10 +471,10 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) /* - if it is pre 5.1.4 privilege table then map CREATE privilege on + if it is pre 5.1.6 privilege table then map CREATE privilege on CREATE|ALTER|DROP|EXECUTE EVENT */ - if (table->s->fields <= 37 && (user.access & CREATE_ACL)) + if (table->s->fields <= 37 && (user.access & SUPER_ACL)) user.access|= EVENT_ACL; /* From 3754c4eb1ff465b45b3cfcb441e5cffe94ee7bfc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Feb 2006 01:24:41 +0100 Subject: [PATCH 02/12] Makefile.am: Conditionally link with libmysqlclient.la or libmysqlclient_r.la configure.in: Corrected help text for --with-debug option Changed default to be with thread safe client Added THREAD_SAFE_CLIENT to be used in 'if' in make files configure.in: Corrected help text for --with-debug option Changed default to be with thread safe client Added THREAD_SAFE_CLIENT to be used in 'if' in make files client/Makefile.am: Conditionally link with libmysqlclient.la or libmysqlclient_r.la --- client/Makefile.am | 33 ++++++++++++++++++++------------- configure.in | 11 +++++++---- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/client/Makefile.am b/client/Makefile.am index 98f9dd019b5..4d089b4b5b4 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -21,14 +21,21 @@ if HAVE_YASSL else yassl_dummy_link_fix= endif + +if THREAD_SAFE_CLIENT +LIBMYSQLCLIENT_LA = $(top_builddir)/libmysql_r/libmysqlclient_r.la +else +LIBMYSQLCLIENT_LA = $(top_builddir)/libmysql/libmysqlclient.la +endif + #AUTOMAKE_OPTIONS = nostdinc INCLUDES = -I$(top_builddir)/include \ -I$(top_srcdir)/include \ -I$(top_srcdir)/regex \ - $(openssl_includes) $(yassl_includes) + $(openssl_includes) $(yassl_includes) LIBS = @CLIENT_LIBS@ LDADD= @CLIENT_EXTRA_LDFLAGS@ $(CLIENT_THREAD_LIBS) \ - $(top_builddir)/libmysql/libmysqlclient.la + $(top_builddir)/libmysql/libmysqlclient.la bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \ mysqldump mysqlimport mysqltest mysqlbinlog \ mysqltestmanagerc mysqltestmanager-pwgen \ @@ -38,8 +45,8 @@ noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \ mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc mysqladmin_SOURCES = mysqladmin.cc mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS) -mysqltest_SOURCES= mysqltest.c $(top_srcdir)/mysys/my_getsystime.c \ - $(yassl_dummy_link_fix) +mysqltest_SOURCES= mysqltest.c $(top_srcdir)/mysys/my_getsystime.c \ + $(yassl_dummy_link_fix) mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD) mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c \ $(top_srcdir)/mysys/my_new.cc \ @@ -50,20 +57,20 @@ mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c \ mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS) mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ @CLIENT_EXTRA_LDFLAGS@ \ - $(top_builddir)/libmysql_r/libmysqlclient_r.la \ + $(LIBMYSQLCLIENT_LA) \ $(top_builddir)/mysys/libmysys.a mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ @CLIENT_EXTRA_LDFLAGS@ \ - $(top_builddir)/libmysql_r/libmysqlclient_r.la \ + $(LIBMYSQLCLIENT_LA) \ $(top_builddir)/mysys/libmysys.a -mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c -mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix) -mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix) -mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix) -mysqlslap_SOURCES= mysqlslap.c \ +mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c +mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix) +mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix) +mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix) +mysqlslap_SOURCES= mysqlslap.c \ $(yassl_dummy_link_fix) -mysqldump_SOURCES= mysqldump.c my_user.c $(yassl_dummy_link_fix) -mysqlimport_SOURCES= mysqlimport.c \ +mysqldump_SOURCES= mysqldump.c my_user.c $(yassl_dummy_link_fix) +mysqlimport_SOURCES= mysqlimport.c \ $(yassl_dummy_link_fix) sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc strings_src=decimal.c diff --git a/configure.in b/configure.in index 2d914d8f90c..49b94f1e1e3 100644 --- a/configure.in +++ b/configure.in @@ -589,10 +589,10 @@ AC_ARG_WITH(named-curses-libs, # Make thread safe client AC_ARG_ENABLE(thread-safe-client, - [ --enable-thread-safe-client - Compile the client with threads.], + [ --disable-thread-safe-client + Compile the client without threads.], [ THREAD_SAFE_CLIENT=$enableval ], - [ THREAD_SAFE_CLIENT=no ] + [ THREAD_SAFE_CLIENT=yes ] ) # compile with strings functions in assembler @@ -1564,7 +1564,8 @@ then fi AC_ARG_WITH(debug, - [ --without-debug Build a production version without debugging code], + [ --with-debug Add debug code + --with-debug=full Add debug code (adds memory checker, very slow)], [with_debug=$withval], [with_debug=no]) if test "$with_debug" = "yes" @@ -2472,6 +2473,8 @@ dnl client is just using plain-old libs. sql_client_dirs="strings regex mysys libmysql client" linked_client_targets="linked_libmysql_sources" +AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no") + if test "$THREAD_SAFE_CLIENT" != "no" then sql_client_dirs="libmysql_r $sql_client_dirs" From c6ee60933db6149bceffd7b670fd806c5f4ec6a7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Feb 2006 23:20:29 -0500 Subject: [PATCH 03/12] BUG#17521 alter database crashes slave Problem was a null pointer Fixed by passing correct database name to slave filtering mechanism Added test. sql/sql_parse.cc: Fix slave crash when issuing 'ALTER DATABASE' with specifying db name Don't pass null pointer to db_ok_with_wild_table() --- mysql-test/r/rpl_alter_db.result | 8 ++++++++ mysql-test/t/rpl_alter_db.test | 10 ++++++++++ sql/sql_parse.cc | 6 +++--- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 mysql-test/r/rpl_alter_db.result create mode 100644 mysql-test/t/rpl_alter_db.test diff --git a/mysql-test/r/rpl_alter_db.result b/mysql-test/r/rpl_alter_db.result new file mode 100644 index 00000000000..6edbe5d427f --- /dev/null +++ b/mysql-test/r/rpl_alter_db.result @@ -0,0 +1,8 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +use mysql; +alter database collate latin1_bin; diff --git a/mysql-test/t/rpl_alter_db.test b/mysql-test/t/rpl_alter_db.test new file mode 100644 index 00000000000..5ac8a2f4018 --- /dev/null +++ b/mysql-test/t/rpl_alter_db.test @@ -0,0 +1,10 @@ +source include/master-slave.inc; +connection master; +use mysql; # to be different from initial `test' db of mysqltest client +alter database collate latin1_bin; +save_master_pos; + +connection slave; +sync_with_master; + + diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b84eb1cfcb8..e4bbcfc5074 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3715,7 +3715,7 @@ end_with_restore_list: } if (!strip_sp(db) || check_db_name(db)) { - my_error(ER_WRONG_DB_NAME, MYF(0), lex->name); + my_error(ER_WRONG_DB_NAME, MYF(0), db); break; } /* @@ -3727,8 +3727,8 @@ end_with_restore_list: */ #ifdef HAVE_REPLICATION if (thd->slave_thread && - (!rpl_filter->db_ok(lex->name) || - !rpl_filter->db_ok_with_wild_table(lex->name))) + (!rpl_filter->db_ok(db) || + !rpl_filter->db_ok_with_wild_table(db))) { my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0)); break; From dededdec0ab3ebebd1fb1f9c346664cc49d34b78 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Feb 2006 15:38:20 +0100 Subject: [PATCH 04/12] BUG#13418 (V2): Bit columns should replicate correctly when using RBR mysql-test/r/rpl_bit_npk.result: Updated results mysql-test/t/disabled.def: rpl_bit_npk now works sql/field.h: Field_bit::cmp_binary_offset wrongly used base class method that does not work for Field_bit This was discussed with Monty and should be pushed into 5.0 too sql/log_event.cc: Added checks for null bits Swapped use of m_after_image (was m_search_record) and table->record[1] to use record[i] in the same way as other MySQL code (i.e. use record[1] for scan data). Removed use of cmp_binary in record_compare (it is currently wrong to use that without copying the null bits to the compare data record) sql/log_event.h: Name change to indicate new semantics --- mysql-test/r/rpl_bit_npk.result | 60 ++++++++++++++++------ mysql-test/t/disabled.def | 2 +- sql/field.h | 21 +++++++- sql/log_event.cc | 89 +++++++++++++++++++-------------- sql/log_event.h | 6 +-- 5 files changed, 118 insertions(+), 60 deletions(-) diff --git a/mysql-test/r/rpl_bit_npk.result b/mysql-test/r/rpl_bit_npk.result index aeefc77d69b..2850e63aabd 100644 --- a/mysql-test/r/rpl_bit_npk.result +++ b/mysql-test/r/rpl_bit_npk.result @@ -45,25 +45,27 @@ GSuppDf TINYINT, VNotSupp TINYINT, x034 TINYINT); LOCK TABLES test.t1 WRITE; -INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,2,1); +INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,NULL,1); INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); +INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'0',1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); UNLOCK TABLES; +UPDATE test.t1 set x034 = 50 where bit3 = b'000000'; +UPDATE test.t1 set VNotSupp = 33 where bit1 = b'0'; SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1; oSupp sSuppD GSuppDf VNotSupp x034 +5 5 3 NULL 1 5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 +5 5 3 33 1 +5 5 3 2 50 +5 5 3 33 1 +5 5 3 33 1 +5 5 3 33 1 +5 5 3 33 1 SELECT hex(bit1) from test.t1; hex(bit1) 3F @@ -96,14 +98,14 @@ hex(bit3) 1 SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1; oSupp sSuppD GSuppDf VNotSupp x034 +5 5 3 NULL 1 5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 +5 5 3 33 1 +5 5 3 2 50 +5 5 3 33 1 +5 5 3 33 1 +5 5 3 33 1 +5 5 3 33 1 SELECT hex(bit1) from test.t1; hex(bit1) 3F @@ -134,4 +136,30 @@ hex(bit3) 1 1 1 +CREATE TABLE test.t2 (a INT, b BIT(1)); +INSERT INTO test.t2 VALUES (1, b'0'); +INSERT INTO test.t2 VALUES (1, b'1'); +UPDATE test.t2 SET a = 2 WHERE b = b'1'; +CREATE TABLE test.t3 (a INT, b INT); +INSERT INTO test.t3 VALUES (1, NULL); +INSERT INTO test.t3 VALUES (1, 0); +UPDATE test.t3 SET a = 2 WHERE b = 0; +SELECT a, hex(b) FROM test.t2; +a hex(b) +1 0 +2 1 +SELECT * FROM test.t3; +a b +1 NULL +2 0 +SELECT a, hex(b) FROM test.t2; +a hex(b) +1 0 +2 1 +SELECT * FROM test.t3; +a b +1 NULL +2 0 DROP TABLE IF EXISTS test.t1; +DROP TABLE IF EXISTS test.t2; +DROP TABLE IF EXISTS test.t3; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 1c0c92c86a3..fdb719ed39a 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -20,7 +20,7 @@ ndb_binlog_ddl_multi : Bug#17038 [PATCH PENDING] ndb_load : Bug#17233 partition_03ndb : Bug#16385 ps_7ndb : dbug assert in RBR mode when executing test suite -rpl_bit_npk : Bug#13418 +#rpl_bit_npk : Bug#13418 rpl_ddl : Bug#15963 SBR does not show "Definer" correctly rpl_ndb_auto_inc : Bug#17086 rpl_ndb_basic : Bug#16228 [IN REVIEW] diff --git a/sql/field.h b/sql/field.h index 15c54f65ef7..ca178f518fd 100644 --- a/sql/field.h +++ b/sql/field.h @@ -173,8 +173,9 @@ public: virtual int cmp(const char *,const char *)=0; virtual int cmp_binary(const char *a,const char *b, uint32 max_length=~0L) { return memcmp(a,b,pack_length()); } - int cmp_offset(uint row_offset) { return cmp(ptr,ptr+row_offset); } - int cmp_binary_offset(uint row_offset) + virtual int cmp_offset(uint row_offset) + { return cmp(ptr,ptr+row_offset); } + virtual int cmp_binary_offset(uint row_offset) { return cmp_binary(ptr, ptr+row_offset); }; virtual int key_cmp(const byte *a,const byte *b) { return cmp((char*) a,(char*) b); } @@ -1317,6 +1318,20 @@ public: }; +/* + Note: + To use Field_bit::cmp_binary() you need to copy the bits stored in + the beginning of the record (the NULL bytes) to each memory you + want to compare (where the arguments point). + + This is the reason: + - Field_bit::cmp_binary() is only implemented in the base class + (Field::cmp_binary()). + - Field::cmp_binary() currenly use pack_length() to calculate how + long the data is. + - pack_length() includes size of the bits stored in the NULL bytes + of the record. +*/ class Field_bit :public Field { public: uchar *bit_ptr; // position in record where 'uneven' bits store @@ -1342,6 +1357,8 @@ public: my_decimal *val_decimal(my_decimal *); int cmp(const char *a, const char *b) { return cmp_binary(a, b); } + int cmp_binary_offset(uint row_offset) + { return cmp_offset(row_offset); } int cmp_max(const char *a, const char *b, uint max_length); int key_cmp(const byte *a, const byte *b) { return cmp_binary((char *) a, (char *) b); } diff --git a/sql/log_event.cc b/sql/log_event.cc index 3c7dcc250c8..2b335e7b67d 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -6359,18 +6359,27 @@ void Write_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info) **************************************************************************/ #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) -static int record_compare(TABLE *table, char const *a, char const *b) +/* + Compares table->record[0] and table->record[1] + + Returns TRUE if different. +*/ +static bool record_compare(TABLE *table) { - for (my_size_t i= 0 ; i < table->s->fields ; ++i) + if (table->s->blob_fields + table->s->varchar_fields == 0) + return cmp_record(table,record[1]); + /* Compare null bits */ + if (memcmp(table->null_flags, + table->null_flags+table->s->rec_buff_length, + table->s->null_bytes)) + return TRUE; // Diff in NULL value + /* Compare updated fields */ + for (Field **ptr=table->field ; *ptr ; ptr++) { - uint const off= table->field[i]->offset(); - uint const res= table->field[i]->cmp_binary(a + off, - b + off); - if (res != 0) { - return res; - } + if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length)) + return TRUE; } - return 0; + return FALSE; } @@ -6378,15 +6387,12 @@ static int record_compare(TABLE *table, char const *a, char const *b) Find the row given by 'key', if the table has keys, or else use a table scan to find (and fetch) the row. If the engine allows random access of the records, a combination of position() and rnd_pos() will be used. - - The 'record_buf' will be used as buffer for records while locating the - correct row. */ -static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) +static int find_and_fetch_row(TABLE *table, byte *key) { DBUG_ENTER("find_and_fetch_row(TABLE *table, byte *key, byte *record)"); DBUG_PRINT("enter", ("table=%p, key=%p, record=%p", - table, key, record_buf)); + table, key, table->record[1])); DBUG_ASSERT(table->in_use != NULL); @@ -6404,7 +6410,7 @@ static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) DBUG_RETURN(table->file->rnd_pos(table->record[0], table->file->ref)); } - DBUG_ASSERT(record_buf); + DBUG_ASSERT(table->record[1]); /* We need to retrieve all fields */ table->file->ha_set_all_bits_in_read_set(); @@ -6412,7 +6418,7 @@ static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) if (table->s->keys > 0) { int error; - if ((error= table->file->index_read_idx(record_buf, 0, key, + if ((error= table->file->index_read_idx(table->record[1], 0, key, table->key_info->key_length, HA_READ_KEY_EXACT))) { @@ -6437,10 +6443,10 @@ static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) if (table->key_info->flags & HA_NOSAME) DBUG_RETURN(0); - while (record_compare(table, (const char*)table->record[0], (const char*)record_buf) != 0) + while (record_compare(table)) { int error; - if ((error= table->file->index_next(record_buf))) + if ((error= table->file->index_next(table->record[1]))) { table->file->print_error(error, MYF(0)); DBUG_RETURN(error); @@ -6454,7 +6460,7 @@ static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) int error= 0; do { - error= table->file->rnd_next(record_buf); + error= table->file->rnd_next(table->record[1]); switch (error) { case 0: @@ -6471,9 +6477,7 @@ static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) DBUG_RETURN(error); } } - while (restart_count < 2 && - record_compare(table, (const char*)table->record[0], - (const char*)record_buf) != 0); + while (restart_count < 2 && record_compare(table)); DBUG_ASSERT(error == HA_ERR_END_OF_FILE || error == 0); DBUG_RETURN(error); @@ -6493,7 +6497,7 @@ Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg, bool is_transactional) : Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional) #ifdef HAVE_REPLICATION - ,m_memory(NULL), m_key(NULL), m_search_record(NULL) + ,m_memory(NULL), m_key(NULL), m_after_image(NULL) #endif { } @@ -6510,7 +6514,7 @@ Delete_rows_log_event::Delete_rows_log_event(const char *buf, uint event_len, : Rows_log_event(buf, event_len, DELETE_ROWS_EVENT, description_event) #else : Rows_log_event(buf, event_len, DELETE_ROWS_EVENT, description_event), - m_memory(NULL), m_key(NULL), m_search_record(NULL) + m_memory(NULL), m_key(NULL), m_after_image(NULL) #endif { } @@ -6525,7 +6529,7 @@ int Delete_rows_log_event::do_before_row_operations(TABLE *table) table->s->primary_key < MAX_KEY) { /* - We don't need to allocate any memory for m_search_record and + We don't need to allocate any memory for m_after_image and m_key since they are not used. */ return 0; @@ -6537,14 +6541,14 @@ int Delete_rows_log_event::do_before_row_operations(TABLE *table) { m_memory= my_multi_malloc(MYF(MY_WME), - &m_search_record, table->s->reclength, + &m_after_image, table->s->reclength, &m_key, table->key_info->key_length, NULL); } else { - m_search_record= (byte*)my_malloc(table->s->reclength, MYF(MY_WME)); - m_memory= (gptr)m_search_record; + m_after_image= (byte*)my_malloc(table->s->reclength, MYF(MY_WME)); + m_memory= (gptr)m_after_image; m_key= NULL; } if (!m_memory) @@ -6571,7 +6575,7 @@ int Delete_rows_log_event::do_after_row_operations(TABLE *table, int error) table->file->ha_index_or_rnd_end(); my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc m_memory= NULL; - m_search_record= NULL; + m_after_image= NULL; m_key= NULL; return error; @@ -6609,7 +6613,7 @@ int Delete_rows_log_event::do_exec_row(TABLE *table) { DBUG_ASSERT(table != NULL); - int error= find_and_fetch_row(table, m_key, m_search_record); + int error= find_and_fetch_row(table, m_key); if (error) return error; @@ -6685,7 +6689,7 @@ int Update_rows_log_event::do_before_row_operations(TABLE *table) table->s->primary_key < MAX_KEY) { /* - We don't need to allocate any memory for m_search_record and + We don't need to allocate any memory for m_after_image and m_key since they are not used. */ return 0; @@ -6697,14 +6701,14 @@ int Update_rows_log_event::do_before_row_operations(TABLE *table) { m_memory= my_multi_malloc(MYF(MY_WME), - &m_search_record, table->s->reclength, + &m_after_image, table->s->reclength, &m_key, table->key_info->key_length, NULL); } else { - m_search_record= (byte*)my_malloc(table->s->reclength, MYF(MY_WME)); - m_memory= (gptr)m_search_record; + m_after_image= (byte*)my_malloc(table->s->reclength, MYF(MY_WME)); + m_memory= (gptr)m_after_image; m_key= NULL; } if (!m_memory) @@ -6732,7 +6736,7 @@ int Update_rows_log_event::do_after_row_operations(TABLE *table, int error) table->file->ha_index_or_rnd_end(); my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); m_memory= NULL; - m_search_record= NULL; + m_after_image= NULL; m_key= NULL; return error; @@ -6752,8 +6756,8 @@ char const *Update_rows_log_event::do_prepare_row(THD *thd, TABLE *table, /* record[0] is the before image for the update */ ptr= unpack_row(table, table->record[0], ptr, &m_cols); DBUG_ASSERT(ptr != NULL); - /* record[1] is the after image for the update */ - ptr= unpack_row(table, table->record[1], ptr, &m_cols); + /* m_after_image is the after image for the update */ + ptr= unpack_row(table, m_after_image, ptr, &m_cols); /* If we will access rows using the random access method, m_key will @@ -6773,10 +6777,19 @@ int Update_rows_log_event::do_exec_row(TABLE *table) { DBUG_ASSERT(table != NULL); - int error= find_and_fetch_row(table, m_key, m_search_record); + int error= find_and_fetch_row(table, m_key); if (error) return error; + /* + This is only a precaution to make sure that the call to + ha_update_row is using record[1]. + + If this is not needed/required, then we could use m_after_image in + that call instead. + */ + bmove_align(table->record[1], m_after_image,(size_t) table->s->reclength); + /* Now we should have the right row to update. The record that has been fetched is guaranteed to be in record[0], so we use that. diff --git a/sql/log_event.h b/sql/log_event.h index a7c532d4c24..0d55b08a382 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -2012,7 +2012,7 @@ private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) gptr m_memory; - byte *m_search_record; + byte *m_after_image; virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); @@ -2076,7 +2076,7 @@ private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) gptr m_memory; byte *m_key; - byte *m_search_record; + byte *m_after_image; virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); @@ -2146,7 +2146,7 @@ private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) gptr m_memory; byte *m_key; - byte *m_search_record; + byte *m_after_image; virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); From 3a78156ee6e859da0247af80824b2b6826f8471c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Feb 2006 17:10:40 +0100 Subject: [PATCH 05/12] Bug #17443 mysqldump test failure client/mysqlimport.c: Remove disabled --use-threads option mysql-test/r/mysqldump.result: Update result mysql-test/t/disabled.def: Remove disable of mysqldump mysql-test/t/mysqldump.test: Remove the disable_parsing on tests for --use-threads to mysqlimport --- client/mysqlimport.c | 2 -- mysql-test/r/mysqldump.result | 30 ++++++++++++++++++++++++++++++ mysql-test/t/disabled.def | 1 - mysql-test/t/mysqldump.test | 2 -- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/client/mysqlimport.c b/client/mysqlimport.c index edaaf20d98b..913f7fb2f15 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -145,13 +145,11 @@ static struct my_option my_long_options[] = (gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #include -#if 0 {"use-threads", OPT_USE_THREADS, "Load files in parallel. The argument is the number " "of threads to use for loading data.", (gptr*) &opt_use_threads, (gptr*) &opt_use_threads, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif #ifndef DONT_ALLOW_USER_CHANGE {"user", 'u', "User for login if not current user.", (gptr*) ¤t_user, (gptr*) ¤t_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 79b22964f8a..029f7c8d876 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -2650,3 +2650,33 @@ DELIMITER ; DROP TRIGGER tr1; DROP TABLE t1; +create table t1 (a text , b text); +create table t2 (a text , b text); +insert t1 values ("Duck, Duck", "goose"); +insert t1 values ("Duck, Duck", "pidgeon"); +insert t2 values ("We the people", "in order to perform"); +insert t2 values ("a more perfect", "union"); +select * from t1; +a b +Duck, Duck goose +Duck, Duck pidgeon +select * from t2; +a b +We the people in order to perform +a more perfect union +test.t1: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 +test.t2: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 +select * from t1; +a b +Duck, Duck goose +Duck, Duck pidgeon +Duck, Duck goose +Duck, Duck pidgeon +select * from t2; +a b +We the people in order to perform +a more perfect union +We the people in order to perform +a more perfect union +drop table t1; +drop table t2; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 1c0c92c86a3..94686cfe8e7 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -36,4 +36,3 @@ rpl_sp : Bug#16456 rpl_until : Unstable test case, bug#15886 sp-goto : GOTO is currently is disabled - will be fixed in the future rpl_ndb_log : results are not deterministic -mysqldump : Bug#17443 mysqlimport --use-threads=5 gives crashes diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 90a6782200d..3f2fa8e8bf2 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1049,7 +1049,6 @@ SET SQL_MODE = @old_sql_mode; DROP TRIGGER tr1; DROP TABLE t1; ---disable_parsing # # Added for use-thread option # @@ -1073,4 +1072,3 @@ select * from t2; drop table t1; drop table t2; ---enable_parsing From a9dab911a412f663a47530120046c4aca411445c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Feb 2006 10:10:41 -0600 Subject: [PATCH 06/12] BUG# 17430 Partitoins: crash on SELECT * FROM t1 WHERE f_int1 IS NULL BUG# 17432: Partitions: wrong result, SELECT ... WHERE is null mysql-test/r/partition.result: result block for tests mysql-test/t/partition.test: test cases for bug #17432 and 17430 sql/sql_partition.cc: improve null handling by returning LONGLONG_MIN for values that are NULL --- mysql-test/r/partition.result | 33 +++++++++++++++++++++++++++++ mysql-test/t/partition.test | 40 +++++++++++++++++++++++++++++++++++ sql/sql_partition.cc | 35 ++++++++++++++++++++++++------ 3 files changed, 102 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 6d28ecd8552..c6d341472b7 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -315,4 +315,37 @@ drop table t1; create table t1 (s1 int, unique (s1)) partition by list (s1) (partition x1 VALUES in (10), partition x2 values in (20)); alter table t1 add partition (partition x3 values in (30)); drop table t1; +CREATE TABLE t1 ( +f_int1 INTEGER, f_int2 INTEGER, +f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000) +) +PARTITION BY RANGE(f_int1 DIV 2) +SUBPARTITION BY HASH(f_int1) +SUBPARTITIONS 2 +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION parte VALUES LESS THAN (10), +PARTITION partf VALUES LESS THAN (2147483647)); +INSERT INTO t1 SET f_int1 = NULL , f_int2 = -20, f_char1 = CAST(-20 AS CHAR), +f_char2 = CAST(-20 AS CHAR), f_charbig = '#NULL#'; +SELECT * FROM t1 WHERE f_int1 IS NULL; +f_int1 f_int2 f_char1 f_char2 f_charbig +NULL -20 -20 -20 #NULL# +SELECT * FROM t1; +f_int1 f_int2 f_char1 f_char2 f_charbig +NULL -20 -20 -20 #NULL# +drop table t1; +CREATE TABLE t1 ( +f_int1 INTEGER, f_int2 INTEGER, +f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000) ) +PARTITION BY LIST(MOD(f_int1,2)) +SUBPARTITION BY KEY(f_int1) +(PARTITION part1 VALUES IN (-1) (SUBPARTITION sp1, SUBPARTITION sp2), +PARTITION part2 VALUES IN (0) (SUBPARTITION sp3, SUBPARTITION sp5), +PARTITION part3 VALUES IN (1) (SUBPARTITION sp4, SUBPARTITION sp6)); +INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2==='; +INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2==='; +SELECT * FROM t1 WHERE f_int1 IS NULL; +f_int1 f_int2 f_char1 f_char2 f_charbig +drop table t1; End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 4760219c911..92b0ec55953 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -408,4 +408,44 @@ create table t1 (s1 int, unique (s1)) partition by list (s1) (partition x1 VALUE alter table t1 add partition (partition x3 values in (30)); drop table t1; +# +# Bug #17432: Partition functions containing NULL values should return +# LONGLONG_MIN +# +CREATE TABLE t1 ( + f_int1 INTEGER, f_int2 INTEGER, + f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000) + ) + PARTITION BY RANGE(f_int1 DIV 2) + SUBPARTITION BY HASH(f_int1) + SUBPARTITIONS 2 + (PARTITION parta VALUES LESS THAN (0), + PARTITION partb VALUES LESS THAN (5), + PARTITION parte VALUES LESS THAN (10), + PARTITION partf VALUES LESS THAN (2147483647)); +INSERT INTO t1 SET f_int1 = NULL , f_int2 = -20, f_char1 = CAST(-20 AS CHAR), + f_char2 = CAST(-20 AS CHAR), f_charbig = '#NULL#'; +SELECT * FROM t1 WHERE f_int1 IS NULL; +SELECT * FROM t1; +drop table t1; + +# +# Bug 17430: Crash when SELECT * from t1 where field IS NULL +# + +CREATE TABLE t1 ( + f_int1 INTEGER, f_int2 INTEGER, + f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000) ) + PARTITION BY LIST(MOD(f_int1,2)) + SUBPARTITION BY KEY(f_int1) + (PARTITION part1 VALUES IN (-1) (SUBPARTITION sp1, SUBPARTITION sp2), + PARTITION part2 VALUES IN (0) (SUBPARTITION sp3, SUBPARTITION sp5), + PARTITION part3 VALUES IN (1) (SUBPARTITION sp4, SUBPARTITION sp6)); + +INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2==='; +INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2==='; + +SELECT * FROM t1 WHERE f_int1 IS NULL; +drop table t1; + --echo End of 5.1 tests diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 71fbbcd2426..c7f5cbb1907 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -2629,6 +2629,29 @@ bool partition_key_modified(TABLE *table, List &fields) } +/* + A function to handle correct handling of NULL values in partition + functions. + SYNOPSIS + part_val_int() + item_expr The item expression to evaluate + RETURN VALUES + The value of the partition function, LONGLONG_MIN if any null value + in function +*/ + +static +inline +longlong +part_val_int(Item *item_expr) +{ + longlong value= item_expr->val_int(); + if (item_expr->null_value) + value= LONGLONG_MIN; + return value; +} + + /* The next set of functions are used to calculate the partition identity. A handler sets up a variable that corresponds to one of these functions @@ -2725,7 +2748,7 @@ static uint32 get_part_id_hash(uint no_parts, longlong *func_value) { DBUG_ENTER("get_part_id_hash"); - *func_value= part_expr->val_int(); + *func_value= part_val_int(part_expr); longlong int_hash_id= *func_value % no_parts; DBUG_RETURN(int_hash_id < 0 ? -int_hash_id : int_hash_id); } @@ -2754,7 +2777,7 @@ static uint32 get_part_id_linear_hash(partition_info *part_info, { DBUG_ENTER("get_part_id_linear_hash"); - *func_value= part_expr->val_int(); + *func_value= part_val_int(part_expr); DBUG_RETURN(get_part_id_from_linear_hash(*func_value, part_info->linear_hash_mask, no_parts)); @@ -2892,7 +2915,7 @@ int get_partition_id_list(partition_info *part_info, longlong list_value; int min_list_index= 0; int max_list_index= part_info->no_list_values - 1; - longlong part_func_value= part_info->part_expr->val_int(); + longlong part_func_value= part_val_int(part_info->part_expr); DBUG_ENTER("get_partition_id_list"); *func_value= part_func_value; @@ -2968,7 +2991,7 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info, longlong list_value; uint min_list_index= 0, max_list_index= part_info->no_list_values - 1; /* Get the partitioning function value for the endpoint */ - longlong part_func_value= part_info->part_expr->val_int(); + longlong part_func_value= part_val_int(part_info->part_expr); while (max_list_index >= min_list_index) { list_index= (max_list_index + min_list_index) >> 1; @@ -3002,7 +3025,7 @@ int get_partition_id_range(partition_info *part_info, uint min_part_id= 0; uint max_part_id= max_partition; uint loc_part_id; - longlong part_func_value= part_info->part_expr->val_int(); + longlong part_func_value= part_val_int(part_info->part_expr); DBUG_ENTER("get_partition_id_int_range"); while (max_part_id > min_part_id) @@ -3077,7 +3100,7 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info, uint max_partition= part_info->no_parts - 1; uint min_part_id= 0, max_part_id= max_partition, loc_part_id; /* Get the partitioning function value for the endpoint */ - longlong part_func_value= part_info->part_expr->val_int(); + longlong part_func_value= part_val_int(part_info->part_expr); while (max_part_id > min_part_id) { loc_part_id= (max_part_id + min_part_id + 1) >> 1; From 6afe1bc76ee4dc34d98aa44fa22400c4be23f9f2 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Feb 2006 17:25:22 +0100 Subject: [PATCH 07/12] ndb - sockaddr alignment fix, found on sunfire100a, can affect any non-x86 storage/ndb/src/common/transporter/Transporter.cpp: use sockaddr_in in declarations to guarantee sin_addr alignment storage/ndb/src/mgmsrv/Services.cpp: use sockaddr_in in declarations to guarantee sin_addr alignment --- storage/ndb/src/common/transporter/Transporter.cpp | 12 ++++++------ storage/ndb/src/mgmsrv/Services.cpp | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/storage/ndb/src/common/transporter/Transporter.cpp b/storage/ndb/src/common/transporter/Transporter.cpp index 377fabe27ab..820aa4cfc18 100644 --- a/storage/ndb/src/common/transporter/Transporter.cpp +++ b/storage/ndb/src/common/transporter/Transporter.cpp @@ -105,10 +105,10 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) { } { - struct sockaddr addr; + struct sockaddr_in addr; SOCKET_SIZE_TYPE addrlen= sizeof(addr); - int r= getpeername(sockfd, &addr, &addrlen); - m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr; + int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen); + m_connect_address= (&addr)->sin_addr; } bool res = connect_server_impl(sockfd); @@ -198,10 +198,10 @@ Transporter::connect_client(NDB_SOCKET_TYPE sockfd) { } { - struct sockaddr addr; + struct sockaddr_in addr; SOCKET_SIZE_TYPE addrlen= sizeof(addr); - int r= getpeername(sockfd, &addr, &addrlen); - m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr; + int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen); + m_connect_address= (&addr)->sin_addr; } bool res = connect_client_impl(sockfd); diff --git a/storage/ndb/src/mgmsrv/Services.cpp b/storage/ndb/src/mgmsrv/Services.cpp index 3564c5c40ba..aebadec933c 100644 --- a/storage/ndb/src/mgmsrv/Services.cpp +++ b/storage/ndb/src/mgmsrv/Services.cpp @@ -451,9 +451,9 @@ MgmApiSession::get_nodeid(Parser_t::Context &, return; } - struct sockaddr addr; + struct sockaddr_in addr; SOCKET_SIZE_TYPE addrlen= sizeof(addr); - int r = getpeername(m_socket, &addr, &addrlen); + int r = getpeername(m_socket, (struct sockaddr*)&addr, &addrlen); if (r != 0 ) { m_output->println(cmd); m_output->println("result: getpeername(%d) failed, err= %d", m_socket, r); @@ -465,7 +465,7 @@ MgmApiSession::get_nodeid(Parser_t::Context &, if(tmp == 0 || !m_allocated_resources->is_reserved(tmp)){ BaseString error_string; if (!m_mgmsrv.alloc_node_id(&tmp, (enum ndb_mgm_node_type)nodetype, - &addr, &addrlen, error_string)){ + (struct sockaddr*)&addr, &addrlen, error_string)){ const char *alias; const char *str; alias= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type) From 0d97c20ec049e5a241ff88b0502a6c965e8c7e6b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Feb 2006 20:17:07 +0100 Subject: [PATCH 08/12] drop-on-restart.inc: Drop 'mysqlslap' Added database name 'ndbsynctest' sql_table.cc, create.test, create.result: Patch for bug#17530 done by evgen, extracted from 5.0 mysql-test/r/create.result: Patch for bug#17530 done by evgen, extracted from 5.0 mysql-test/t/create.test: Patch for bug#17530 done by evgen, extracted from 5.0 sql/sql_table.cc: Patch for bug#17530 done by evgen, extracted from 5.0 mysql-test/include/drop-on-restart.inc: Drop 'mysqlslap' --- mysql-test/include/drop-on-restart.inc | 2 ++ mysql-test/r/create.result | 6 ++++++ mysql-test/t/create.test | 8 ++++++++ sql/sql_table.cc | 4 +++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/mysql-test/include/drop-on-restart.inc b/mysql-test/include/drop-on-restart.inc index 841b636483a..ecdd24ebef1 100644 --- a/mysql-test/include/drop-on-restart.inc +++ b/mysql-test/include/drop-on-restart.inc @@ -23,6 +23,7 @@ drop database if exists db1_secret; drop database if exists db2; drop database if exists federated; drop database if exists mysqldump_test_db; +drop database if exists mysqlslap; drop database if exists mysqltest1; drop database if exists mysqltest2; drop database if exists mysqltest3; @@ -34,6 +35,7 @@ drop database if exists mysqltest_bob; drop database if exists mysqltest_db1; drop database if exists mysqltest_prometheus; drop database if exists mysqltest_sisyfos; +drop database if exists ndbsynctest; drop database if exists ndbtest1; drop database if exists rewrite; drop database if exists test2; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 25ceafd2c69..8228a7d904c 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -770,3 +770,9 @@ t1 CREATE TABLE `t1` ( `i` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295 drop table t1; +create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb +character set utf8 collate utf8_general_ci; +Warnings: +Warning 1071 Specified key was too long; max key length is 765 bytes +insert into t1 values('aaa'); +drop table t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index d8f23b1e875..c5d1b881896 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -661,4 +661,12 @@ alter table t1 max_rows=100000000000; show create table t1; drop table t1; +# +# Bug#17530: Incorrect key truncation on table creation caused server crash. +# +create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb + character set utf8 collate utf8_general_ci; +insert into t1 values('aaa'); +drop table t1; + # End of 5.0 tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2737e9448f9..5a4ac7db05e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1742,7 +1742,9 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, } if (length > file->max_key_part_length() && key->type != Key::FULLTEXT) { - length=file->max_key_part_length(); + length= file->max_key_part_length(); + /* Align key length to multibyte char boundary */ + length-= length % sql_field->charset->mbmaxlen; if (key->type == Key::MULTIPLE) { /* not a critical problem */ From 1c8bf361f50ea9482eb02a405e7b20c6ca51f0ae Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Feb 2006 21:27:49 +0100 Subject: [PATCH 09/12] config-win.h: Enable row based replication for Windows build replication.m4: Made help text more clear, default is with row based replication enabled config/ac-macros/replication.m4: Made help text more clear, default is with row based replication enabled include/config-win.h: Enable row based replication for Windows build --- config/ac-macros/replication.m4 | 4 ++-- include/config-win.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/ac-macros/replication.m4 b/config/ac-macros/replication.m4 index f73b9319b86..3a0c83d6498 100644 --- a/config/ac-macros/replication.m4 +++ b/config/ac-macros/replication.m4 @@ -7,8 +7,8 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_CHECK_REPLICATION], [ AC_ARG_WITH([row-based-replication], - AC_HELP_STRING([--with-row-based-replication], - [Include row-based replication]), + AC_HELP_STRING([--without-row-based-replication], + [Don't include row-based replication]), [row_based="$withval"], [row_based=yes]) AC_MSG_CHECKING([for row-based replication]) diff --git a/include/config-win.h b/include/config-win.h index 4e952f8248d..5131c2a67eb 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -427,6 +427,7 @@ inline double ulonglong2double(ulonglong value) #define HAVE_SPATIAL 1 #define HAVE_RTREE_KEYS 1 +#define HAVE_ROW_BASED_REPLICATION 1 /* #undef HAVE_OPENSSL */ /* #undef HAVE_YASSL */ From 1e3e30bdc26374d2f16cc67bdff87b172909148d Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 26 Feb 2006 01:16:11 +0100 Subject: [PATCH 10/12] log_event.cc: Visual C++ dont relate 'byte' and 'char*' that close, added casts mysql.sln: Only build mysqlserver.lib if embedded target VC++Files/mysql.sln: Only build mysqlserver.lib if embedded target sql/log_event.cc: Visual C++ dont relate 'byte' and 'char*' that close, added casts --- VC++Files/mysql.sln | 27 +++++---------------------- sql/log_event.cc | 6 +++--- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/VC++Files/mysql.sln b/VC++Files/mysql.sln index da6d1bbcc9f..f4204b00bc4 100644 --- a/VC++Files/mysql.sln +++ b/VC++Files/mysql.sln @@ -823,32 +823,21 @@ Global {62E85884-3ACF-4F4C-873B-60B878147890}.TLS_DEBUG.ActiveCfg = Debug|Win32 {62E85884-3ACF-4F4C-873B-60B878147890}.TLS_DEBUG.Build.0 = Debug|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic.ActiveCfg = classic|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic.Build.0 = classic|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic nt.ActiveCfg = classic|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic nt.Build.0 = classic|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Debug.ActiveCfg = Debug|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Debug.Build.0 = Debug|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Classic.ActiveCfg = classic|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Debug.ActiveCfg = Debug|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Pro.ActiveCfg = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_ProGPL.ActiveCfg = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Release.ActiveCfg = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max nt.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max nt.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.nt.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.nt.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro.ActiveCfg = pro|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro.Build.0 = pro|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl nt.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl nt.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro nt.ActiveCfg = pro|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro nt.Build.0 = pro|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Release.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Release.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.TLS.ActiveCfg = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.TLS.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.TLS_DEBUG.ActiveCfg = Debug|Win32 @@ -916,32 +905,26 @@ Global {AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3D}.TLS_DEBUG.ActiveCfg = Debug|Win32 {AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3D}.TLS_DEBUG.Build.0 = Debug|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.classic.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.classic.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.classic nt.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.classic nt.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Debug.ActiveCfg = Debug|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.Debug.Build.0 = Debug|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Classic.ActiveCfg = Release|Win32 + {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Classic.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Debug.ActiveCfg = Debug|Win32 + {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Debug.Build.0 = Debug|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Pro.ActiveCfg = Release|Win32 + {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Pro.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_ProGPL.ActiveCfg = Release|Win32 + {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_ProGPL.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Release.ActiveCfg = Release|Win32 + {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Release.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Max.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.Max.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Max nt.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.Max nt.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.nt.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.nt.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.pro.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.pro.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl nt.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl nt.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.pro nt.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.pro nt.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Release.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.Release.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.TLS.ActiveCfg = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.TLS.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.TLS_DEBUG.ActiveCfg = Debug|Win32 diff --git a/sql/log_event.cc b/sql/log_event.cc index 2b335e7b67d..207888ed0a7 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5601,7 +5601,7 @@ bool Rows_log_event::write_data_body(IO_CACHE*file) byte sbuf[sizeof(m_width)]; my_ptrdiff_t const data_size= m_rows_cur - m_rows_buf; - char *const sbuf_end= net_store_length(sbuf, (uint) m_width); + char *const sbuf_end= net_store_length((char*) sbuf, (uint) m_width); DBUG_ASSERT(static_cast(sbuf_end - (char*) sbuf) <= sizeof(sbuf)); return (my_b_safe_write(file, sbuf, sbuf_end - (char*) sbuf) || @@ -6045,14 +6045,14 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file) byte const tbuf[]= { m_tbllen }; byte cbuf[sizeof(m_colcnt)]; - char *const cbuf_end= net_store_length(cbuf, (uint) m_colcnt); + char *const cbuf_end= net_store_length((char*) cbuf, (uint) m_colcnt); DBUG_ASSERT(static_cast(cbuf_end - (char*) cbuf) <= sizeof(cbuf)); return (my_b_safe_write(file, dbuf, sizeof(dbuf)) || my_b_safe_write(file, (const byte*)m_dbnam, m_dblen+1) || my_b_safe_write(file, tbuf, sizeof(tbuf)) || my_b_safe_write(file, (const byte*)m_tblnam, m_tbllen+1) || - my_b_safe_write(file, cbuf, cbuf_end - cbuf) || + my_b_safe_write(file, cbuf, cbuf_end - (char*) cbuf) || my_b_safe_write(file, reinterpret_cast(m_coltype), m_colcnt)); } #endif From 8ead0fe65516c282bd196be79a2ec37a94cbb692 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 27 Feb 2006 02:56:34 +0100 Subject: [PATCH 11/12] example.vcproj: Bug#17721, hang in exampledb, solved by msvensson drop-on-restart.inc: Added drop of tables t00,t03,t04 mysql-test/include/drop-on-restart.inc: Added drop of tables t00,t03,t04 VC++Files/storage/example/example.vcproj: Bug#17721, hang in exampledb, solved by msvensson --- VC++Files/storage/example/example.vcproj | 8 ++++---- mysql-test/include/drop-on-restart.inc | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/VC++Files/storage/example/example.vcproj b/VC++Files/storage/example/example.vcproj index 3a2daa55676..257a1e77b71 100644 --- a/VC++Files/storage/example/example.vcproj +++ b/VC++Files/storage/example/example.vcproj @@ -24,7 +24,7 @@ InlineFunctionExpansion="1" OptimizeForProcessor="2" AdditionalIncludeDirectories="../../include,../../regex,../../sql" - PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG" + PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -73,7 +73,7 @@ Optimization="0" OptimizeForProcessor="2" AdditionalIncludeDirectories="../../include,../../regex,../../sql" - PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;USE_TLS" + PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;USE_TLS;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="1" PrecompiledHeaderFile=".\example___Win32_TLS_DEBUG/example.pch" @@ -123,7 +123,7 @@ InlineFunctionExpansion="1" OptimizeForProcessor="2" AdditionalIncludeDirectories="../../include,../../regex,../../sql" - PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;USE_TLS" + PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;USE_TLS;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -172,7 +172,7 @@ Optimization="0" OptimizeForProcessor="2" AdditionalIncludeDirectories="../../include,../../regex,../../sql" - PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS" + PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="1" PrecompiledHeaderFile=".\debug/example.pch" diff --git a/mysql-test/include/drop-on-restart.inc b/mysql-test/include/drop-on-restart.inc index ecdd24ebef1..af1d0d893e0 100644 --- a/mysql-test/include/drop-on-restart.inc +++ b/mysql-test/include/drop-on-restart.inc @@ -431,6 +431,7 @@ drop table if exists new_t2; drop table if exists not_exist; drop table if exists r1; drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t21,t70; +drop table if exists t00,t03,t04; drop table if exists t0_template; drop table if exists t1Aa,t2Aa,v1Aa,v2Aa; drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa; From 558c41abfb5d815f0e093795ad3704f2ec6464b2 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 27 Feb 2006 22:14:46 +0100 Subject: [PATCH 12/12] BUG#17752: Non-allocated memory caused core in rpl_multi_engine test sql/log_event.cc: Removed optimization that is no longer valid --- sql/log_event.cc | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 207888ed0a7..6c77f609abc 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -6685,16 +6685,6 @@ int Update_rows_log_event::do_before_row_operations(TABLE *table) { DBUG_ASSERT(m_memory == NULL); - if ((table->file->table_flags() & HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS) && - table->s->primary_key < MAX_KEY) - { - /* - We don't need to allocate any memory for m_after_image and - m_key since they are not used. - */ - return 0; - } - int error= 0; if (table->s->keys > 0)