From 05f4e9ea05a66d6e835adb28126293ef6965f91f Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Tue, 10 Apr 2007 17:50:43 +0200 Subject: [PATCH 01/22] BUG#27701 Arguments to some compile-pentium* scripts were not properly passed to SETUP.sh. Besides the old way not working with some shells, single arguments that contained whitespace were also broken up. This patch tries to fix both errors. --- BUILD/compile-pentium-debug | 3 +- BUILD/compile-pentium-debug-max | 3 +- BUILD/compile-pentium-debug-max-no-ndb | 3 +- BUILD/compile-pentium64-debug | 3 +- BUILD/compile-pentium64-debug-max | 3 +- mysql-test/r/bdb_notembedded.result | 35 ++++++++++++++++++++++++ mysql-test/t/bdb_notembedded.test | 38 ++++++++++++++++++++++++++ 7 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 mysql-test/r/bdb_notembedded.result create mode 100644 mysql-test/t/bdb_notembedded.test diff --git a/BUILD/compile-pentium-debug b/BUILD/compile-pentium-debug index 7957caead29..e31cb59a8a4 100755 --- a/BUILD/compile-pentium-debug +++ b/BUILD/compile-pentium-debug @@ -1,7 +1,8 @@ #! /bin/sh path=`dirname $0` -. "$path/SETUP.sh" $@ --with-debug=full +set -- "$@" --with-debug=full +. "$path/SETUP.sh" extra_flags="$pentium_cflags $debug_cflags" c_warnings="$c_warnings $debug_extra_warnings" diff --git a/BUILD/compile-pentium-debug-max b/BUILD/compile-pentium-debug-max index a69513ac6bb..56e24617abb 100755 --- a/BUILD/compile-pentium-debug-max +++ b/BUILD/compile-pentium-debug-max @@ -1,7 +1,8 @@ #! /bin/sh path=`dirname $0` -. "$path/SETUP.sh" $@ --with-debug=full +set -- "$@" --with-debug=full +. "$path/SETUP.sh" extra_flags="$pentium_cflags $debug_cflags $max_cflags" c_warnings="$c_warnings $debug_extra_warnings" diff --git a/BUILD/compile-pentium-debug-max-no-ndb b/BUILD/compile-pentium-debug-max-no-ndb index 26ec7eacc9d..92a388f9cb9 100755 --- a/BUILD/compile-pentium-debug-max-no-ndb +++ b/BUILD/compile-pentium-debug-max-no-ndb @@ -1,7 +1,8 @@ #! /bin/sh path=`dirname $0` -. "$path/SETUP.sh" $@ --with-debug=full +set -- "$@" --with-debug=full +. "$path/SETUP.sh" extra_flags="$pentium_cflags $debug_cflags $max_cflags" c_warnings="$c_warnings $debug_extra_warnings" diff --git a/BUILD/compile-pentium64-debug b/BUILD/compile-pentium64-debug index 0299669f79a..1edc9827366 100755 --- a/BUILD/compile-pentium64-debug +++ b/BUILD/compile-pentium64-debug @@ -1,7 +1,8 @@ #! /bin/sh path=`dirname $0` -. "$path/SETUP.sh" $@ --with-debug=full +set -- "$@" --with-debug=full +. "$path/SETUP.sh" extra_flags="$pentium64_cflags $debug_cflags" c_warnings="$c_warnings $debug_extra_warnings" diff --git a/BUILD/compile-pentium64-debug-max b/BUILD/compile-pentium64-debug-max index f0745c88c90..656825d8494 100755 --- a/BUILD/compile-pentium64-debug-max +++ b/BUILD/compile-pentium64-debug-max @@ -1,7 +1,8 @@ #! /bin/sh path=`dirname $0` -. "$path/SETUP.sh" $@ --with-debug=full +set -- "$@" --with-debug=full +. "$path/SETUP.sh" extra_flags="$pentium64_cflags $debug_cflags $max_cflags" c_warnings="$c_warnings $debug_extra_warnings" diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result new file mode 100644 index 00000000000..14cb5fad915 --- /dev/null +++ b/mysql-test/r/bdb_notembedded.result @@ -0,0 +1,35 @@ +set autocommit=1; +reset master; +create table bug16206 (a int); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 +f n Query 1 n use `test`; create table bug16206 (a int) +f n Query 1 n use `test`; insert into bug16206 values(1) +f n Query 1 n use `test`; insert into bug16206 values(2) +drop table bug16206; +reset master; +create table bug16206 (a int) engine= bdb; +insert into bug16206 values(0); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +insert into bug16206 values(3); +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 +f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb +f n Query 1 n use `test`; insert into bug16206 values(0) +f n Query 1 n use `test`; insert into bug16206 values(1) +f n Query 1 n use `test`; BEGIN +f n Query 1 n use `test`; insert into bug16206 values(2) +f n Query 1 n use `test`; COMMIT +f n Query 1 n use `test`; insert into bug16206 values(3) +drop table bug16206; +set autocommit=0; +End of 5.0 tests diff --git a/mysql-test/t/bdb_notembedded.test b/mysql-test/t/bdb_notembedded.test new file mode 100644 index 00000000000..24e64ebbfb2 --- /dev/null +++ b/mysql-test/t/bdb_notembedded.test @@ -0,0 +1,38 @@ +-- source include/not_embedded.inc +-- source include/have_bdb.inc + +# +# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode +# +set autocommit=1; + +let $VERSION=`select version()`; + +reset master; +create table bug16206 (a int); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +--replace_result $VERSION VERSION +--replace_column 1 f 2 n 5 n +show binlog events; +drop table bug16206; + +reset master; +create table bug16206 (a int) engine= bdb; +insert into bug16206 values(0); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +insert into bug16206 values(3); +--replace_result $VERSION VERSION +--replace_column 1 f 2 n 5 n +show binlog events; +drop table bug16206; + +set autocommit=0; + + +--echo End of 5.0 tests From bcbcacb8da52de9ed8db623ba790188b39930b8c Mon Sep 17 00:00:00 2001 From: "svoj@mysql.com/april.(none)" <> Date: Wed, 11 Apr 2007 01:40:35 +0500 Subject: [PATCH 02/22] =?UTF-8?q?BUG#24342=20-=20Incorrect=20results=20wit?= =?UTF-8?q?h=20query=20over=20MERGE=20table=20MERGE=20engine=20may=20retur?= =?UTF-8?q?n=20incorrect=20values=20when=20several=20representations=20of?= =?UTF-8?q?=20equal=20keys=20are=20present=20in=20the=20index.=20For=20exa?= =?UTF-8?q?mple=20"gro=C3=9F"=20and=20"gross"=20or=20"gross"=20and=20"gros?= =?UTF-8?q?s=20"=20(trailing=20space),=20which=20are=20considered=20equal,?= =?UTF-8?q?=20but=20have=20different=20lengths.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The problem was that key length was not recalculated after key lookup. Only MERGE engine is affected. --- myisam/mi_rkey.c | 3 ++- myisam/myisamdef.h | 1 + myisammrg/myrg_rkey.c | 4 ++++ mysql-test/r/merge.result | 11 +++++++++++ mysql-test/t/merge.test | 13 +++++++++++++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/myisam/mi_rkey.c b/myisam/mi_rkey.c index b2d40288645..2933d694318 100644 --- a/myisam/mi_rkey.c +++ b/myisam/mi_rkey.c @@ -50,7 +50,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len, key_buff=info->lastkey+info->s->base.max_key_length; pack_key_length= key_len; bmove(key_buff,key,key_len); - last_used_keyseg= 0; + last_used_keyseg= info->s->keyinfo[inx].seg + info->last_used_keyseg; } else { @@ -62,6 +62,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len, key_len, &last_used_keyseg); /* Save packed_key_length for use by the MERGE engine. */ info->pack_key_length= pack_key_length; + info->last_used_keyseg= last_used_keyseg - info->s->keyinfo[inx].seg; DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE, keyinfo->seg, key_buff, pack_key_length);); } diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h index 6365f0e1b0c..6ed041e8b9d 100644 --- a/myisam/myisamdef.h +++ b/myisam/myisamdef.h @@ -263,6 +263,7 @@ struct st_myisam_info { enum ha_rkey_function last_key_func; /* CONTAIN, OVERLAP, etc */ uint save_lastkey_length; uint pack_key_length; /* For MYISAMMRG */ + uint16 last_used_keyseg; /* For MyISAMMRG */ int errkey; /* Got last error on this key */ int lock_type; /* How database was locked */ int tmp_lock_type; /* When locked by readinfo */ diff --git a/myisammrg/myrg_rkey.c b/myisammrg/myrg_rkey.c index f87b264081e..b72334ea7dd 100644 --- a/myisammrg/myrg_rkey.c +++ b/myisammrg/myrg_rkey.c @@ -41,12 +41,14 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key, { byte *key_buff; uint pack_key_length; + uint16 last_used_keyseg; MYRG_TABLE *table; MI_INFO *mi; int err; DBUG_ENTER("myrg_rkey"); LINT_INIT(key_buff); LINT_INIT(pack_key_length); + LINT_INIT(last_used_keyseg); if (_myrg_init_queue(info,inx,search_flag)) DBUG_RETURN(my_errno); @@ -61,10 +63,12 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key, /* Get the saved packed key and packed key length. */ key_buff=(byte*) mi->lastkey+mi->s->base.max_key_length; pack_key_length=mi->pack_key_length; + last_used_keyseg= mi->last_used_keyseg; } else { mi->once_flags|= USE_PACKED_KEYS; + mi->last_used_keyseg= last_used_keyseg; err=mi_rkey(mi,0,inx,key_buff,pack_key_length,search_flag); } info->last_used_table=table+1; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 00d8aa3d586..b12e4eb2d3a 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -819,3 +819,14 @@ ALTER TABLE m1 ENGINE=MERGE UNION=(t1); SELECT * FROM m1; c1 c2 c3 c4 c5 c6 c7 c8 c9 DROP TABLE t1, m1; +CREATE TABLE t1 (a VARCHAR(255) CHARACTER SET latin1 COLLATE latin1_german2_ci, +b INT, INDEX(a,b)); +CREATE TABLE t2 LIKE t1; +CREATE TABLE t3 LIKE t1; +ALTER TABLE t3 ENGINE=MERGE UNION=(t1,t2); +INSERT INTO t1 VALUES ('ss',1); +INSERT INTO t2 VALUES ('ss',2),(0xDF,2); +SELECT COUNT(*) FROM t3 WHERE a=0xDF AND b=2; +COUNT(*) +2 +DROP TABLE t1,t2,t3; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 032e80ecc93..377160d0312 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -454,4 +454,17 @@ ALTER TABLE m1 ENGINE=MERGE UNION=(t1); SELECT * FROM m1; DROP TABLE t1, m1; +# +# BUG#24342 - Incorrect results with query over MERGE table +# +CREATE TABLE t1 (a VARCHAR(255) CHARACTER SET latin1 COLLATE latin1_german2_ci, + b INT, INDEX(a,b)); +CREATE TABLE t2 LIKE t1; +CREATE TABLE t3 LIKE t1; +ALTER TABLE t3 ENGINE=MERGE UNION=(t1,t2); +INSERT INTO t1 VALUES ('ss',1); +INSERT INTO t2 VALUES ('ss',2),(0xDF,2); +SELECT COUNT(*) FROM t3 WHERE a=0xDF AND b=2; +DROP TABLE t1,t2,t3; + # End of 4.1 tests From a3c70abb4e29c22423163091a779add4d1595edd Mon Sep 17 00:00:00 2001 From: "joerg@trift2." <> Date: Thu, 12 Apr 2007 21:50:56 +0200 Subject: [PATCH 03/22] Header file "decimal.h" needs to be delivered with binary packages: Bug#27456 decimal.h is not installed with public include files --- include/Makefile.am | 4 +-- mysql-test/r/bdb_notembedded.result | 35 ++++++++++++++++++++++++++ mysql-test/t/bdb_notembedded.test | 38 +++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 mysql-test/r/bdb_notembedded.result create mode 100644 mysql-test/t/bdb_notembedded.test diff --git a/include/Makefile.am b/include/Makefile.am index 9cd2f6215f1..95a7a4803e0 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -22,7 +22,7 @@ HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \ my_xml.h mysql_embed.h \ my_pthread.h my_no_pthread.h raid.h \ - errmsg.h my_global.h my_net.h \ + decimal.h errmsg.h my_global.h my_net.h \ my_getopt.h sslopt-longopts.h my_dir.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ m_ctype.h $(HEADERS_GEN) @@ -33,7 +33,7 @@ noinst_HEADERS = config-win.h config-os2.h config-netware.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \ my_aes.h my_tree.h hash.h thr_alarm.h \ thr_lock.h t_ctype.h violite.h md5.h base64.h \ - mysql_version.h.in my_handler.h my_time.h decimal.h \ + mysql_version.h.in my_handler.h my_time.h \ my_user.h my_libwrap.h # Remove built files and the symlinked directories diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result new file mode 100644 index 00000000000..14cb5fad915 --- /dev/null +++ b/mysql-test/r/bdb_notembedded.result @@ -0,0 +1,35 @@ +set autocommit=1; +reset master; +create table bug16206 (a int); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 +f n Query 1 n use `test`; create table bug16206 (a int) +f n Query 1 n use `test`; insert into bug16206 values(1) +f n Query 1 n use `test`; insert into bug16206 values(2) +drop table bug16206; +reset master; +create table bug16206 (a int) engine= bdb; +insert into bug16206 values(0); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +insert into bug16206 values(3); +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 +f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb +f n Query 1 n use `test`; insert into bug16206 values(0) +f n Query 1 n use `test`; insert into bug16206 values(1) +f n Query 1 n use `test`; BEGIN +f n Query 1 n use `test`; insert into bug16206 values(2) +f n Query 1 n use `test`; COMMIT +f n Query 1 n use `test`; insert into bug16206 values(3) +drop table bug16206; +set autocommit=0; +End of 5.0 tests diff --git a/mysql-test/t/bdb_notembedded.test b/mysql-test/t/bdb_notembedded.test new file mode 100644 index 00000000000..24e64ebbfb2 --- /dev/null +++ b/mysql-test/t/bdb_notembedded.test @@ -0,0 +1,38 @@ +-- source include/not_embedded.inc +-- source include/have_bdb.inc + +# +# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode +# +set autocommit=1; + +let $VERSION=`select version()`; + +reset master; +create table bug16206 (a int); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +--replace_result $VERSION VERSION +--replace_column 1 f 2 n 5 n +show binlog events; +drop table bug16206; + +reset master; +create table bug16206 (a int) engine= bdb; +insert into bug16206 values(0); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +insert into bug16206 values(3); +--replace_result $VERSION VERSION +--replace_column 1 f 2 n 5 n +show binlog events; +drop table bug16206; + +set autocommit=0; + + +--echo End of 5.0 tests From 005d8c5284a84752b9abc7b99d153e6aee8f1977 Mon Sep 17 00:00:00 2001 From: "svoj@mysql.com/april.(none)" <> Date: Fri, 13 Apr 2007 02:31:34 +0500 Subject: [PATCH 04/22] BUG#25951 - ignore/use index does not work with fulltext IGNORE/USE/FORCE INDEX hints were honored when choosing FULLTEXT index. With this fix these hints are ignored. For regular indexes we may perform table scan instead of index lookup when IGNORE INDEX was specified. We cannot do this for FULLTEXT in NLQ mode. --- mysql-test/r/fulltext.result | 7 +++++++ mysql-test/t/fulltext.test | 10 ++++++++++ sql/item_func.cc | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index c1dd5f80d5c..3700ace4b19 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -447,3 +447,10 @@ a MATCH(a) AGAINST('test1 test') test1 0.68526661396027 DEALLOCATE PREPARE stmt; DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(255), FULLTEXT(a)); +SELECT * FROM t1 IGNORE INDEX(a) WHERE MATCH(a) AGAINST('test'); +a +ALTER TABLE t1 DISABLE KEYS; +SELECT * FROM t1 WHERE MATCH(a) AGAINST('test'); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE t1; diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index d5ce6241490..1a9a6b578dc 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -369,4 +369,14 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t1; +# +# BUG#25951 - ignore/use index does not work with fulltext +# +CREATE TABLE t1 (a VARCHAR(255), FULLTEXT(a)); +SELECT * FROM t1 IGNORE INDEX(a) WHERE MATCH(a) AGAINST('test'); +ALTER TABLE t1 DISABLE KEYS; +--error 1191 +SELECT * FROM t1 WHERE MATCH(a) AGAINST('test'); +DROP TABLE t1; + # End of 4.1 tests diff --git a/sql/item_func.cc b/sql/item_func.cc index 88c3dfcdfc0..c6b2fa5cc3e 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3158,7 +3158,7 @@ bool Item_func_match::fix_index() for (keynr=0 ; keynr < table->keys ; keynr++) { if ((table->key_info[keynr].flags & HA_FULLTEXT) && - (table->keys_in_use_for_query.is_set(keynr))) + (table->keys_in_use.is_set(keynr))) { ft_to_key[fts]=keynr; ft_cnt[fts]=0; From ed81a81a9ef3370d3260c9aebb79036831b866ef Mon Sep 17 00:00:00 2001 From: "svoj@mysql.com/june.mysql.com" <> Date: Fri, 13 Apr 2007 12:38:27 +0500 Subject: [PATCH 05/22] BUG#27516 - divide by zero crash during optimize table When a table status is requested by statement like SHOW TABLE STATUS and there is another statement (e.g. DELETE) sets number of records to 0 concurrently, we may get division by zero error, which crashes a server. This is fixed by using thread local variable x->records instead of shared info->state->records when we check if it is zero and divide by it. --- myisam/mi_info.c | 6 ++--- mysql-test/r/bdb_notembedded.result | 35 ++++++++++++++++++++++++++ mysql-test/t/bdb_notembedded.test | 38 +++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 mysql-test/r/bdb_notembedded.result create mode 100644 mysql-test/t/bdb_notembedded.test diff --git a/myisam/mi_info.c b/myisam/mi_info.c index 0435269ed6d..b7de8e7b37d 100644 --- a/myisam/mi_info.c +++ b/myisam/mi_info.c @@ -57,9 +57,9 @@ int mi_status(MI_INFO *info, register MI_ISAMINFO *x, uint flag) x->keys = share->state.header.keys; x->check_time = share->state.check_time; - x->mean_reclength = info->state->records ? - (ulong) ((info->state->data_file_length-info->state->empty)/ - info->state->records) : (ulong) share->min_pack_length; + x->mean_reclength= x->records ? + (ulong) ((x->data_file_length - x->delete_length) / x->records) : + (ulong) share->min_pack_length; } if (flag & HA_STATUS_ERRKEY) { diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result new file mode 100644 index 00000000000..14cb5fad915 --- /dev/null +++ b/mysql-test/r/bdb_notembedded.result @@ -0,0 +1,35 @@ +set autocommit=1; +reset master; +create table bug16206 (a int); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 +f n Query 1 n use `test`; create table bug16206 (a int) +f n Query 1 n use `test`; insert into bug16206 values(1) +f n Query 1 n use `test`; insert into bug16206 values(2) +drop table bug16206; +reset master; +create table bug16206 (a int) engine= bdb; +insert into bug16206 values(0); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +insert into bug16206 values(3); +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 +f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb +f n Query 1 n use `test`; insert into bug16206 values(0) +f n Query 1 n use `test`; insert into bug16206 values(1) +f n Query 1 n use `test`; BEGIN +f n Query 1 n use `test`; insert into bug16206 values(2) +f n Query 1 n use `test`; COMMIT +f n Query 1 n use `test`; insert into bug16206 values(3) +drop table bug16206; +set autocommit=0; +End of 5.0 tests diff --git a/mysql-test/t/bdb_notembedded.test b/mysql-test/t/bdb_notembedded.test new file mode 100644 index 00000000000..24e64ebbfb2 --- /dev/null +++ b/mysql-test/t/bdb_notembedded.test @@ -0,0 +1,38 @@ +-- source include/not_embedded.inc +-- source include/have_bdb.inc + +# +# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode +# +set autocommit=1; + +let $VERSION=`select version()`; + +reset master; +create table bug16206 (a int); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +--replace_result $VERSION VERSION +--replace_column 1 f 2 n 5 n +show binlog events; +drop table bug16206; + +reset master; +create table bug16206 (a int) engine= bdb; +insert into bug16206 values(0); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +insert into bug16206 values(3); +--replace_result $VERSION VERSION +--replace_column 1 f 2 n 5 n +show binlog events; +drop table bug16206; + +set autocommit=0; + + +--echo End of 5.0 tests From 8437fd62b2da4a7aff965a65481e1ef59c70ad36 Mon Sep 17 00:00:00 2001 From: "joerg@trift2." <> Date: Tue, 17 Apr 2007 12:18:17 +0200 Subject: [PATCH 06/22] Let the "configure" options that control table handlers (NDB, InnoDB) or features ("embedded") also control the list of man pages installed, so that they correspond better to the binaries. This is the second version of this fix, including review comments. --- configure.in | 76 ++++++++++++++++++++--------- mysql-test/r/bdb_notembedded.result | 35 +++++++++++++ mysql-test/t/bdb_notembedded.test | 38 +++++++++++++++ 3 files changed, 127 insertions(+), 22 deletions(-) create mode 100644 mysql-test/r/bdb_notembedded.result create mode 100644 mysql-test/t/bdb_notembedded.test diff --git a/configure.in b/configure.in index 9b5abe39a6f..76352b06d62 100644 --- a/configure.in +++ b/configure.in @@ -2376,28 +2376,6 @@ AC_ARG_WITH(man, [with_man=yes] ) -if test X"$with_man" = Xyes -then - man_dirs="man" - if test X"$have_ndbcluster" = Xyes - then - man1_files=`ls $srcdir/man/*.1 | sed -e 's;^.*man/;;'` - man8_files=`ls $srcdir/man/*.8 | sed -e 's;^.*man/;;'` - else - man1_files=`ls $srcdir/man/*.1 | grep -v '/ndb' | sed -e 's;^.*man/;;'` - man8_files=`ls $srcdir/man/*.8 | grep -v '/ndb' | sed -e 's;^.*man/;;'` - fi - man1_files=`echo $man1_files` - man8_files=`echo $man8_files` -else - man_dirs="" - man1_files="" - man8_files="" -fi -AC_SUBST(man_dirs) -AC_SUBST(man1_files) -AC_SUBST(man8_files) - # Shall we build the bench code? AC_ARG_WITH(bench, [ --without-bench Skip building of the benchmark suite.], @@ -2532,6 +2510,60 @@ MYSQL_CHECK_BLACKHOLEDB MYSQL_CHECK_NDBCLUSTER MYSQL_CHECK_FEDERATED +# Include man pages, if desired, adapted to the configured parts. +if test X"$with_man" = Xyes +then + # First, create the list of all man pages present. + MANLISTFIL=manlist.$$ + TMPLISTFIL=`echo $MANLISTFIL | sed -e 's/manlist/tmplist/'` + if test -f $MANLISTFIL -o -f $TMPLISTFIL + then + echo "Temp file '$MANLISTFIL' or '$TMPLISTFIL' already exists in '`pwd`' - aborting" + exit 1 + fi + touch $MANLISTFIL $TMPLISTFIL + + ls $srcdir/man/*.[[18]] > $MANLISTFIL + + # Then, remove all those pages from the list which are specific to parts + # (table handlers, features, ...) which are not configured in this run. + AC_MSG_CHECKING("for man pages to remove") + MAN_DROP="dropping" + if test X"$have_ndbcluster" != Xyes + then + MAN_DROP="$MAN_DROP ndbcluster" + grep -v '/ndb' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL + fi + if test X"$with_embedded_server" != Xyes + then + MAN_DROP="$MAN_DROP embedded" + grep -v 'embedded' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL + fi + if test X"$have_innodb" != Xyes + then + MAN_DROP="$MAN_DROP innodb" + grep -v 'inno' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL + fi + AC_MSG_RESULT([$MAN_DROP]) + + # Finally, split the man pages into sections 1 and 8. + # Get rid of line breaks. + man1_files=`sed -n -e '/\.1$/s/^.*man\///p' <$MANLISTFIL` + man8_files=`sed -n -e '/\.8$/s/^.*man\///p' <$MANLISTFIL` + + man_dirs="man" + man1_files=`echo $man1_files` + man8_files=`echo $man8_files` + rm -f $MANLISTFIL +else + man_dirs="" + man1_files="" + man8_files="" +fi +AC_SUBST(man_dirs) +AC_SUBST(man1_files) +AC_SUBST(man8_files) + # If we have threads generate some library functions and test programs sql_server_dirs= server_scripts= diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result new file mode 100644 index 00000000000..14cb5fad915 --- /dev/null +++ b/mysql-test/r/bdb_notembedded.result @@ -0,0 +1,35 @@ +set autocommit=1; +reset master; +create table bug16206 (a int); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 +f n Query 1 n use `test`; create table bug16206 (a int) +f n Query 1 n use `test`; insert into bug16206 values(1) +f n Query 1 n use `test`; insert into bug16206 values(2) +drop table bug16206; +reset master; +create table bug16206 (a int) engine= bdb; +insert into bug16206 values(0); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +insert into bug16206 values(3); +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 +f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb +f n Query 1 n use `test`; insert into bug16206 values(0) +f n Query 1 n use `test`; insert into bug16206 values(1) +f n Query 1 n use `test`; BEGIN +f n Query 1 n use `test`; insert into bug16206 values(2) +f n Query 1 n use `test`; COMMIT +f n Query 1 n use `test`; insert into bug16206 values(3) +drop table bug16206; +set autocommit=0; +End of 5.0 tests diff --git a/mysql-test/t/bdb_notembedded.test b/mysql-test/t/bdb_notembedded.test new file mode 100644 index 00000000000..24e64ebbfb2 --- /dev/null +++ b/mysql-test/t/bdb_notembedded.test @@ -0,0 +1,38 @@ +-- source include/not_embedded.inc +-- source include/have_bdb.inc + +# +# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode +# +set autocommit=1; + +let $VERSION=`select version()`; + +reset master; +create table bug16206 (a int); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +--replace_result $VERSION VERSION +--replace_column 1 f 2 n 5 n +show binlog events; +drop table bug16206; + +reset master; +create table bug16206 (a int) engine= bdb; +insert into bug16206 values(0); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +insert into bug16206 values(3); +--replace_result $VERSION VERSION +--replace_column 1 f 2 n 5 n +show binlog events; +drop table bug16206; + +set autocommit=0; + + +--echo End of 5.0 tests From d5b1c3aea2398f4b8a193e479571e9aaeba06505 Mon Sep 17 00:00:00 2001 From: "serg@janus.mylan" <> Date: Tue, 17 Apr 2007 12:32:01 +0200 Subject: [PATCH 07/22] reverted the fix for Bug#5507 --- mysql-test/r/truncate.result | 26 +++----------------------- mysql-test/t/truncate.test | 31 ++++++++----------------------- sql/sql_delete.cc | 9 +++------ sql/sql_lex.cc | 1 - 4 files changed, 14 insertions(+), 53 deletions(-) diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result index 6c21db0e2b8..b194f9b7dc6 100644 --- a/mysql-test/r/truncate.result +++ b/mysql-test/r/truncate.result @@ -57,26 +57,6 @@ create table t1 (s1 int); insert into t1 (s1) values (1), (2), (3), (4), (5); create view v1 as select * from t1; truncate table v1; -select count(*) from t1; -count(*) -0 -insert into t1 (s1) values (1), (2), (3), (4), (5); -create view v2 as select * from t1 where s1 > 3; -truncate table v2; -select * from t1; -s1 -1 -2 -3 -select * from v2; -s1 -delete from t1; -create table t2 (s1 int, s2 int); -create view v3 as select a.s1, b.s2 from t1 a join t2 b on a.s1 = b.s1 where a.s1 > 3; -truncate table v3; -ERROR HY000: Can not delete from join view 'test.v3' -create view v4 as select * from t1 limit 1,1; -truncate table v4; -ERROR HY000: The target table v4 of the TRUNCATE is not updatable -drop view v1, v2, v3, v4; -drop table t1, t2; +ERROR 42S02: Table 'test.v1' doesn't exist +drop view v1; +drop table t1; diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test index c52260124cb..ba5364bd324 100644 --- a/mysql-test/t/truncate.test +++ b/mysql-test/t/truncate.test @@ -54,33 +54,18 @@ drop table t1; # End of 4.1 tests # Test for Bug#5507 "TRUNCATE should work with views" +# +# when it'll be fixed, the error should become 1347 +# (test.v1' is not BASE TABLE) +# create table t1 (s1 int); - insert into t1 (s1) values (1), (2), (3), (4), (5); create view v1 as select * from t1; +--error 1146 truncate table v1; -select count(*) from t1; - -insert into t1 (s1) values (1), (2), (3), (4), (5); -create view v2 as select * from t1 where s1 > 3; -truncate table v2; -select * from t1; -select * from v2; -delete from t1; - -# The following should fail -create table t2 (s1 int, s2 int); -create view v3 as select a.s1, b.s2 from t1 a join t2 b on a.s1 = b.s1 where a.s1 > 3; ---error 1395 -truncate table v3; - -# The following should fail -create view v4 as select * from t1 limit 1,1; ---error 1288 -truncate table v4; - -drop view v1, v2, v3, v4; -drop table t1, t2; +drop view v1; +drop table t1; # End of 5.0 tests + diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 6956e5cfe91..19f3135c594 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -369,8 +369,6 @@ bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) { Item *fake_conds= 0; SELECT_LEX *select_lex= &thd->lex->select_lex; - const char *operation = thd->lex->sql_command == SQLCOM_TRUNCATE ? - "TRUNCATE" : "DELETE"; DBUG_ENTER("mysql_prepare_delete"); List all_fields; @@ -385,14 +383,14 @@ bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) DBUG_RETURN(TRUE); if (!table_list->updatable || check_key_in_view(thd, table_list)) { - my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, operation); + my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "DELETE"); DBUG_RETURN(TRUE); } { TABLE_LIST *duplicate; if ((duplicate= unique_table(thd, table_list, table_list->next_global, 0))) { - update_non_unique_table_error(table_list, operation, duplicate); + update_non_unique_table_error(table_list, "DELETE", duplicate); DBUG_RETURN(TRUE); } } @@ -897,8 +895,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) if (!dont_send_ok) { db_type table_type; - if (mysql_frm_type(thd, path, &table_type) == FRMTYPE_VIEW) - goto trunc_by_del; + mysql_frm_type(thd, path, &table_type); if (table_type == DB_TYPE_UNKNOWN) { my_error(ER_NO_SUCH_TABLE, MYF(0), diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 4be0aca3ea7..3be844b6761 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1834,7 +1834,6 @@ bool st_lex::can_use_merged() case SQLCOM_UPDATE_MULTI: case SQLCOM_DELETE: case SQLCOM_DELETE_MULTI: - case SQLCOM_TRUNCATE: case SQLCOM_INSERT: case SQLCOM_INSERT_SELECT: case SQLCOM_REPLACE: From e7788a9f1b7ef8007952636ae928a95bc3506b25 Mon Sep 17 00:00:00 2001 From: "joerg@trift2." <> Date: Tue, 17 Apr 2007 14:41:07 +0200 Subject: [PATCH 08/22] Cleanup: The temporary file could be left around if nothing was excluded. --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 76352b06d62..0c2d20e3feb 100644 --- a/configure.in +++ b/configure.in @@ -2554,7 +2554,7 @@ then man_dirs="man" man1_files=`echo $man1_files` man8_files=`echo $man8_files` - rm -f $MANLISTFIL + rm -f $MANLISTFIL $TMPLISTFIL else man_dirs="" man1_files="" From a3f5321025daaaa932b2cadba153f4d832d2b1d0 Mon Sep 17 00:00:00 2001 From: "kent/mysqldev@mysql.com/production.mysql.com" <> Date: Tue, 17 Apr 2007 15:20:48 +0200 Subject: [PATCH 09/22] Bug#27783 mysql_install_db should be able to install again, preserving existing files. - Allow mysql_install_db to be run a second time in the same datadir to create and fill any missing system tables --- scripts/mysql_install_db.sh | 11 ----------- scripts/mysql_system_tables.sql | 5 +++++ scripts/mysql_system_tables_data.sql | 22 +++++++++++++++------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index c1a27eb0bc8..63995eb1575 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -135,17 +135,6 @@ else fi fi -# Check that no previous MySQL installation exist -if test -f "$ldata/mysql/db.frm" -then - echo "FATAL ERROR: Found already existing MySQL system tables" - echo "in $ldata." - echo "If you are upgrading from a previous MySQL version you" - echo "should run '$bindir/mysql_upgrade', " - echo "to upgrade all tables for this version of MySQL" - exit 1; -fi - # Find SQL scripts needed for bootstrap fill_help_tables="fill_help_tables.sql" create_system_tables="mysql_system_tables.sql" diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index 5f5aea20729..d9c870f1d73 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -6,12 +6,17 @@ set storage_engine=myisam; CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; +-- Remember for later if db table already existed +set @had_db_table= @@warning_count != 0; CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges'; CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; +-- Remember for later if user table already existed +set @had_user_table= @@warning_count != 0; + CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql index a9c816f2896..5f0289ab197 100644 --- a/scripts/mysql_system_tables_data.sql +++ b/scripts/mysql_system_tables_data.sql @@ -2,12 +2,20 @@ -- The inital data for system tables of MySQL Server -- --- default grants for anyone to access database 'test' and 'test_%' -INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); -INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); +-- Fill "db" table with default grants for anyone to +-- access database 'test' and 'test_%' if "db" table didn't exist +CREATE TEMPORARY TABLE tmp_db LIKE db; +INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); +INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); +INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0; +DROP TABLE tmp_db; --- default users allowing root access from local machine -INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); -REPLACE INTO user VALUES (@@hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); -REPLACE INTO user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +-- Fill "users" table with default users allowing root access +-- from local machine if "users" table didn't exist before +CREATE TEMPORARY TABLE tmp_user LIKE user; +INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +REPLACE INTO tmp_user VALUES (@@hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; +DROP TABLE tmp_user; From d22e71fe50fc60048a834f93fe9cae32ba44c579 Mon Sep 17 00:00:00 2001 From: "kent/mysqldev@mysql.com/production.mysql.com" <> Date: Tue, 17 Apr 2007 15:40:38 +0200 Subject: [PATCH 10/22] Dbdict.cpp: Bug #27710 Creating unique index fails during single user mode - enable indexes to be used always, if in single user, reject will happen before, and if it is kerlel doing stuff, it should always be allowed --- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index b8e2cfca41e..8f8e8fdfae3 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -6883,6 +6883,7 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr) w.add(DictTabInfo::NoOfKeyAttr, indexPtr.p->noOfPrimkey); w.add(DictTabInfo::NoOfNullable, indexPtr.p->noOfNullAttr); w.add(DictTabInfo::KeyLength, indexPtr.p->tupKeyLength); + w.add(DictTabInfo::SingleUserMode, (Uint32)1); // write index key attributes AttributeRecordPtr aRecPtr; c_attributeRecordPool.getPtr(aRecPtr, tablePtr.p->firstAttribute); From ba8c9ab5a7d29747d05a19a88efa2b927e4c8eab Mon Sep 17 00:00:00 2001 From: "omer@linux.localdomain" <> Date: Tue, 17 Apr 2007 11:23:49 -0700 Subject: [PATCH 11/22] Added funcs_1 and funcs_2 to the test-bt option --- Makefile.am | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile.am b/Makefile.am index ed54b630aea..cdced7ed247 100644 --- a/Makefile.am +++ b/Makefile.am @@ -152,6 +152,10 @@ test-bt: @PERL@ ./mysql-test-run.pl --force --comment=normal --report-features -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --suite=funcs_1 + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2 test-bt-debug: -cd mysql-test ; MTR_BUILD_THREAD=auto \ From 5fc30d25ea1f6273534fa721798e4b2ee359a990 Mon Sep 17 00:00:00 2001 From: "joerg@trift2." <> Date: Wed, 18 Apr 2007 16:41:38 +0200 Subject: [PATCH 12/22] sql/ha_ndbcluster.cc Hex constants that exceed 32 bit need to be marked "LL" for the compile to work. --- sql/ha_ndbcluster.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 71050bc73e4..350133221ab 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -733,8 +733,8 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field, DBUG_DUMP("value", (char*)&bits, pack_len); #ifdef WORDS_BIGENDIAN /* store lsw first */ - bits = ((bits >> 32) & 0x00000000FFFFFFFF) - | ((bits << 32) & 0xFFFFFFFF00000000); + bits = ((bits >> 32) & 0x00000000FFFFFFFFLL) + | ((bits << 32) & 0xFFFFFFFF00000000LL); #endif DBUG_RETURN(ndb_op->setValue(fieldnr, (char*)&bits, pack_len) != 0); } @@ -2678,10 +2678,10 @@ void ha_ndbcluster::unpack_record(byte* buf) /* lsw is stored first */ Uint32 *buf= (Uint32 *)(*value).rec->aRef(); ((Field_bit *) *field)->store((((longlong)*buf) - & 0x000000000FFFFFFFF) + & 0x000000000FFFFFFFFLL) | ((((longlong)*(buf+1)) << 32) - & 0xFFFFFFFF00000000), + & 0xFFFFFFFF00000000LL), TRUE); #else ((Field_bit *) *field)->store((longlong) From d55cddad9381aa2a7337d3ca2979db42eb35dc30 Mon Sep 17 00:00:00 2001 From: "svoj@mysql.com/june.mysql.com" <> Date: Thu, 19 Apr 2007 11:53:25 +0500 Subject: [PATCH 13/22] Fixed a warning on win64. --- myisam/mi_rkey.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/myisam/mi_rkey.c b/myisam/mi_rkey.c index 2933d694318..e34799da6ed 100644 --- a/myisam/mi_rkey.c +++ b/myisam/mi_rkey.c @@ -62,7 +62,8 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len, key_len, &last_used_keyseg); /* Save packed_key_length for use by the MERGE engine. */ info->pack_key_length= pack_key_length; - info->last_used_keyseg= last_used_keyseg - info->s->keyinfo[inx].seg; + info->last_used_keyseg= (uint16) (last_used_keyseg - + info->s->keyinfo[inx].seg); DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE, keyinfo->seg, key_buff, pack_key_length);); } From ed037928a8b3bf154d338fe4a4b874fadf6da558 Mon Sep 17 00:00:00 2001 From: "kent/mysqldev@mysql.com/production.mysql.com" <> Date: Thu, 19 Apr 2007 22:56:04 +0200 Subject: [PATCH 14/22] mysql.sln: Enable 'mysys' build if target 'Enterprise' item_subselect.h: Fixed bug #27870. The bug that causes crashes manifests itself at some conditions when executing an equijoin query with WHERE condition containing a subquery predicate of the form join_attr NOT IN (SELECT ...). --- VC++Files/mysql.sln | 1 + sql/item_subselect.h | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/VC++Files/mysql.sln b/VC++Files/mysql.sln index 31b9232e2ec..f9b22b6dcc9 100644 --- a/VC++Files/mysql.sln +++ b/VC++Files/mysql.sln @@ -733,6 +733,7 @@ Global {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Debug 98.ActiveCfg = Debug 98|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Debug 98.Build.0 = Debug 98|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Enterprise.ActiveCfg = Release|Win32 + {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Enterprise.Build.0 = Release|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Enterprise Debug.ActiveCfg = Debug|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Enterprise Debug.Build.0 = Debug|Win32 {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Enterprise GPL.ActiveCfg = Release|Win32 diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 6b605e96432..118609671b8 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -276,7 +276,11 @@ public: { return pushed_cond_guards ? pushed_cond_guards + i : NULL; } - void set_cond_guard_var(int i, bool v) { pushed_cond_guards[i]= v; } + void set_cond_guard_var(int i, bool v) + { + if ( pushed_cond_guards) + pushed_cond_guards[i]= v; + } bool have_guarded_conds() { return test(pushed_cond_guards); } Item_func_not_all *upper_item; // point on NOT/NOP before ALL/SOME subquery From 5de73f45f93988351e620781ae6e631c3760a7fc Mon Sep 17 00:00:00 2001 From: "joerg@debian.(none)" <> Date: Fri, 20 Apr 2007 10:51:53 +0200 Subject: [PATCH 15/22] configure.in : Ensure that "icheck" is really the ABI checker, not some other tool (file system checker on Tru64). Patch originally supplied by Peter O'Gorman, slightly modified by me. Bug#27739 "build fails on Tru64 due to icheck test in configure" --- configure.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/configure.in b/configure.in index 0c2d20e3feb..a29329707af 100644 --- a/configure.in +++ b/configure.in @@ -459,6 +459,22 @@ AC_SUBST(MAKEINDEX) # icheck, used for ABI check AC_PATH_PROG(ICHECK, icheck, no) +# "icheck" is also the name of a file system check program on Tru64. +# Verify the program found is really the interface checker. +if test "x$ICHECK" != "xno" +then + AC_MSG_CHECKING(if $ICHECK works as expected) + echo "int foo;" > conftest.h + $ICHECK --canonify -o conftest.ic conftest.h 2>/dev/null + if test -f "conftest.ic" + then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + ICHECK=no + fi + rm -f conftest.ic conftest.h +fi AC_SUBST(ICHECK) # Lock for PS From 8378813628467693026f4338a55b2a0720a1ba5d Mon Sep 17 00:00:00 2001 From: "kent/mysqldev@mysql.com/production.mysql.com" <> Date: Fri, 20 Apr 2007 11:53:53 +0200 Subject: [PATCH 16/22] testScanFilter.cpp: Corrected copyright header --- ndb/test/ndbapi/testScanFilter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ndb/test/ndbapi/testScanFilter.cpp b/ndb/test/ndbapi/testScanFilter.cpp index e195c04bd93..5098d83745b 100644 --- a/ndb/test/ndbapi/testScanFilter.cpp +++ b/ndb/test/ndbapi/testScanFilter.cpp @@ -1,9 +1,8 @@ -/* Copyright (C) 2007, Justin He, MySQL AB +/* Copyright (C) 2007 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of From 53cee9f2bf175b47a167da17b9f248f4c92bb0aa Mon Sep 17 00:00:00 2001 From: "tomas@whalegate.ndb.mysql.com" <> Date: Fri, 20 Apr 2007 12:37:32 +0200 Subject: [PATCH 17/22] Construction does not work on hpux aCC, so some refactoring --- ndb/include/ndbapi/Ndb.hpp | 13 +------------ ndb/src/ndbapi/NdbImpl.hpp | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp index 5af86cd09a8..b3c9acd4e20 100644 --- a/ndb/include/ndbapi/Ndb.hpp +++ b/ndb/include/ndbapi/Ndb.hpp @@ -1051,18 +1051,7 @@ class Ndb friend class NdbDictionaryImpl; friend class NdbDictInterface; friend class NdbBlob; - friend class Ndb_free_list_t; - friend class Ndb_free_list_t; - friend class Ndb_free_list_t; - friend class Ndb_free_list_t; - friend class Ndb_free_list_t; - friend class Ndb_free_list_t; - friend class Ndb_free_list_t; - friend class Ndb_free_list_t; - friend class Ndb_free_list_t; - friend class Ndb_free_list_t; - friend class Ndb_free_list_t; - friend class Ndb_free_list_t; + friend class NdbImpl; #endif public: diff --git a/ndb/src/ndbapi/NdbImpl.hpp b/ndb/src/ndbapi/NdbImpl.hpp index ec386074692..dc0a057619f 100644 --- a/ndb/src/ndbapi/NdbImpl.hpp +++ b/ndb/src/ndbapi/NdbImpl.hpp @@ -89,6 +89,15 @@ public: return 0; } +/* + We need this friend accessor function to work around a HP compiler problem, + where template class friends are not working. +*/ + static inline void setNdbError(Ndb &ndb,int code){ + ndb.theError.code = code; + return; + } + /** * NOTE free lists must be _after_ theNdbObjectIdMap take * assure that destructors are run in correct order @@ -208,7 +217,7 @@ Ndb_free_list_t::fill(Ndb* ndb, Uint32 cnt) m_free_list = new T(ndb); if (m_free_list == 0) { - ndb->theError.code = 4000; + NdbImpl::setNdbError(*ndb, 4000); assert(false); return -1; } @@ -218,7 +227,7 @@ Ndb_free_list_t::fill(Ndb* ndb, Uint32 cnt) T* obj= new T(ndb); if(obj == 0) { - ndb->theError.code = 4000; + NdbImpl::setNdbError(*ndb, 4000); assert(false); return -1; } @@ -250,7 +259,7 @@ Ndb_free_list_t::seize(Ndb* ndb) } else { - ndb->theError.code = 4000; + NdbImpl::setNdbError(*ndb, 4000); assert(false); } return tmp; From 9050451afef8cb445e9bc4a8f83fb7fc493a6666 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com/kent-amd64.(none)" <> Date: Fri, 20 Apr 2007 15:49:35 +0200 Subject: [PATCH 18/22] Makefile.am: Added the 'suite' directory to the source TAR and install --- mysql-test/Makefile.am | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index d48b8c7dfe4..3bd839bb1f0 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -33,7 +33,7 @@ endif benchdir_root= $(prefix) testdir = $(benchdir_root)/mysql-test EXTRA_SCRIPTS = mysql-test-run-shell.sh install_test_db.sh valgrind.supp $(PRESCRIPTS) -EXTRA_DIST = $(EXTRA_SCRIPTS) +EXTRA_DIST = $(EXTRA_SCRIPTS) suite GENSCRIPTS = mysql-test-run-shell mysql-test-run install_test_db mtr PRESCRIPTS = mysql-test-run.pl test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS) @@ -67,6 +67,7 @@ dist-hook: $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib + -rm -rf `find $(distdir)/suite -type d -name SCCS` install-data-local: $(mkinstalldirs) \ @@ -98,6 +99,12 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib + for f in `(cd $(srcdir); find suite -type f | grep -v SCCS)`; \ + do \ + d=$(DESTDIR)$(testdir)/`dirname $$f`; \ + mkdir -p $$d ; \ + $(INSTALL_DATA) $(srcdir)$$f $$d ; \ + done uninstall-local: @RM@ -f -r $(DESTDIR)$(testdir) From 75c31f6bb9d257e3b3d19e9f4798f08af1df1158 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com/kent-amd64.(none)" <> Date: Fri, 20 Apr 2007 15:52:49 +0200 Subject: [PATCH 19/22] Makefile.am: Typo --- mysql-test/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 3bd839bb1f0..6c7207b0b2d 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -103,7 +103,7 @@ install-data-local: do \ d=$(DESTDIR)$(testdir)/`dirname $$f`; \ mkdir -p $$d ; \ - $(INSTALL_DATA) $(srcdir)$$f $$d ; \ + $(INSTALL_DATA) $(srcdir)/$$f $$d ; \ done uninstall-local: From 4fbdddf28da7e19bb30e39f3bd8bd639913cd281 Mon Sep 17 00:00:00 2001 From: "joerg@debian.(none)" <> Date: Mon, 23 Apr 2007 13:36:18 +0200 Subject: [PATCH 20/22] dbug/dbug_analyze.c : Avoid the unresolved symbol "my_thread_global_init()" in a build "--without-server". Fix for bug#14685 --- dbug/dbug_analyze.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbug/dbug_analyze.c b/dbug/dbug_analyze.c index 8cd0af4f7e0..3263b2ccc59 100644 --- a/dbug/dbug_analyze.c +++ b/dbug/dbug_analyze.c @@ -574,10 +574,12 @@ int main (int argc, char **argv) FILE *infile; FILE *outfile = {stdout}; -#if defined(HAVE_PTHREAD_INIT) && defined(THREAD) +#ifdef THREAD +#if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif my_thread_global_init(); +#endif /* THREAD */ { DBUG_ENTER ("main"); DBUG_PROCESS (argv[0]); From adf575951bbfce4c707ba673d5bece77c4b1597d Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Tue, 24 Apr 2007 22:33:25 +0200 Subject: [PATCH 21/22] restrict recently added file to GPLv2 --- ndb/test/ndbapi/testScanFilter.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ndb/test/ndbapi/testScanFilter.cpp b/ndb/test/ndbapi/testScanFilter.cpp index e195c04bd93..4ce9145bc1e 100644 --- a/ndb/test/ndbapi/testScanFilter.cpp +++ b/ndb/test/ndbapi/testScanFilter.cpp @@ -2,8 +2,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License only. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of From e0f148d5f076a974c4b98f1fdca4d072d2ee4c66 Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Wed, 25 Apr 2007 20:23:19 +0200 Subject: [PATCH 22/22] Fix test case that was broken for builds without InnoDB. --- mysql-test/t/sp.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 64876ae0584..c94a526e10c 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -7075,8 +7075,11 @@ DROP FUNCTION bug5274_f2| delimiter ;| drop table t1,t2; +# Disable warnings to allow test run without InnoDB +--disable_warnings CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM; CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb; +--enable_warnings set @a=0; delimiter |;