From 5aecf16a2f9d27ffb281642d410309e2b02c58b8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 25 Sep 2005 11:35:32 +0200 Subject: [PATCH 1/4] disabled.def: Disable unstable test cases new file mysql-test/t/disabled.def: Disable unstable test cases --- mysql-test/t/disabled.def | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 mysql-test/t/disabled.def diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def new file mode 100644 index 00000000000..ddb79205357 --- /dev/null +++ b/mysql-test/t/disabled.def @@ -0,0 +1,16 @@ +############################################################################## +# +# List the test cases that are to be disabled temporarely. +# +# Separate the test case name and the comment with ':'. +# +# : Comment test +# +# Don't use any TAB characters for whitespace. +# +############################################################################## + +rpl_relayrotate : Unstable test case, bug#12429 +rpl_until : Unstable test case, bug#12429 +rpl_deadlock : Unstable test case, bug#12429 +kill : Unstable test case, bug#9712 From a17b3dcbe3d86eaaaabe627139ed09c35828d61c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Sep 2005 00:58:12 +0400 Subject: [PATCH 2/4] Fix bug#13356 resolve_const_item() wasn't able to handle Item_row items. resolve_const_item() assumed to be not called for Item_row items. For ensuring that DBUG_ASSERT(0) was set there. This patch adds section for Item_row items. If it can it recursively calls resolve_const_item() for each item the Item_row contains. If any of the contained items is null then whole Item_row substitued by Item_null. Otherwise it just returns. sql/item.cc: Fix bug#13356 resolve_const_item() wasn't able to handle Item_row items. Added section to resolve_const_item() for Item_row items. If it can it recursively calls resolve_const_item() for each item the Item_row contains. If any of the contained items is null then Item_row is substituted by Item_null. Otherwise it just returns. Comment moved closer to function it belongs to. mysql-test/t/select.test: Test case for bug#13356 resolve_const_item() wasn't able to handle Item_row items. mysql-test/r/select.result: Test case for bug#13356 resolve_const_item() wasn't able to handle Item_row items. --- mysql-test/r/select.result | 9 +++++++++ mysql-test/t/select.test | 10 ++++++++++ sql/item.cc | 29 +++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 993fe7d22f1..64cbaf4fa67 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2617,3 +2617,12 @@ select found_rows(); found_rows() 1 DROP TABLE t1; +create table t1(f1 int, f2 int); +create table t2(f3 int); +select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1)); +f1 +select f1 from t1,t2 where f1=f2 and (f1,NULL) = ((1,1)); +f1 +select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL)); +f1 +drop table t1,t2; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index b51ea89c7dd..bdadd5c536b 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2164,4 +2164,14 @@ select found_rows(); DROP TABLE t1; +# +# Bug #13356 assertion failed in resolve_const_item() +# +create table t1(f1 int, f2 int); +create table t2(f3 int); +select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1)); +select f1 from t1,t2 where f1=f2 and (f1,NULL) = ((1,1)); +select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL)); +drop table t1,t2; + # End of 4.1 tests diff --git a/sql/item.cc b/sql/item.cc index 010189c321c..03ab38fc970 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2870,6 +2870,35 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item) new_item= (null_value ? (Item*) new Item_null(name) : (Item*) new Item_int(name, result, length)); } + else if (res_type == ROW_RESULT) + { + new_item= 0; + /* + If item and comp_item are both Item_rows and have same number of cols + then process items in Item_row one by one. If Item_row contain nulls + substitute it by Item_null. Otherwise just return. + */ + if (item->result_type() == comp_item->result_type() && + ((Item_row*)item)->cols() == ((Item_row*)comp_item)->cols()) + { + Item_row *item_row= (Item_row*)item,*comp_item_row= (Item_row*)comp_item; + if (item_row->null_inside()) + new_item= (Item*) new Item_null(name); + else + { + int i= item_row->cols() - 1; + for (; i >= 0; i--) + { + if (item_row->maybe_null && item_row->el(i)->is_null()) + { + new_item= (Item*) new Item_null(name); + break; + } + resolve_const_item(thd, item_row->addr(i), comp_item_row->el(i)); + } + } + } + } else { // It must REAL_RESULT double result=item->val(); From 2de206b4eee3033a590cb337ffd86c89df678b4c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Sep 2005 14:14:49 +0300 Subject: [PATCH 3/4] Fixed a bug checksum table locks the InnoDB table and does not use a consistent read (Bug #12669). mysql-test/r/innodb.result: Added test results for a checksum test. mysql-test/t/innodb.test: Added test case for a checksum bug #12669. sql/ha_innodb.cc: Use consistent read for checksum table and convert MySQL lock type to the TL_READ because at the moment MySQL uses TL_READ_NO_INSERT. --- mysql-test/r/innodb.result | 28 ++++++++++++++++++++++++++ mysql-test/t/innodb.test | 41 ++++++++++++++++++++++++++++++++++++++ sql/ha_innodb.cc | 7 +++++++ 3 files changed, 76 insertions(+) diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index c7aef8ed792..ca78d23e6dc 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1694,3 +1694,31 @@ select min(b) from t1 where a='8'; min(b) 6 drop table t1; +create table test_checksum(a int not null) engine=innodb DEFAULT CHARSET=latin1; +insert into test_checksum values (1),(2); +set autocommit=0; +checksum table test_checksum; +Table Checksum +test.test_checksum 1531596814 +insert into test_checksum values(3); +checksum table test_checksum; +Table Checksum +test.test_checksum 1531596814 +commit; +checksum table test_checksum; +Table Checksum +test.test_checksum 2050879373 +commit; +drop table test_checksum; +create table test_checksum(a int not null) engine=innodb DEFAULT CHARSET=latin1; +insert into test_checksum values (1),(2); +set autocommit=1; +checksum table test_checksum; +Table Checksum +test.test_checksum 1531596814 +set autocommit=1; +insert into test_checksum values(3); +checksum table test_checksum; +Table Checksum +test.test_checksum 2050879373 +drop table test_checksum; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index b966ea5b281..3a693968769 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1239,4 +1239,45 @@ insert into t1 values ('8', '6'), ('4', '7'); select min(a) from t1; select min(b) from t1 where a='8'; drop table t1; + +# +# Test that checksum table uses a consistent read Bug #12669 +# +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connection a; +create table test_checksum(a int not null) engine=innodb DEFAULT CHARSET=latin1; +insert into test_checksum values (1),(2); +set autocommit=0; +checksum table test_checksum; +connection b; +insert into test_checksum values(3); +connection a; +# +# Here checksum should not see insert +# +checksum table test_checksum; +connection a; +commit; +checksum table test_checksum; +commit; +drop table test_checksum; +# +# autocommit = 1 +# +connection a; +create table test_checksum(a int not null) engine=innodb DEFAULT CHARSET=latin1; +insert into test_checksum values (1),(2); +set autocommit=1; +checksum table test_checksum; +connection b; +set autocommit=1; +insert into test_checksum values(3); +connection a; +# +# Here checksum sees insert +# +checksum table test_checksum; +drop table test_checksum; + # End of 4.1 tests diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index b30ddfe8227..1312b645017 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -5421,6 +5421,13 @@ ha_innobase::store_lock( prebuilt->select_lock_type = LOCK_NONE; prebuilt->stored_select_lock_type = LOCK_NONE; + } else if (thd->lex->sql_command == SQLCOM_CHECKSUM) { + /* Use consistent read for checksum table and + convert lock type to the TL_READ */ + + prebuilt->select_lock_type = LOCK_NONE; + prebuilt->stored_select_lock_type = LOCK_NONE; + lock.type = TL_READ; } else { prebuilt->select_lock_type = LOCK_S; prebuilt->stored_select_lock_type = LOCK_S; From 86856939c4ba9f786541e2293de897086517caf0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Sep 2005 13:39:28 +0200 Subject: [PATCH 4/4] mysql_config.sh: Added -lz to link using libmysqld scripts/mysql_config.sh: Added -lz to link using libmysqld --- scripts/mysql_config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh index 15b45391ef8..5b35c0190a5 100644 --- a/scripts/mysql_config.sh +++ b/scripts/mysql_config.sh @@ -101,7 +101,7 @@ libs_r="$ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@" libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` cflags="-I$pkgincludedir @CFLAGS@ " #note: end space! include="-I$pkgincludedir" -embedded_libs="$ldflags -L$pkglibdir -lmysqld @LIBS@ @WRAPLIBS@ @innodb_system_libs@ $client_libs" +embedded_libs="$ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@" embedded_libs=`echo "$embedded_libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` # Remove some options that a client doesn't have to care about