From 61962795f1b1a2af74fc590e058170465f6b73e0 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Jun 2005 19:45:15 +0200 Subject: [PATCH 1/3] logging_ok: Logging to logging@openlogging.org accepted DbtcMain.cpp, testTimeout.cpp: Bug #11290 TransactionInactiveTimeout = 0 does not result in infinite timeout ndb/test/ndbapi/testTimeout.cpp: Bug #11290 TransactionInactiveTimeout = 0 does not result in infinite timeout ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: Bug #11290 TransactionInactiveTimeout = 0 does not result in infinite timeout BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + ndb/src/kernel/blocks/dbtc/DbtcMain.cpp | 16 +++-- ndb/test/ndbapi/testTimeout.cpp | 86 +++++++++++++++++++++---- 3 files changed, 85 insertions(+), 18 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 343fb26c83a..bdb93f5adbf 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -176,6 +176,7 @@ mysqldev@melody.local mysqldev@mysql.com mysqldev@o2k.irixworld.net ndbdev@dl145b.mysql.com +ndbdev@dl145c.mysql.com ndbdev@eel.hemma.oreland.se ndbdev@ndbmaster.mysql.com nick@mysql.com diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index ca97a5bce6d..736a660f396 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -722,11 +722,14 @@ Dbtc::set_timeout_value(Uint32 timeOut) void Dbtc::set_appl_timeout_value(Uint32 timeOut) { - timeOut /= 10; - if (timeOut < ctimeOutValue) { - jam(); - c_appl_timeout_value = ctimeOutValue; - }//if + if (timeOut) + { + timeOut /= 10; + if (timeOut < ctimeOutValue) { + jam(); + c_appl_timeout_value = ctimeOutValue; + }//if + } c_appl_timeout_value = timeOut; } @@ -6133,7 +6136,8 @@ void Dbtc::timeOutFoundLab(Signal* signal, Uint32 TapiConPtr) particular state we will use the application timeout parameter rather than the shorter Deadlock detection timeout. */ - if ((ctcTimer - getApiConTimer(apiConnectptr.i)) <= c_appl_timeout_value) { + if (c_appl_timeout_value == 0 || + (ctcTimer - getApiConTimer(apiConnectptr.i)) <= c_appl_timeout_value) { jam(); return; }//if diff --git a/ndb/test/ndbapi/testTimeout.cpp b/ndb/test/ndbapi/testTimeout.cpp index e310e12df81..71c11b25859 100644 --- a/ndb/test/ndbapi/testTimeout.cpp +++ b/ndb/test/ndbapi/testTimeout.cpp @@ -22,14 +22,14 @@ #include #include -#define TIMEOUT 3000 - +#define TIMEOUT (Uint32)3000 Uint32 g_org_timeout = 3000; int setTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){ NdbRestarter restarter; - + int timeout = ctx->getProperty("TransactionInactiveTimeout",TIMEOUT); + NdbConfig conf(GETNDB(step)->getNodeId()+1); unsigned int nodeId = conf.getMasterNodeId(); if (!conf.getProperty(nodeId, @@ -39,7 +39,7 @@ setTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_FAILED; } - int val[] = { DumpStateOrd::TcSetApplTransactionTimeout, TIMEOUT }; + int val[] = { DumpStateOrd::TcSetApplTransactionTimeout, timeout }; if(restarter.dumpStateAllNodes(val, 2) != 0){ return NDBT_FAILED; } @@ -94,9 +94,11 @@ int runTimeoutTrans(NDBT_Context* ctx, NDBT_Step* step){ unsigned int nodeId = conf.getMasterNodeId(); int stepNo = step->getStepNo(); - int minSleep = (int)(TIMEOUT * 1.5); - int maxSleep = TIMEOUT * 2; - ndbout << "TransactionInactiveTimeout="<< TIMEOUT + int timeout = ctx->getProperty("TransactionInactiveTimeout",TIMEOUT); + + int minSleep = (int)(timeout * 1.5); + int maxSleep = timeout * 2; + ndbout << "TransactionInactiveTimeout="<< timeout << ", minSleep="<getNumRecords(); - int minSleep = (int)(TIMEOUT * 1.5); - int maxSleep = TIMEOUT * 2; + int timeout = ctx->getProperty("TransactionInactiveTimeout",TIMEOUT); + + int minSleep = (int)(timeout * 1.5); + int maxSleep = timeout * 2; HugoOperations hugoOps(*ctx->getTab()); Ndb* pNdb = GETNDB(step); @@ -148,7 +152,7 @@ int runTimeoutTrans2(NDBT_Context* ctx, NDBT_Step* step){ op1 = (op1 % 5); op2 = (op2 % 5); - ndbout << stepNo << ": TransactionInactiveTimeout="<< TIMEOUT + ndbout << stepNo << ": TransactionInactiveTimeout="<< timeout << ", minSleep="<getNumLoops(); @@ -334,6 +385,17 @@ TESTCASE("DontTimeoutTransaction", FINALIZER(resetTransactionTimeout); FINALIZER(runClearTable); } +TESTCASE("Bug11290", + "Setting TransactionInactiveTimeout to 0(zero) "\ + "should result in infinite timeout, and not as "\ + "was the bug, a timeout that is equal to the deadlock timeout"){ + TC_PROPERTY("TransactionInactiveTimeout",(Uint32)0); + INITIALIZER(runLoadTable); + INITIALIZER(setTransactionTimeout); + STEPS(runDeadlockTimeoutTrans, 1); + FINALIZER(resetTransactionTimeout); + FINALIZER(runClearTable); +} TESTCASE("DontTimeoutTransaction5", "Test that the transaction does not timeout "\ "if we sleep during the transaction. Use a sleep "\ From 89906482e0271824209d995a37a2265dee3bd4cf Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Jun 2005 11:24:26 -0700 Subject: [PATCH 2/3] func_if.result, func_if.test: Added a test case for bug #11142. item_cmpfunc.cc: Fixed bug #11142. Implementation of Item_func_nullif::is_null was corrected. sql/item_cmpfunc.cc: Fixed bug #11142. Implementation of Item_func_nullif::is_null was corrected. mysql-test/t/func_if.test: Added a test case for bug #11142. mysql-test/r/func_if.result: Added a test case for bug #11142. --- mysql-test/r/func_if.result | 27 +++++++++++++++++++++++++++ mysql-test/t/func_if.test | 27 +++++++++++++++++++++++++++ sql/item_cmpfunc.cc | 4 +--- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 508a50caf02..dd8f34d53d2 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -86,3 +86,30 @@ drop table t1; SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL; NULLIF(5,5) IS NULL NULLIF(5,5) IS NOT NULL 1 0 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a CHAR(10)); +INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb'); +SELECT a, NULLIF(a,'') FROM t1; +a NULLIF(a,'') +aaa aaa +NULL NULL + NULL +bbb bbb +SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL; +a NULLIF(a,'') +NULL NULL + NULL +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(10)); +INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb'); +SELECT a, NULLIF(a,'') FROM t1; +a NULLIF(a,'') +aaa aaa +NULL NULL + NULL +bbb bbb +SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL; +a NULLIF(a,'') +NULL NULL + NULL +DROP TABLE t1; diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 693773b18c8..ae820fae93b 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -60,3 +60,30 @@ drop table t1; # Bug #5595 NULLIF() IS NULL returns false if NULLIF() returns NULL # SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL; +# +# Test to check evaluation of MULLIF when the first argument is NULL +# (motivated by the Bug 11142) +# + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a CHAR(10)); +INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb'); +SELECT a, NULLIF(a,'') FROM t1; +SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL; + +DROP TABLE t1; + +# +# Test for bug #11142: evaluation of NULLIF when the first argument is NULL +# + +CREATE TABLE t1 (a CHAR(10)); +INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb'); + +SELECT a, NULLIF(a,'') FROM t1; +SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL; + +DROP TABLE t1; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 337ac949d35..3098e5dc77e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1161,9 +1161,7 @@ Item_func_nullif::val_str(String *str) bool Item_func_nullif::is_null() { - if (!cmp.compare()) - return (null_value=1); - return 0; + return (null_value= (!cmp.compare() ? 1 : args[0]->null_value)); } /* From a4535bc827f38899270c4bca37c544198f6a9e2a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Jun 2005 11:38:16 -0700 Subject: [PATCH 3/3] func_if.result, func_if.test: Correction for test case of bug #11142. mysql-test/t/func_if.test: Correction for test case of bug #11142. mysql-test/r/func_if.result: Correction for test case of bug #11142. --- mysql-test/r/func_if.result | 14 -------------- mysql-test/t/func_if.test | 15 --------------- 2 files changed, 29 deletions(-) diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index dd8f34d53d2..2c8f19f1754 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -86,20 +86,6 @@ drop table t1; SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL; NULLIF(5,5) IS NULL NULLIF(5,5) IS NOT NULL 1 0 -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (a CHAR(10)); -INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb'); -SELECT a, NULLIF(a,'') FROM t1; -a NULLIF(a,'') -aaa aaa -NULL NULL - NULL -bbb bbb -SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL; -a NULLIF(a,'') -NULL NULL - NULL -DROP TABLE t1; CREATE TABLE t1 (a CHAR(10)); INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb'); SELECT a, NULLIF(a,'') FROM t1; diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index ae820fae93b..4333defa412 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -60,21 +60,6 @@ drop table t1; # Bug #5595 NULLIF() IS NULL returns false if NULLIF() returns NULL # SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL; -# -# Test to check evaluation of MULLIF when the first argument is NULL -# (motivated by the Bug 11142) -# - ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - -CREATE TABLE t1 (a CHAR(10)); -INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb'); -SELECT a, NULLIF(a,'') FROM t1; -SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL; - -DROP TABLE t1; # # Test for bug #11142: evaluation of NULLIF when the first argument is NULL