From 945d4606bba0c00c33fe5750bd612918e65be3c2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 4 Jul 2006 12:30:08 +0200 Subject: [PATCH 01/22] When building RPMs, use the Perl script to run the tests, to automatically check SSL. support-files/mysql.spec.sh: Use the Perl script to run the tests, because it will automatically check whether the server is configured with SSL. (The shell script needs an explicit flag, and we cannot pass that though "make".) --- support-files/mysql.spec.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 493a37c040c..00fc1840e1c 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -342,7 +342,7 @@ then cp -fp config.log "$MYSQL_MAXCONFLOG_DEST" fi -make -i test-force || true +make -i test-force.pl || true # Save mysqld-max ./libtool --mode=execute cp sql/mysqld sql/mysqld-max @@ -401,7 +401,7 @@ then cp -fp config.log "$MYSQL_CONFLOG_DEST" fi -make -i test-force || true +make -i test-force.pl || true %install RBR=$RPM_BUILD_ROOT @@ -740,6 +740,11 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Tue Jul 04 2006 Joerg Bruehe + +- Use the Perl script to run the tests, because it will automatically check + whether the server is configured with SSL. + * Tue Jun 27 2006 Joerg Bruehe - move "mysqldumpslow" from the client RPM to the server RPM (bug#20216) From f260771d131f00b22dd21f3837dd2c8262d25f3b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 4 Jul 2006 13:51:35 +0200 Subject: [PATCH 02/22] pekka - checkout:get (4.1) BitKeeper/etc/config: checkout:get --- BitKeeper/etc/config | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config index 5fa877c5e3a..4b5bb12f420 100644 --- a/BitKeeper/etc/config +++ b/BitKeeper/etc/config @@ -73,5 +73,6 @@ hours: [jonas:]checkout:get [tomas:]checkout:get [guilhem:]checkout:get +[pekka:]checkout:get checkout:edit eoln:unix From 99e4dee4ff36cb38735d5da032e29d46ae996da2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 4 Jul 2006 15:11:11 +0200 Subject: [PATCH 03/22] ndb - bug#20847 fix (4.1) ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp: DROP did not do merge with right buddies --- ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp b/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp index 642ba270760..e74ac93f3f8 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp @@ -59,7 +59,7 @@ Uint32 Dbtup::allocTabDescr(const Tablerec* regTabPtr, Uint32* offset) Uint32 reference = RNIL; Uint32 allocSize = getTabDescrOffsets(regTabPtr, offset); /* ---------------------------------------------------------------- */ -/* ALWAYS ALLOCATE A MULTIPLE OF 16 BYTES */ +/* ALWAYS ALLOCATE A MULTIPLE OF 16 WORDS */ /* ---------------------------------------------------------------- */ allocSize = (((allocSize - 1) >> 4) + 1) << 4; Uint32 list = nextHigherTwoLog(allocSize - 1); /* CALCULATE WHICH LIST IT BELONGS TO */ @@ -73,7 +73,6 @@ Uint32 Dbtup::allocTabDescr(const Tablerec* regTabPtr, Uint32* offset) if (retNo >= ZTD_FREE_SIZE) { ljam(); Uint32 retRef = reference + allocSize; /* SET THE RETURN POINTER */ - retNo = itdaMergeTabDescr(retRef, retNo); /* MERGE WITH POSSIBLE RIGHT NEIGHBOURS */ freeTabDescr(retRef, retNo); /* RETURN UNUSED TD SPACE TO THE TD AREA */ } else { ljam(); @@ -102,6 +101,7 @@ Uint32 Dbtup::allocTabDescr(const Tablerec* regTabPtr, Uint32* offset) void Dbtup::freeTabDescr(Uint32 retRef, Uint32 retNo) { + retNo = itdaMergeTabDescr(retRef, retNo); /* MERGE WITH POSSIBLE RIGHT NEIGHBOURS */ while (retNo >= ZTD_FREE_SIZE) { ljam(); Uint32 list = nextHigherTwoLog(retNo); @@ -111,6 +111,7 @@ void Dbtup::freeTabDescr(Uint32 retRef, Uint32 retNo) retRef += sizeOfChunk; retNo -= sizeOfChunk; }//while + ndbassert(retNo == 0); }//Dbtup::freeTabDescr() Uint32 From 2c48aaa183a167fb3cac6f17bc17cb70e62a565e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 7 Jul 2006 10:57:22 +0200 Subject: [PATCH 04/22] ndb - bug#20847 : DbtupTabDesMan: add merge with left buddies ndb/src/kernel/blocks/ERROR_codes.txt: DbtupTabDesMan: add merge with left buddies ndb/src/kernel/blocks/dbtup/Dbtup.hpp: DbtupTabDesMan: add merge with left buddies ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp: DbtupTabDesMan: add merge with left buddies ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp: DbtupTabDesMan: add merge with left buddies ndb/test/ndbapi/testDict.cpp: DbtupTabDesMan: add merge with left buddies ndb/test/run-test/daily-basic-tests.txt: DbtupTabDesMan: add merge with left buddies --- ndb/src/kernel/blocks/ERROR_codes.txt | 4 +- ndb/src/kernel/blocks/dbtup/Dbtup.hpp | 9 +- ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp | 7 + .../kernel/blocks/dbtup/DbtupTabDesMan.cpp | 166 ++++++++++++++---- ndb/test/ndbapi/testDict.cpp | 101 +++++++++++ ndb/test/run-test/daily-basic-tests.txt | 4 + 6 files changed, 257 insertions(+), 34 deletions(-) diff --git a/ndb/src/kernel/blocks/ERROR_codes.txt b/ndb/src/kernel/blocks/ERROR_codes.txt index 20f03e7ea69..de32ce91ee8 100644 --- a/ndb/src/kernel/blocks/ERROR_codes.txt +++ b/ndb/src/kernel/blocks/ERROR_codes.txt @@ -2,7 +2,7 @@ Next QMGR 1 Next NDBCNTR 1000 Next NDBFS 2000 Next DBACC 3002 -Next DBTUP 4013 +Next DBTUP 4014 Next DBLQH 5043 Next DBDICT 6006 Next DBDIH 7174 @@ -430,6 +430,8 @@ Drop Table/Index: 8035: Fail next trigger drop in TC 8036: Fail next index drop in TC +4013: verify TUP tab descr before and after next DROP TABLE + System Restart: --------------- diff --git a/ndb/src/kernel/blocks/dbtup/Dbtup.hpp b/ndb/src/kernel/blocks/dbtup/Dbtup.hpp index 1cb3bd89997..360710d543b 100644 --- a/ndb/src/kernel/blocks/dbtup/Dbtup.hpp +++ b/ndb/src/kernel/blocks/dbtup/Dbtup.hpp @@ -2129,15 +2129,18 @@ private: // Public methods Uint32 getTabDescrOffsets(const Tablerec* regTabPtr, Uint32* offset); Uint32 allocTabDescr(const Tablerec* regTabPtr, Uint32* offset); - void freeTabDescr(Uint32 retRef, Uint32 retNo); + void freeTabDescr(Uint32 retRef, Uint32 retNo, bool normal = true); Uint32 getTabDescrWord(Uint32 index); void setTabDescrWord(Uint32 index, Uint32 word); // Private methods Uint32 sizeOfReadFunction(); void removeTdArea(Uint32 tabDesRef, Uint32 list); - void insertTdArea(Uint32 sizeOfChunk, Uint32 tabDesRef, Uint32 list); - Uint32 itdaMergeTabDescr(Uint32 retRef, Uint32 retNo); + void insertTdArea(Uint32 tabDesRef, Uint32 list); + void itdaMergeTabDescr(Uint32& retRef, Uint32& retNo, bool normal); +#ifdef VM_TRACE + void verifytabdes(); +#endif //------------------------------------------------------------------------------------------------------ // Page Memory Manager diff --git a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp index c6e33bdc92b..ad8daff0729 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp @@ -567,6 +567,9 @@ void Dbtup::execDROP_TAB_REQ(Signal* signal) { ljamEntry(); + if (ERROR_INSERTED(4013)) { + verifytabdes(); + } DropTabReq* req = (DropTabReq*)signal->getDataPtr(); TablerecPtr tabPtr; @@ -685,5 +688,9 @@ void Dbtup::execFSREMOVECONF(Signal* signal) releaseTabDescr(tabPtr.p); initTab(tabPtr.p); + if (ERROR_INSERTED(4013)) { + CLEAR_ERROR_INSERT_VALUE; + verifytabdes(); + } }//Dbtup::execFSREMOVECONF() diff --git a/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp b/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp index e74ac93f3f8..3e96bc6c14a 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp @@ -24,13 +24,15 @@ #define ljam() { jamLine(22000 + __LINE__); } #define ljamEntry() { jamEntryLine(22000 + __LINE__); } -/* **************************************************************** */ -/* *********** TABLE DESCRIPTOR MEMORY MANAGER ******************** */ -/* **************************************************************** */ -/* This module is used to allocate and deallocate table descriptor */ -/* memory attached to fragments (could be allocated per table */ -/* instead. Performs its task by a buddy algorithm. */ -/* **************************************************************** */ +/* + * TABLE DESCRIPTOR MEMORY MANAGER + * + * Each table has a descriptor which is a contiguous array of words. + * The descriptor is allocated from a global array using a buddy + * algorithm. Free lists exist for each power of 2 words. Freeing + * a piece first merges with free right and left neighbours and then + * divides itself up into free list chunks. + */ Uint32 Dbtup::getTabDescrOffsets(const Tablerec* regTabPtr, Uint32* offset) @@ -72,8 +74,9 @@ Uint32 Dbtup::allocTabDescr(const Tablerec* regTabPtr, Uint32* offset) Uint32 retNo = (1 << i) - allocSize; /* CALCULATE THE DIFFERENCE */ if (retNo >= ZTD_FREE_SIZE) { ljam(); - Uint32 retRef = reference + allocSize; /* SET THE RETURN POINTER */ - freeTabDescr(retRef, retNo); /* RETURN UNUSED TD SPACE TO THE TD AREA */ + // return unused words, of course without attempting left merge + Uint32 retRef = reference + allocSize; + freeTabDescr(retRef, retNo, false); } else { ljam(); allocSize = 1 << i; @@ -99,15 +102,15 @@ Uint32 Dbtup::allocTabDescr(const Tablerec* regTabPtr, Uint32* offset) }//if }//Dbtup::allocTabDescr() -void Dbtup::freeTabDescr(Uint32 retRef, Uint32 retNo) +void Dbtup::freeTabDescr(Uint32 retRef, Uint32 retNo, bool normal) { - retNo = itdaMergeTabDescr(retRef, retNo); /* MERGE WITH POSSIBLE RIGHT NEIGHBOURS */ + itdaMergeTabDescr(retRef, retNo, normal); /* MERGE WITH POSSIBLE NEIGHBOURS */ while (retNo >= ZTD_FREE_SIZE) { ljam(); Uint32 list = nextHigherTwoLog(retNo); list--; /* RETURN TO NEXT LOWER LIST */ Uint32 sizeOfChunk = 1 << list; - insertTdArea(sizeOfChunk, retRef, list); + insertTdArea(retRef, list); retRef += sizeOfChunk; retNo -= sizeOfChunk; }//while @@ -128,7 +131,7 @@ Dbtup::setTabDescrWord(Uint32 index, Uint32 word) tableDescriptor[index].tabDescr = word; }//Dbtup::setTabDescrWord() -void Dbtup::insertTdArea(Uint32 sizeOfChunk, Uint32 tabDesRef, Uint32 list) +void Dbtup::insertTdArea(Uint32 tabDesRef, Uint32 list) { ndbrequire(list < 16); setTabDescrWord(tabDesRef + ZTD_FL_HEADER, ZTD_TYPE_FREE); @@ -145,19 +148,14 @@ void Dbtup::insertTdArea(Uint32 sizeOfChunk, Uint32 tabDesRef, Uint32 list) setTabDescrWord((tabDesRef + (1 << list)) - ZTD_TR_SIZE, 1 << list); }//Dbtup::insertTdArea() -/* ---------------------------------------------------------------- */ -/* ----------------------- MERGE_TAB_DESCR ------------------------ */ -/* ---------------------------------------------------------------- */ -/* INPUT: TAB_DESCR_PTR POINTING AT THE CURRENT CHUNK */ -/* */ -/* SHORTNAME: MTD */ -/* -----------------------------------------------------------------*/ -Uint32 Dbtup::itdaMergeTabDescr(Uint32 retRef, Uint32 retNo) +/* + * Merge to-be-removed chunk (which need not be initialized with header + * and trailer) with left and right buddies. The start point retRef + * moves to left and the size retNo increases to match the new chunk. + */ +void Dbtup::itdaMergeTabDescr(Uint32& retRef, Uint32& retNo, bool normal) { - /* THE SIZE OF THE PART TO MERGE MUST BE OF THE SAME SIZE AS THE INSERTED PART */ - /* THIS IS TRUE EITHER IF ONE PART HAS THE SAME SIZE OR THE SUM OF BOTH PARTS */ - /* TOGETHER HAS THE SAME SIZE AS THE PART TO BE INSERTED */ - /* FIND THE SIZES OF THE PARTS TO THE RIGHT OF THE PART TO BE REINSERTED */ + // merge right while ((retRef + retNo) < cnoOfTabDescrRec) { ljam(); Uint32 tabDesRef = retRef + retNo; @@ -171,11 +169,28 @@ Uint32 Dbtup::itdaMergeTabDescr(Uint32 retRef, Uint32 retNo) removeTdArea(tabDesRef, list); } else { ljam(); - return retNo; - }//if - }//while - ndbrequire((retRef + retNo) == cnoOfTabDescrRec); - return retNo; + break; + } + } + // merge left + const bool mergeLeft = normal; + while (mergeLeft && retRef > 0) { + ljam(); + Uint32 trailerWord = getTabDescrWord(retRef - ZTD_TR_TYPE); + if (trailerWord == ZTD_TYPE_FREE) { + ljam(); + Uint32 sizeOfMergedPart = getTabDescrWord(retRef - ZTD_TR_SIZE); + ndbrequire(retRef >= sizeOfMergedPart); + retRef -= sizeOfMergedPart; + retNo += sizeOfMergedPart; + Uint32 list = nextHigherTwoLog(sizeOfMergedPart - 1); + removeTdArea(retRef, list); + } else { + ljam(); + break; + } + } + ndbrequire((retRef + retNo) <= cnoOfTabDescrRec); }//Dbtup::itdaMergeTabDescr() /* ---------------------------------------------------------------- */ @@ -211,3 +226,94 @@ void Dbtup::removeTdArea(Uint32 tabDesRef, Uint32 list) setTabDescrWord(tabDescrPrevPtr + ZTD_FL_NEXT, tabDescrNextPtr); }//if }//Dbtup::removeTdArea() + +#ifdef VM_TRACE +void +Dbtup::verifytabdes() +{ + struct WordType { + short fl; // free list 0-15 + short ti; // table id + WordType() : fl(-1), ti(-1) {} + }; + WordType* wt = new WordType [cnoOfTabDescrRec]; + uint free_frags = 0; + // free lists + { + for (uint i = 0; i < 16; i++) { + Uint32 desc2 = RNIL; + Uint32 desc = cfreeTdList[i]; + while (desc != RNIL) { + const Uint32 size = (1 << i); + ndbrequire(size >= ZTD_FREE_SIZE); + ndbrequire(desc + size <= cnoOfTabDescrRec); + { Uint32 index = desc + ZTD_FL_HEADER; + ndbrequire(tableDescriptor[index].tabDescr == ZTD_TYPE_FREE); + } + { Uint32 index = desc + ZTD_FL_SIZE; + ndbrequire(tableDescriptor[index].tabDescr == size); + } + { Uint32 index = desc + size - ZTD_TR_TYPE; + ndbrequire(tableDescriptor[index].tabDescr == ZTD_TYPE_FREE); + } + { Uint32 index = desc + size - ZTD_TR_SIZE; + ndbrequire(tableDescriptor[index].tabDescr == size); + } + { Uint32 index = desc + ZTD_FL_PREV; + ndbrequire(tableDescriptor[index].tabDescr == desc2); + } + for (uint j = 0; j < size; j++) { + ndbrequire(wt[desc + j].fl == -1); + wt[desc + j].fl = i; + } + desc2 = desc; + desc = tableDescriptor[desc + ZTD_FL_NEXT].tabDescr; + free_frags++; + } + } + } + // tables + { + for (uint i = 0; i < cnoOfTablerec; i++) { + TablerecPtr ptr; + ptr.i = i; + ptrAss(ptr, tablerec); + if (ptr.p->tableStatus == DEFINED) { + Uint32 offset[10]; + const Uint32 alloc = getTabDescrOffsets(ptr.p, offset); + const Uint32 desc = ptr.p->readKeyArray - offset[3]; + Uint32 size = alloc; + if (size % ZTD_FREE_SIZE != 0) + size += ZTD_FREE_SIZE - size % ZTD_FREE_SIZE; + ndbrequire(desc + size <= cnoOfTabDescrRec); + { Uint32 index = desc + ZTD_FL_HEADER; + ndbrequire(tableDescriptor[index].tabDescr == ZTD_TYPE_NORMAL); + } + { Uint32 index = desc + ZTD_FL_SIZE; + ndbrequire(tableDescriptor[index].tabDescr == size); + } + { Uint32 index = desc + size - ZTD_TR_TYPE; + ndbrequire(tableDescriptor[index].tabDescr == ZTD_TYPE_NORMAL); + } + { Uint32 index = desc + size - ZTD_TR_SIZE; + ndbrequire(tableDescriptor[index].tabDescr == size); + } + for (uint j = 0; j < size; j++) { + ndbrequire(wt[desc + j].ti == -1); + wt[desc + j].ti = i; + } + } + } + } + // all words + { + for (uint i = 0; i < cnoOfTabDescrRec; i++) { + bool is_fl = wt[i].fl != -1; + bool is_ti = wt[i].ti != -1; + ndbrequire(is_fl != is_ti); + } + } + delete [] wt; + ndbout << "verifytabdes: frags=" << free_frags << endl; +} +#endif diff --git a/ndb/test/ndbapi/testDict.cpp b/ndb/test/ndbapi/testDict.cpp index 5f88342705a..3e4ca007978 100644 --- a/ndb/test/ndbapi/testDict.cpp +++ b/ndb/test/ndbapi/testDict.cpp @@ -223,6 +223,101 @@ int runCreateAndDrop(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_OK; } +int runCreateAndDropAtRandom(NDBT_Context* ctx, NDBT_Step* step) +{ + myRandom48Init(NdbTick_CurrentMillisecond()); + Ndb* pNdb = GETNDB(step); + NdbDictionary::Dictionary* pDic = pNdb->getDictionary(); + int loops = ctx->getNumLoops(); + int numTables = NDBT_Tables::getNumTables(); + bool* tabList = new bool [ numTables ]; + int tabCount; + + { + for (int num = 0; num < numTables; num++) { + (void)pDic->dropTable(NDBT_Tables::getTable(num)->getName()); + tabList[num] = false; + } + tabCount = 0; + } + + NdbRestarter restarter; + int result = NDBT_OK; + int bias = 1; // 0-less 1-more + int i = 0; + + while (i < loops) { + g_info << "loop " << i << " tabs " << tabCount << "/" << numTables << endl; + int num = myRandom48(numTables); + const NdbDictionary::Table* pTab = NDBT_Tables::getTable(num); + char tabName[200]; + strcpy(tabName, pTab->getName()); + + if (tabList[num] == false) { + if (bias == 0 && myRandom48(100) < 80) + continue; + g_info << tabName << ": create" << endl; + if (pDic->createTable(*pTab) != 0) { + const NdbError err = pDic->getNdbError(); + g_err << tabName << ": create failed: " << err << endl; + result = NDBT_FAILED; + break; + } + const NdbDictionary::Table* pTab2 = pDic->getTable(tabName); + if (pTab2 == NULL) { + const NdbError err = pDic->getNdbError(); + g_err << tabName << ": verify create: " << err << endl; + result = NDBT_FAILED; + break; + } + tabList[num] = true; + assert(tabCount < numTables); + tabCount++; + if (tabCount == numTables) + bias = 0; + } + else { + if (bias == 1 && myRandom48(100) < 80) + continue; + g_info << tabName << ": drop" << endl; + if (restarter.insertErrorInAllNodes(4013) != 0) { + g_err << "error insert failed" << endl; + result = NDBT_FAILED; + break; + } + if (pDic->dropTable(tabName) != 0) { + const NdbError err = pDic->getNdbError(); + g_err << tabName << ": drop failed: " << err << endl; + result = NDBT_FAILED; + break; + } + const NdbDictionary::Table* pTab2 = pDic->getTable(tabName); + if (pTab2 != NULL) { + g_err << tabName << ": verify drop: table exists" << endl; + result = NDBT_FAILED; + break; + } + if (pDic->getNdbError().code != 709 && + pDic->getNdbError().code != 723) { + const NdbError err = pDic->getNdbError(); + g_err << tabName << ": verify drop: " << err << endl; + result = NDBT_FAILED; + break; + } + tabList[num] = false; + assert(tabCount > 0); + tabCount--; + if (tabCount == 0) + bias = 1; + } + i++; + } + + delete [] tabList; + return result; +} + + int runCreateAndDropWithData(NDBT_Context* ctx, NDBT_Step* step){ Ndb* pNdb = GETNDB(step); int loops = ctx->getNumLoops(); @@ -1562,6 +1657,12 @@ TESTCASE("CreateAndDrop", "Try to create and drop the table loop number of times\n"){ INITIALIZER(runCreateAndDrop); } +TESTCASE("CreateAndDropAtRandom", + "Try to create and drop table at random loop number of times\n" + "Uses all available tables\n" + "Uses error insert 4013 to make TUP verify table descriptor"){ + INITIALIZER(runCreateAndDropAtRandom); +} TESTCASE("CreateAndDropWithData", "Try to create and drop the table when it's filled with data\n" "do this loop number of times\n"){ diff --git a/ndb/test/run-test/daily-basic-tests.txt b/ndb/test/run-test/daily-basic-tests.txt index e70dcafb249..e9064d6e30b 100644 --- a/ndb/test/run-test/daily-basic-tests.txt +++ b/ndb/test/run-test/daily-basic-tests.txt @@ -489,6 +489,10 @@ max-time: 1500 cmd: testDict args: -n CreateAndDrop +max-time: 1500 +cmd: testDict +args: -n CreateAndDropAtRandom -l 200 T1 + max-time: 1500 cmd: testDict args: -n CreateAndDropWithData From f83d39b5e0d26f21216b53ff2fe2f84dc953b352 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 10 Jul 2006 11:09:32 +0200 Subject: [PATCH 05/22] mysql-test/Makefile.am: fix cp of mode 444 files (re-commit) mysql-test/Makefile.am: fix cp of mode 444 files --- mysql-test/Makefile.am | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 73074397086..39fc425bf06 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -101,15 +101,15 @@ uninstall-local: @RM@ -f -r $(DESTDIR)$(testdir) std_data/client-key.pem: $(top_srcdir)/SSL/$(@F) - @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data + @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data std_data/client-cert.pem: $(top_srcdir)/SSL/$(@F) - @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data + @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data std_data/cacert.pem: $(top_srcdir)/SSL/$(@F) - @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data + @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data std_data/server-cert.pem: $(top_srcdir)/SSL/$(@F) - @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data + @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data std_data/server-key.pem: $(top_srcdir)/SSL/$(@F) - @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data + @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data SUFFIXES = .sh From 5ea0420e9e2261add511d2a1c00d9d55efef8d0a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 10 Jul 2006 12:03:44 +0200 Subject: [PATCH 06/22] support-files/mysql.spec.sh : Fix a typing error. support-files/mysql.spec.sh: Fix a typing error in the "make" target for the Perl script to run the tests. --- support-files/mysql.spec.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 00fc1840e1c..5a0963e4f93 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -342,7 +342,7 @@ then cp -fp config.log "$MYSQL_MAXCONFLOG_DEST" fi -make -i test-force.pl || true +make -i test-force-pl || true # Save mysqld-max ./libtool --mode=execute cp sql/mysqld sql/mysqld-max @@ -401,7 +401,7 @@ then cp -fp config.log "$MYSQL_CONFLOG_DEST" fi -make -i test-force.pl || true +make -i test-force-pl || true %install RBR=$RPM_BUILD_ROOT @@ -740,6 +740,10 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Mon Jul 10 2006 Joerg Bruehe + +- Fix a typing error in the "make" target for the Perl script to run the tests. + * Tue Jul 04 2006 Joerg Bruehe - Use the Perl script to run the tests, because it will automatically check From ce3f15beb56bd0406f0794a10f36404d52c4e53b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 10 Jul 2006 12:13:45 +0200 Subject: [PATCH 07/22] ndb - bug#20847: non-debug compile fix (repeat since cannot merge 4.1->5.0) ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp: non-debug compile fix --- ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp index 7a3d4f0e790..7d2f7d56d48 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp @@ -602,7 +602,9 @@ Dbtup::execDROP_TAB_REQ(Signal* signal) { ljamEntry(); if (ERROR_INSERTED(4013)) { +#ifdef VM_TRACE verifytabdes(); +#endif } DropTabReq* req = (DropTabReq*)signal->getDataPtr(); @@ -724,7 +726,9 @@ void Dbtup::execFSREMOVECONF(Signal* signal) initTab(tabPtr.p); if (ERROR_INSERTED(4013)) { CLEAR_ERROR_INSERT_VALUE; +#ifdef VM_TRACE verifytabdes(); +#endif } }//Dbtup::execFSREMOVECONF() From 1a7e4ac0bbe8f87494124bd4ded7fe5e4f99498f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 10 Jul 2006 20:46:05 +0200 Subject: [PATCH 08/22] Revoking patch for Bug#10952 on behalf of Brian. --- mysql-test/r/blackhole.result | 8 -------- mysql-test/r/merge.result | 8 -------- mysql-test/t/blackhole.test | 12 ------------ mysql-test/t/merge.test | 10 ---------- sql/ha_blackhole.cc | 2 +- sql/ha_myisammrg.cc | 2 +- sql/handler.h | 1 - sql/sql_table.cc | 4 +--- 8 files changed, 3 insertions(+), 44 deletions(-) diff --git a/mysql-test/r/blackhole.result b/mysql-test/r/blackhole.result index a4c057f256c..140d7e73d48 100644 --- a/mysql-test/r/blackhole.result +++ b/mysql-test/r/blackhole.result @@ -123,11 +123,3 @@ master-bin.000001 # Query 1 # use `test`; create table t3 like t1 master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3 master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3 drop table t1,t2,t3; -drop table if exists t1; -Warnings: -Note 1051 Unknown table 't1' -create table t1 (c char(20)) engine=MyISAM; -insert into t1 values ("Monty"),("WAX"),("Walrus"); -alter table t1 engine=blackhole; -ERROR HY000: Table storage engine for 't1' doesn't have this option -drop table t1; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 568f83b7d6d..b1abe16a091 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -768,14 +768,6 @@ Table Op Msg_type Msg_text test.t1 check status OK test.t2 check status OK drop table t1, t2, t3; -drop table if exists t1; -Warnings: -Note 1051 Unknown table 't1' -create table t1 (c char(20)) engine=MyISAM; -insert into t1 values ("Monty"),("WAX"),("Walrus"); -alter table t1 engine=MERGE; -ERROR HY000: Table storage engine for 't1' doesn't have this option -drop table t1; create table t1 (b bit(1)); create table t2 (b bit(1)); create table tm (b bit(1)) engine = merge union = (t1,t2); diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test index 493f74ded3e..e40b84eb5cd 100644 --- a/mysql-test/t/blackhole.test +++ b/mysql-test/t/blackhole.test @@ -128,15 +128,3 @@ show binlog events; drop table t1,t2,t3; # End of 4.1 tests - -# -# BUG#10952 - alter table ... lost data without errors and warnings -# -drop table if exists t1; -create table t1 (c char(20)) engine=MyISAM; -insert into t1 values ("Monty"),("WAX"),("Walrus"); ---error 1031 -alter table t1 engine=blackhole; -drop table t1; - -# End of 5.0 tests diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 400279a826b..639129e1393 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -380,16 +380,6 @@ drop table t1, t2, t3; # End of 4.1 tests -# -# BUG#10952 - alter table ... lost data without errors and warnings -# -drop table if exists t1; -create table t1 (c char(20)) engine=MyISAM; -insert into t1 values ("Monty"),("WAX"),("Walrus"); ---error 1031 -alter table t1 engine=MERGE; -drop table t1; - # # BUG#19648 - Merge table does not work with bit types # diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc index 7632ed59949..2505919af39 100644 --- a/sql/ha_blackhole.cc +++ b/sql/ha_blackhole.cc @@ -47,7 +47,7 @@ handlerton blackhole_hton= { NULL, /* create_cursor_read_view */ NULL, /* set_cursor_read_view */ NULL, /* close_cursor_read_view */ - HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE + HTON_CAN_RECREATE }; /***************************************************************************** diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index d2fd1a9e28a..9780f163634 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -55,7 +55,7 @@ handlerton myisammrg_hton= { NULL, /* create_cursor_read_view */ NULL, /* set_cursor_read_view */ NULL, /* close_cursor_read_view */ - HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE + HTON_CAN_RECREATE }; diff --git a/sql/handler.h b/sql/handler.h index aada647e071..d444ac055c4 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -410,7 +410,6 @@ struct show_table_alias_st { #define HTON_ALTER_NOT_SUPPORTED (1 << 1) //Engine does not support alter #define HTON_CAN_RECREATE (1 << 2) //Delete all is used fro truncate #define HTON_HIDDEN (1 << 3) //Engine does not appear in lists -#define HTON_ALTER_CANNOT_CREATE (1 << 4) //Cannot use alter to create typedef struct st_thd_trans { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 91c71193df2..a4ac7392cf2 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3240,9 +3240,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, DBUG_PRINT("info", ("old type: %d new type: %d", old_db_type, new_db_type)); if (ha_check_storage_engine_flag(old_db_type, HTON_ALTER_NOT_SUPPORTED) || - ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED) || - (old_db_type != new_db_type && - ha_check_storage_engine_flag(new_db_type, HTON_ALTER_CANNOT_CREATE))) + ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED)) { DBUG_PRINT("info", ("doesn't support alter")); my_error(ER_ILLEGAL_HA, MYF(0), table_name); From 9c35a6e777ee581daebdbf62cd80fcbcd7c02563 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 10 Jul 2006 22:38:13 +0200 Subject: [PATCH 09/22] Raise the version number. --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index fe111b8a671..48454a11309 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.0.23) +AM_INIT_AUTOMAKE(mysql, 5.0.24) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -19,7 +19,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0 # ndb version NDB_VERSION_MAJOR=5 NDB_VERSION_MINOR=0 -NDB_VERSION_BUILD=23 +NDB_VERSION_BUILD=24 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? From 0859819aae7f1d3a8c784b5468e3cb3187dba64f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 11 Jul 2006 12:34:43 +0200 Subject: [PATCH 10/22] Raise the version number. --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 1605be324c8..192b35f56d8 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.0.24) +AM_INIT_AUTOMAKE(mysql, 5.0.25) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -19,7 +19,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0 # ndb version NDB_VERSION_MAJOR=5 NDB_VERSION_MINOR=0 -NDB_VERSION_BUILD=24 +NDB_VERSION_BUILD=25 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? From 0036ab8c9737ac3c75d191b313b6487ac2f80f66 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 18 Jul 2006 09:33:40 -0400 Subject: [PATCH 11/22] BUG#20340: NODEGROUP in information_schema.partitions integer => error in error log when "default is put into it NODEGROUP string to cater for "default" in it mysql-test/r/ndb_partition_key.result: New test case mysql-test/t/ndb_partition_key.test: New test case sql/sql_show.cc: NODEGROUP string to cater for "default" in it --- mysql-test/r/ndb_partition_key.result | 8 +++++++- mysql-test/t/ndb_partition_key.test | 5 ++++- sql/sql_show.cc | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/ndb_partition_key.result b/mysql-test/r/ndb_partition_key.result index fd793c4c2c7..e478c23ec00 100644 --- a/mysql-test/r/ndb_partition_key.result +++ b/mysql-test/r/ndb_partition_key.result @@ -194,6 +194,12 @@ c2 TEXT NOT NULL, c3 INT NOT NULL, PRIMARY KEY(c1,c3)) ENGINE=NDB -PARTITION BY KEY(c3); +PARTITION BY KEY(c3) +(PARTITION p0 NODEGROUP 0, PARTITION p1 NODEGROUP 0); ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1; +SELECT NODEGROUP,PARTITION_NAME FROM information_schema.partitions WHERE +table_name = "t1"; +NODEGROUP PARTITION_NAME +0 p0 +0 p1 DROP TABLE t1; diff --git a/mysql-test/t/ndb_partition_key.test b/mysql-test/t/ndb_partition_key.test index fb0581eb6f6..d8c1b61b94f 100644 --- a/mysql-test/t/ndb_partition_key.test +++ b/mysql-test/t/ndb_partition_key.test @@ -192,7 +192,10 @@ CREATE TABLE t1 ( c3 INT NOT NULL, PRIMARY KEY(c1,c3)) ENGINE=NDB - PARTITION BY KEY(c3); + PARTITION BY KEY(c3) + (PARTITION p0 NODEGROUP 0, PARTITION p1 NODEGROUP 0); ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1; +SELECT NODEGROUP,PARTITION_NAME FROM information_schema.partitions WHERE +table_name = "t1"; DROP TABLE t1; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index fa95e5e15bf..1a7547a5348 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -5482,7 +5482,7 @@ ST_FIELD_INFO partitions_fields_info[]= {"CHECK_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0}, {"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, 0}, {"PARTITION_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, 0}, - {"NODEGROUP", 21 , MYSQL_TYPE_LONG, 0, 0, 0}, + {"NODEGROUP", 12 , MYSQL_TYPE_STRING, 0, 0, 0}, {"TABLESPACE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0} }; From 4b2cde28077da28d1e9ff883c569f67725d8da14 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Jul 2006 14:49:58 +0200 Subject: [PATCH 12/22] ndb - bug#14935 fix storage/ndb/src/kernel/blocks/ERROR_codes.txt: if TUX update fails, need to abort op on tuple (5.1 specific) storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp: if TUX update fails, need to abort op on tuple (5.1 specific) storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp: if TUX update fails, need to abort op on tuple (5.1 specific) storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp: if TUX update fails, need to abort op on tuple (5.1 specific) storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp: if TUX update fails, need to abort op on tuple (5.1 specific) --- storage/ndb/src/kernel/blocks/ERROR_codes.txt | 5 ++++- storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp | 3 +++ storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp | 11 +++++++++-- .../ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp | 11 +++++++++++ .../ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp | 14 ++++++++++++++ 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/storage/ndb/src/kernel/blocks/ERROR_codes.txt b/storage/ndb/src/kernel/blocks/ERROR_codes.txt index 867dc0d2efc..3e35d5cf398 100644 --- a/storage/ndb/src/kernel/blocks/ERROR_codes.txt +++ b/storage/ndb/src/kernel/blocks/ERROR_codes.txt @@ -2,7 +2,7 @@ Next QMGR 1 Next NDBCNTR 1000 Next NDBFS 2000 Next DBACC 3002 -Next DBTUP 4013 +Next DBTUP 4024 Next DBLQH 5043 Next DBDICT 6007 Next DBDIH 7177 @@ -484,3 +484,6 @@ Dbtup: 4019 - handleInsert - Alloc rowid error 4020 - handleInsert - Size change error 4021 - handleInsert - Out of disk space + +4022 - addTuxEntries - fail before add of first entry +4023 - addTuxEntries - fail add of last entry (the entry for last index) diff --git a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp index 3cf62fe08ec..0a1e1163635 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp +++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp @@ -2156,6 +2156,9 @@ private: //------------------------------------------------------------------ void tupkeyErrorLab(Signal* signal); + // need flag to skip TUX indexes + void do_tup_abortreq(Signal*, Uint32 flags); + //------------------------------------------------------------------ //------------------------------------------------------------------ // Methods to handle execution of TUP_COMMITREQ + TUP_ABORTREQ. diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp index aa55985c1f2..a8170f2897f 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp @@ -62,6 +62,11 @@ void Dbtup::freeAttrinbufrec(Uint32 anAttrBuf) * Abort abort this operation and all after (nextActiveOp's) */ void Dbtup::execTUP_ABORTREQ(Signal* signal) +{ + do_tup_abortreq(signal, 0); +} + +void Dbtup::do_tup_abortreq(Signal* signal, Uint32 flags) { OperationrecPtr regOperPtr; FragrecordPtr regFragPtr; @@ -91,7 +96,8 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal) if (get_tuple_state(regOperPtr.p) == TUPLE_PREPARED) { ljam(); - if (!regTabPtr.p->tuxCustomTriggers.isEmpty()) + if (!regTabPtr.p->tuxCustomTriggers.isEmpty() && + (flags & 0x1) == 0) executeTuxAbortTriggers(signal, regOperPtr.p, regFragPtr.p, @@ -103,7 +109,8 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal) ljam(); c_operation_pool.getPtr(loopOpPtr); if (get_tuple_state(loopOpPtr.p) != TUPLE_ALREADY_ABORTED && - !regTabPtr.p->tuxCustomTriggers.isEmpty()) { + !regTabPtr.p->tuxCustomTriggers.isEmpty() && + (flags & 0x1) == 0) { ljam(); executeTuxAbortTriggers(signal, loopOpPtr.p, diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp index 3021799fd11..9cf48291a94 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp @@ -747,6 +747,12 @@ void Dbtup::execTUPKEYREQ(Signal* signal) regFragPtr, regTabPtr) != 0) { jam(); + /* + * undo the change before tupkeyErrorLab resets the op + * assume no timeslicing can occur even with diskdata + */ + signal->theData[0] = operPtr.i; + do_tup_abortreq(signal, 0x1); tupkeyErrorLab(signal); return; } @@ -775,6 +781,11 @@ void Dbtup::execTUPKEYREQ(Signal* signal) regFragPtr, regTabPtr) != 0) { jam(); + /* + * see insert case + */ + signal->theData[0] = operPtr.i; + do_tup_abortreq(signal, 0x1); tupkeyErrorLab(signal); return; } diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp index 62cd1f06157..0e1b251d8a5 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp @@ -1111,6 +1111,12 @@ Dbtup::addTuxEntries(Signal* signal, Operationrec* regOperPtr, Tablerec* regTabPtr) { + if (ERROR_INSERTED(4022)) { + ljam(); + CLEAR_ERROR_INSERT_VALUE; + terrorCode = 9999; + return -1; + } TuxMaintReq* const req = (TuxMaintReq*)signal->getDataPtrSend(); const DLList& triggerList = regTabPtr->tuxCustomTriggers; TriggerPtr triggerPtr; @@ -1120,6 +1126,14 @@ Dbtup::addTuxEntries(Signal* signal, ljam(); req->indexId = triggerPtr.p->indexId; req->errorCode = RNIL; + if (ERROR_INSERTED(4023) && + ! triggerList.hasNext(triggerPtr)) { + ljam(); + CLEAR_ERROR_INSERT_VALUE; + terrorCode = 9999; + failPtrI = triggerPtr.i; + goto fail; + } EXECUTE_DIRECT(DBTUX, GSN_TUX_MAINT_REQ, signal, TuxMaintReq::SignalLength); ljamEntry(); From d3b743ae18801473af91d13a83297bcc0b02fae0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Jul 2006 05:28:16 -0400 Subject: [PATCH 13/22] BUG20733: Bug in partition pruning with zerofill field Problem was with handling NULL values in ranges mysql-test/r/partition_hash.result: New partition pruning test cases mysql-test/r/partition_list.result: New partition pruning test cases mysql-test/r/partition_pruning.result: New partition pruning test cases mysql-test/r/partition_range.result: New partition pruning test cases mysql-test/t/partition_hash.test: New partition pruning test cases mysql-test/t/partition_list.test: New partition pruning test cases mysql-test/t/partition_pruning.test: New partition pruning test cases mysql-test/t/partition_range.test: New partition pruning test cases sql/opt_range.cc: Added comment sql/sql_partition.cc: Partition pruning didn't handle ranges with NULL values in a proper manner --- mysql-test/r/partition_hash.result | 84 ++++++++++++++++++++++++ mysql-test/r/partition_list.result | 94 +++++++++++++++++++++++++++ mysql-test/r/partition_pruning.result | 78 ++++++++++++++++++++++ mysql-test/r/partition_range.result | 78 ++++++++++++++++++++++ mysql-test/t/partition_hash.test | 30 +++++++++ mysql-test/t/partition_list.test | 44 +++++++++++++ mysql-test/t/partition_pruning.test | 52 +++++++++++++++ mysql-test/t/partition_range.test | 44 +++++++++++++ sql/opt_range.cc | 7 +- sql/sql_partition.cc | 11 ++++ 10 files changed, 521 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result index 08faccd024e..9a82a36d902 100644 --- a/mysql-test/r/partition_hash.result +++ b/mysql-test/r/partition_hash.result @@ -1,4 +1,88 @@ drop table if exists t1; +create table t1 (a int unsigned) +partition by hash(a div 2) +partitions 4; +insert into t1 values (null),(0),(1),(2),(3),(4),(5),(6),(7); +select * from t1 where a < 0; +a +select * from t1 where a is null or (a >= 5 and a <= 7); +a +NULL +5 +6 +7 +select * from t1 where a is null; +a +NULL +select * from t1 where a is not null; +a +0 +1 +2 +3 +4 +5 +6 +7 +select * from t1 where a >= 1 and a < 3; +a +1 +2 +select * from t1 where a >= 3 and a <= 5; +a +3 +4 +5 +select * from t1 where a > 2 and a < 4; +a +3 +select * from t1 where a > 3 and a <= 6; +a +4 +5 +6 +select * from t1 where a > 5; +a +6 +7 +select * from t1 where a >= 1 and a <= 5; +a +1 +2 +3 +4 +5 +explain partitions select * from t1 where a < 0; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where +explain partitions select * from t1 where a is null or (a >= 5 and a <= 7); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL 7 Using where +explain partitions select * from t1 where a is null; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 Using where +explain partitions select * from t1 where a is not null; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where +explain partitions select * from t1 where a >= 1 and a < 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 5 Using where +explain partitions select * from t1 where a >= 3 and a <= 5; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 4 Using where +explain partitions select * from t1 where a > 2 and a < 4; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t1 where a > 3 and a <= 6; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 4 Using where +explain partitions select * from t1 where a > 5; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where +explain partitions select * from t1 where a >= 1 and a <= 5; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where +drop table t1; CREATE TABLE t1 ( a int not null, b int not null, diff --git a/mysql-test/r/partition_list.result b/mysql-test/r/partition_list.result index c722a3c6be3..e64a7a8d154 100644 --- a/mysql-test/r/partition_list.result +++ b/mysql-test/r/partition_list.result @@ -1,4 +1,98 @@ drop table if exists t1; +create table t1 (a int unsigned) +partition by list (a) +(partition p0 values in (0), +partition p1 values in (1), +partition pnull values in (null), +partition p2 values in (2)); +insert into t1 values (null),(0),(1),(2); +select * from t1 where a < 2; +a +0 +1 +select * from t1 where a <= 0; +a +0 +select * from t1 where a < 1; +a +0 +select * from t1 where a > 0; +a +1 +2 +select * from t1 where a > 1; +a +2 +select * from t1 where a >= 0; +a +0 +1 +2 +select * from t1 where a >= 1; +a +1 +2 +select * from t1 where a is null; +a +NULL +select * from t1 where a is not null; +a +0 +1 +2 +select * from t1 where a is null or a > 0; +a +1 +NULL +2 +drop table t1; +create table t1 (a int unsigned, b int) +partition by list (a) +subpartition by hash (b) +subpartitions 2 +(partition p0 values in (0), +partition p1 values in (1), +partition pnull values in (null, 2), +partition p3 values in (3)); +insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1); +insert into t1 values (2,0),(2,1),(3,0),(3,1); +explain partitions select * from t1 where a is null; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 Using where +select * from t1 where a is null; +a b +NULL 0 +NULL 1 +explain partitions select * from t1 where a = 2; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 Using where +select * from t1 where a = 2; +a b +2 0 +2 1 +select * from t1 where a <= 0; +a b +0 0 +0 1 +select * from t1 where a < 3; +a b +0 0 +0 1 +1 0 +1 1 +2 0 +2 1 +select * from t1 where a >= 1 or a is null; +a b +1 0 +1 1 +NULL 0 +2 0 +NULL 1 +2 1 +3 0 +3 1 +drop table t1; CREATE TABLE t1 ( a int not null, b int not null, diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index ee294242bf7..bf7888bfd99 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -149,6 +149,48 @@ id select_type table partitions type possible_keys key key_len ref rows Extra explain partitions select * from t6 where a > 3 and a < 5; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +drop table t6; +create table t6 (a int unsigned not null) partition by LIST(a) ( +partition p1 values in (1), +partition p3 values in (3), +partition p5 values in (5), +partition p7 values in (7), +partition p9 values in (9) +); +insert into t6 values (1),(3),(5); +explain partitions select * from t6 where a < 1; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t6 where a <= 1; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t6 p1 system NULL NULL NULL NULL 1 +explain partitions select * from t6 where a > 9; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t6 where a >= 9; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t6 where a > 0 and a < 5; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t6 p1,p3 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t6 where a > 5 and a < 12; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t6 where a > 3 and a < 8 ; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t6 p5,p7 system NULL NULL NULL NULL 1 +explain partitions select * from t6 where a >= 0 and a <= 5; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t6 p1,p3,p5 ALL NULL NULL NULL NULL 3 Using where +explain partitions select * from t6 where a >= 5 and a <= 12; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1 +explain partitions select * from t6 where a >= 3 and a <= 8; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t6 where a > 3 and a < 5; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables create table t7 (a int not null) partition by RANGE(a) ( partition p10 values less than (10), partition p30 values less than (30), @@ -184,6 +226,42 @@ id select_type table partitions type possible_keys key key_len ref rows Extra explain partitions select * from t7 where a > 11 and a < 29; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +drop table t7; +create table t7 (a int unsigned not null) partition by RANGE(a) ( +partition p10 values less than (10), +partition p30 values less than (30), +partition p50 values less than (50), +partition p70 values less than (70), +partition p90 values less than (90) +); +insert into t7 values (10),(30),(50); +explain partitions select * from t7 where a < 5; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t7 where a < 10; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t7 where a <= 10; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t7 p10,p30 system NULL NULL NULL NULL 1 +explain partitions select * from t7 where a = 10; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t7 p30 system NULL NULL NULL NULL 1 +explain partitions select * from t7 where a < 90; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +explain partitions select * from t7 where a = 90; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t7 where a > 90; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t7 where a >= 90; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t7 where a > 11 and a < 29; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables create table t8 (a date not null) partition by RANGE(YEAR(a)) ( partition p0 values less than (1980), partition p1 values less than (1990), diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index 9123c894f32..9812c80040b 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -1,4 +1,82 @@ drop table if exists t1; +create table t1 (a int unsigned) +partition by range (a) +(partition pnull values less than (0), +partition p0 values less than (1), +partition p1 values less than(2)); +insert into t1 values (null),(0),(1); +select * from t1 where a is null; +a +NULL +select * from t1 where a >= 0; +a +0 +1 +select * from t1 where a < 0; +a +select * from t1 where a <= 0; +a +0 +select * from t1 where a > 1; +a +explain partitions select * from t1 where a is null; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 pnull system NULL NULL NULL NULL 1 +explain partitions select * from t1 where a >= 0; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t1 where a < 0; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t1 where a <= 0; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t1 where a > 1; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +drop table t1; +create table t1 (a int unsigned, b int unsigned) +partition by range (a) +subpartition by hash (b) +subpartitions 2 +(partition pnull values less than (0), +partition p0 values less than (1), +partition p1 values less than(2)); +insert into t1 values (null,0),(null,1),(0,0),(0,1),(1,0),(1,1); +select * from t1 where a is null; +a b +NULL 0 +NULL 1 +select * from t1 where a >= 0; +a b +0 0 +0 1 +1 0 +1 1 +select * from t1 where a < 0; +a b +select * from t1 where a <= 0; +a b +0 0 +0 1 +select * from t1 where a > 1; +a b +explain partitions select * from t1 where a is null; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t1 where a >= 0; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where +explain partitions select * from t1 where a < 0; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t1 where a <= 0; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where +explain partitions select * from t1 where a > 1; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 2 Using where +drop table t1; CREATE TABLE t1 ( a int not null, b int not null, diff --git a/mysql-test/t/partition_hash.test b/mysql-test/t/partition_hash.test index 8494de98371..3304f30fb1a 100644 --- a/mysql-test/t/partition_hash.test +++ b/mysql-test/t/partition_hash.test @@ -9,6 +9,36 @@ drop table if exists t1; --enable_warnings +# +# More partition pruning tests, especially on interval walking +# +create table t1 (a int unsigned) +partition by hash(a div 2) +partitions 4; +insert into t1 values (null),(0),(1),(2),(3),(4),(5),(6),(7); +select * from t1 where a < 0; +select * from t1 where a is null or (a >= 5 and a <= 7); +select * from t1 where a is null; +select * from t1 where a is not null; +select * from t1 where a >= 1 and a < 3; +select * from t1 where a >= 3 and a <= 5; +select * from t1 where a > 2 and a < 4; +select * from t1 where a > 3 and a <= 6; +select * from t1 where a > 5; +select * from t1 where a >= 1 and a <= 5; +explain partitions select * from t1 where a < 0; +explain partitions select * from t1 where a is null or (a >= 5 and a <= 7); +explain partitions select * from t1 where a is null; +explain partitions select * from t1 where a is not null; +explain partitions select * from t1 where a >= 1 and a < 3; +explain partitions select * from t1 where a >= 3 and a <= 5; +explain partitions select * from t1 where a > 2 and a < 4; +explain partitions select * from t1 where a > 3 and a <= 6; +explain partitions select * from t1 where a > 5; +explain partitions select * from t1 where a >= 1 and a <= 5; + +drop table t1; + # # Partition by hash, basic # diff --git a/mysql-test/t/partition_list.test b/mysql-test/t/partition_list.test index e243ec468e1..1e420cfe6ed 100644 --- a/mysql-test/t/partition_list.test +++ b/mysql-test/t/partition_list.test @@ -9,6 +9,49 @@ drop table if exists t1; --enable_warnings +# +# Bug 20733: Zerofill columns gives wrong result with partitioned tables +# +create table t1 (a int unsigned) +partition by list (a) +(partition p0 values in (0), + partition p1 values in (1), + partition pnull values in (null), + partition p2 values in (2)); + +insert into t1 values (null),(0),(1),(2); +select * from t1 where a < 2; +select * from t1 where a <= 0; +select * from t1 where a < 1; +select * from t1 where a > 0; +select * from t1 where a > 1; +select * from t1 where a >= 0; +select * from t1 where a >= 1; +select * from t1 where a is null; +select * from t1 where a is not null; +select * from t1 where a is null or a > 0; +drop table t1; + +create table t1 (a int unsigned, b int) +partition by list (a) +subpartition by hash (b) +subpartitions 2 +(partition p0 values in (0), + partition p1 values in (1), + partition pnull values in (null, 2), + partition p3 values in (3)); +insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1); +insert into t1 values (2,0),(2,1),(3,0),(3,1); + +explain partitions select * from t1 where a is null; +select * from t1 where a is null; +explain partitions select * from t1 where a = 2; +select * from t1 where a = 2; +select * from t1 where a <= 0; +select * from t1 where a < 3; +select * from t1 where a >= 1 or a is null; +drop table t1; + # # Test ordinary list partitioning that it works ok # @@ -136,3 +179,4 @@ insert into t1 values (null); select * from t1; drop table t1; + diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 976466e1578..dd79e8d3acb 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -137,6 +137,32 @@ explain partitions select * from t6 where a >= 3 and a <= 8; explain partitions select * from t6 where a > 3 and a < 5; +drop table t6; + +create table t6 (a int unsigned not null) partition by LIST(a) ( + partition p1 values in (1), + partition p3 values in (3), + partition p5 values in (5), + partition p7 values in (7), + partition p9 values in (9) +); +insert into t6 values (1),(3),(5); + +explain partitions select * from t6 where a < 1; +explain partitions select * from t6 where a <= 1; +explain partitions select * from t6 where a > 9; +explain partitions select * from t6 where a >= 9; + +explain partitions select * from t6 where a > 0 and a < 5; +explain partitions select * from t6 where a > 5 and a < 12; +explain partitions select * from t6 where a > 3 and a < 8 ; + +explain partitions select * from t6 where a >= 0 and a <= 5; +explain partitions select * from t6 where a >= 5 and a <= 12; +explain partitions select * from t6 where a >= 3 and a <= 8; + +explain partitions select * from t6 where a > 3 and a < 5; + # RANGE(field) partitioning, interval analysis. create table t7 (a int not null) partition by RANGE(a) ( partition p10 values less than (10), @@ -162,6 +188,32 @@ explain partitions select * from t7 where a >= 90; # misc intervals explain partitions select * from t7 where a > 11 and a < 29; +drop table t7; + +create table t7 (a int unsigned not null) partition by RANGE(a) ( + partition p10 values less than (10), + partition p30 values less than (30), + partition p50 values less than (50), + partition p70 values less than (70), + partition p90 values less than (90) +); +insert into t7 values (10),(30),(50); + +# leftmost intervals +explain partitions select * from t7 where a < 5; +explain partitions select * from t7 where a < 10; +explain partitions select * from t7 where a <= 10; +explain partitions select * from t7 where a = 10; + +#rightmost intervals +explain partitions select * from t7 where a < 90; +explain partitions select * from t7 where a = 90; +explain partitions select * from t7 where a > 90; +explain partitions select * from t7 where a >= 90; + +# misc intervals +explain partitions select * from t7 where a > 11 and a < 29; + # LIST(monontonic_func) partitioning create table t8 (a date not null) partition by RANGE(YEAR(a)) ( partition p0 values less than (1980), diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test index 38142a9d485..670b9333ab9 100644 --- a/mysql-test/t/partition_range.test +++ b/mysql-test/t/partition_range.test @@ -9,6 +9,50 @@ drop table if exists t1; --enable_warnings +# +# More checks for partition pruning +# +create table t1 (a int unsigned) +partition by range (a) +(partition pnull values less than (0), + partition p0 values less than (1), + partition p1 values less than(2)); +insert into t1 values (null),(0),(1); + +select * from t1 where a is null; +select * from t1 where a >= 0; +select * from t1 where a < 0; +select * from t1 where a <= 0; +select * from t1 where a > 1; +explain partitions select * from t1 where a is null; +explain partitions select * from t1 where a >= 0; +explain partitions select * from t1 where a < 0; +explain partitions select * from t1 where a <= 0; +explain partitions select * from t1 where a > 1; +drop table t1; + +create table t1 (a int unsigned, b int unsigned) +partition by range (a) +subpartition by hash (b) +subpartitions 2 +(partition pnull values less than (0), + partition p0 values less than (1), + partition p1 values less than(2)); +insert into t1 values (null,0),(null,1),(0,0),(0,1),(1,0),(1,1); + +select * from t1 where a is null; +select * from t1 where a >= 0; +select * from t1 where a < 0; +select * from t1 where a <= 0; +select * from t1 where a > 1; +explain partitions select * from t1 where a is null; +explain partitions select * from t1 where a >= 0; +explain partitions select * from t1 where a < 0; +explain partitions select * from t1 where a <= 0; +explain partitions select * from t1 where a > 1; + +drop table t1; + # # Partition by range, basic # diff --git a/sql/opt_range.cc b/sql/opt_range.cc index d62cb134209..956e23a09aa 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3203,7 +3203,12 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar) ppar->is_part_keypart[part]= !in_subpart_fields; ppar->is_subpart_keypart[part]= in_subpart_fields; - + + /* + Check if this was last field in this array, in this case we + switch to subpartitioning fields. (This will only happens if + there are subpartitioning fields to cater for). + */ if (!*(++field)) { field= part_info->subpart_field_array; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 44c0b8ffcd9..3f1572ee676 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -2415,6 +2415,10 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info, bool unsigned_flag= part_info->part_expr->unsigned_flag; DBUG_ENTER("get_list_array_idx_for_endpoint"); + if (part_info->part_expr->null_value) + { + DBUG_RETURN(0); + } if (unsigned_flag) part_func_value-= 0x8000000000000000ULL; DBUG_ASSERT(part_info->no_list_values); @@ -2539,6 +2543,13 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info, bool unsigned_flag= part_info->part_expr->unsigned_flag; DBUG_ENTER("get_partition_id_range_for_endpoint"); + if (part_info->part_expr->null_value) + { + uint32 ret_part_id= 0; + if (!left_endpoint && include_endpoint) + ret_part_id= 1; + DBUG_RETURN(ret_part_id); + } if (unsigned_flag) part_func_value-= 0x8000000000000000ULL; while (max_part_id > min_part_id) From 4cda13c9db47e01095431a62cfdc8c1252083028 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 22 Jul 2006 11:27:45 -0400 Subject: [PATCH 14/22] BUG#20340: NODEGROUP wrong field type in information schema Test case fix mysql-test/r/information_schema_part.result: Test case fix --- mysql-test/r/information_schema_part.result | 48 ++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/mysql-test/r/information_schema_part.result b/mysql-test/r/information_schema_part.result index 2fd241ed4e4..6ba980e0f21 100644 --- a/mysql-test/r/information_schema_part.result +++ b/mysql-test/r/information_schema_part.result @@ -7,9 +7,9 @@ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3); select * from information_schema.partitions where table_schema="test" and table_name="t1"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 x1 NULL 1 NULL LIST NULL b*a NULL 1 0 0 0 # 1024 0 # # NULL NULL default 0 ts1 -NULL test t1 x2 NULL 2 NULL LIST NULL b*a NULL 3,11,5,7 0 0 0 # 1024 0 # # NULL NULL default 0 ts2 -NULL test t1 x3 NULL 3 NULL LIST NULL b*a NULL 16,8,24,27 0 0 0 # 1024 0 # # NULL NULL default 0 ts3 +NULL test t1 x1 NULL 1 NULL LIST NULL b*a NULL 1 0 0 0 # 1024 0 # # NULL NULL default default ts1 +NULL test t1 x2 NULL 2 NULL LIST NULL b*a NULL 3,11,5,7 0 0 0 # 1024 0 # # NULL NULL default default ts2 +NULL test t1 x3 NULL 3 NULL LIST NULL b*a NULL 16,8,24,27 0 0 0 # 1024 0 # # NULL NULL default default ts3 create table t2 (a int not null,b int not null,c int not null, primary key(a,b)) partition by range (a) partitions 3 @@ -19,27 +19,27 @@ partition x3 values less than maxvalue tablespace ts3); select * from information_schema.partitions where table_schema="test" and table_name="t2"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t2 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 1024 0 # # NULL NULL default 0 ts1 -NULL test t2 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 1024 0 # # NULL NULL default 0 ts2 -NULL test t2 x3 NULL 3 NULL RANGE NULL a NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default 0 ts3 +NULL test t2 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 1024 0 # # NULL NULL default default ts1 +NULL test t2 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 1024 0 # # NULL NULL default default ts2 +NULL test t2 x3 NULL 3 NULL RANGE NULL a NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default default ts3 create table t3 (f1 date) partition by hash(month(f1)) partitions 3; select * from information_schema.partitions where table_schema="test" and table_name="t3"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t3 p0 NULL 1 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default -NULL test t3 p1 NULL 2 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default -NULL test t3 p2 NULL 3 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default +NULL test t3 p0 NULL 1 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default +NULL test t3 p1 NULL 2 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default +NULL test t3 p2 NULL 3 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default create table t4 (f1 date, f2 int) partition by key(f1,f2) partitions 3; select * from information_schema.partitions where table_schema="test" and table_name="t4"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t4 p0 NULL 1 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default -NULL test t4 p1 NULL 2 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default -NULL test t4 p2 NULL 3 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default +NULL test t4 p0 NULL 1 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default +NULL test t4 p1 NULL 2 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default +NULL test t4 p2 NULL 3 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default drop table t1,t2,t3,t4; create table t1 (a int not null,b int not null,c int not null,primary key (a,b)) partition by range (a) @@ -63,14 +63,14 @@ subpartition x22 tablespace t2) ); select * from information_schema.partitions where table_schema="test"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 x1 x11 1 1 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default 0 t1 -NULL test t1 x1 x12 1 2 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default 0 t2 -NULL test t1 x2 x21 2 1 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default 0 t1 -NULL test t1 x2 x22 2 2 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default 0 t2 -NULL test t2 x1 x11 1 1 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default 0 t1 -NULL test t2 x1 x12 1 2 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default 0 t2 -NULL test t2 x2 x21 2 1 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default 0 t1 -NULL test t2 x2 x22 2 2 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default 0 t2 +NULL test t1 x1 x11 1 1 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default default t1 +NULL test t1 x1 x12 1 2 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default default t2 +NULL test t1 x2 x21 2 1 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default default t1 +NULL test t1 x2 x22 2 2 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default default t2 +NULL test t2 x1 x11 1 1 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default default t1 +NULL test t2 x1 x12 1 2 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default default t2 +NULL test t2 x2 x21 2 1 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default default t1 +NULL test t2 x2 x22 2 2 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default default t2 drop table t1,t2; create table t1 ( a int not null, @@ -99,7 +99,7 @@ drop table t1; create table t1(f1 int, f2 int); select * from information_schema.partitions where table_schema="test"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 NULL NULL NULL NULL NULL NULL NULL NULL NULL 0 0 0 # 1024 0 # # NULL NULL 0 +NULL test t1 NULL NULL NULL NULL NULL NULL NULL NULL NULL 0 0 0 # 1024 0 # # NULL NULL drop table t1; create table t1 (f1 date) partition by linear hash(month(f1)) @@ -107,9 +107,9 @@ partitions 3; select * from information_schema.partitions where table_schema="test" and table_name="t1"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 p0 NULL 1 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default -NULL test t1 p1 NULL 2 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default -NULL test t1 p2 NULL 3 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default +NULL test t1 p0 NULL 1 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default +NULL test t1 p1 NULL 2 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default +NULL test t1 p2 NULL 3 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default drop table t1; create table t1 (a int) PARTITION BY RANGE (a) From 0a32f0626013ebd40e4da0a8e914b3a1e4bfe0f4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 22 Jul 2006 13:37:14 -0400 Subject: [PATCH 15/22] BUG#20340: NODEGROUP wrong field type in partitions information schema table Fixes for change that makes default appear in NODEGROUP as it should be instead of 0 which is an error mysql-test/r/ndb_dd_backuprestore.result: Fixes for change that makes default appear in NODEGROUP as it should be instead of 0 which is an error mysql-test/r/ndb_partition_range.result: Fixes for change that makes default appear in NODEGROUP as it should be instead of 0 which is an error --- mysql-test/r/ndb_dd_backuprestore.result | 60 ++++++++++++------------ mysql-test/r/ndb_partition_range.result | 6 +-- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/mysql-test/r/ndb_dd_backuprestore.result b/mysql-test/r/ndb_dd_backuprestore.result index cb6c62b16da..705881ee20a 100644 --- a/mysql-test/r/ndb_dd_backuprestore.result +++ b/mysql-test/r/ndb_dd_backuprestore.result @@ -223,31 +223,31 @@ t6 CREATE TABLE `t6` ( ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) */ SELECT * FROM information_schema.partitions WHERE table_name= 't1'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT * FROM information_schema.partitions WHERE table_name= 't2'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT * FROM information_schema.partitions WHERE table_name= 't3'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT * FROM information_schema.partitions WHERE table_name= 't4'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT * FROM information_schema.partitions WHERE table_name= 't5'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT * FROM information_schema.partitions WHERE table_name= 't6'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT COUNT(*) FROM test.t1; COUNT(*) 250 @@ -389,31 +389,31 @@ t6 CREATE TABLE `t6` ( ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) */ SELECT * FROM information_schema.partitions WHERE table_name= 't1'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT * FROM information_schema.partitions WHERE table_name= 't2'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT * FROM information_schema.partitions WHERE table_name= 't3'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT * FROM information_schema.partitions WHERE table_name= 't4'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT * FROM information_schema.partitions WHERE table_name= 't5'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT * FROM information_schema.partitions WHERE table_name= 't6'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default -NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default +NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default +NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default SELECT COUNT(*) FROM test.t1; COUNT(*) 250 diff --git a/mysql-test/r/ndb_partition_range.result b/mysql-test/r/ndb_partition_range.result index 9cc9aa2cda9..f4bae479239 100644 --- a/mysql-test/r/ndb_partition_range.result +++ b/mysql-test/r/ndb_partition_range.result @@ -17,9 +17,9 @@ INSERT into t1 values (10, 1, 1); INSERT into t1 values (15, 1, 1); select * from information_schema.partitions where table_name= 't1'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -NULL test t1 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 0 0 # # NULL NULL default 0 default -NULL test t1 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 0 0 # # NULL NULL default 0 default -NULL test t1 x3 NULL 3 NULL RANGE NULL a NULL 20 0 0 0 # 0 0 # # NULL NULL default 0 default +NULL test t1 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 0 0 # # NULL NULL default default default +NULL test t1 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 0 0 # # NULL NULL default default default +NULL test t1 x3 NULL 3 NULL RANGE NULL a NULL 20 0 0 0 # 0 0 # # NULL NULL default default default select * from t1 order by a; a b c 1 1 1 From 7b2cabd902d3b6c669bd8a0302aaf8b7568cad06 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 Jul 2006 09:38:42 +1000 Subject: [PATCH 16/22] BUG#20294 Instance manager test im_instance_conf fails randomly (well, im_options in this case, but using existing bug report) mysql-test/t/disabled.def: disable im_options test as it's non-deterministic. reopen bug --- mysql-test/t/disabled.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 81eb7e6d35c..c6631485b3a 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -14,7 +14,7 @@ #events : BUG#17619 2006-02-21 andrey Race conditions #events_scheduling : BUG#19170 2006-04-26 andrey Test case of 19170 fails on some platforms. Has to be checked. #im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly -#im_options : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly +im_options : Bug#20294 2006-07-24 stewart Instance manager test im_instance_conf fails randomly #im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog From 79ebad89c602368094aa506b69ec4c51f857f56e Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 Jul 2006 10:53:26 +0200 Subject: [PATCH 17/22] After merge fix --- sql/ha_myisammrg.cc | 2 +- storage/blackhole/ha_blackhole.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index afeed5f79df..6be714dc2e3 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -555,7 +555,7 @@ static int myisammrg_init() myisammrg_hton.db_type=DB_TYPE_MRG_MYISAM; myisammrg_hton.create=myisammrg_create_handler; myisammrg_hton.panic=myrg_panic; - myisammrg_hton.flags= HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE; + myisammrg_hton.flags= HTON_CAN_RECREATE; return 0; } diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index 1a2bb264ef9..d22d9372e0d 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -206,7 +206,7 @@ static int blackhole_init() blackhole_hton.state= SHOW_OPTION_YES; blackhole_hton.db_type= DB_TYPE_BLACKHOLE_DB; blackhole_hton.create= blackhole_create_handler; - blackhole_hton.flags= HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE; + blackhole_hton.flags= HTON_CAN_RECREATE; return 0; } From 99a4775cd403990475a11d25979c1ef4856cb9c6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 Jul 2006 11:02:13 +0200 Subject: [PATCH 18/22] After merge fix --- mysql-test/extra/binlog_tests/blackhole.test | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test index 543f99936b6..78f3cf08e70 100644 --- a/mysql-test/extra/binlog_tests/blackhole.test +++ b/mysql-test/extra/binlog_tests/blackhole.test @@ -147,14 +147,4 @@ set autocommit=1; --replace_regex /table_id: [0-9]+/table_id: #/ show binlog events; -# -# BUG#10952 - alter table ... lost data without errors and warnings -# -drop table if exists t1; -create table t1 (c char(20)) engine=MyISAM; -insert into t1 values ("Monty"),("WAX"),("Walrus"); ---error 1031 -alter table t1 engine=blackhole; -drop table t1; - # End of 5.0 tests From 87acac5f65663ca03d3291a92cdd41c0fca1ae7b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 Jul 2006 13:34:30 +0200 Subject: [PATCH 19/22] After merge fix --- mysql-test/extra/binlog_tests/blackhole.test | 1 + mysql-test/r/binlog_row_blackhole.result | 5 ----- mysql-test/r/binlog_stm_blackhole.result | 5 ----- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test index 78f3cf08e70..cad4380a374 100644 --- a/mysql-test/extra/binlog_tests/blackhole.test +++ b/mysql-test/extra/binlog_tests/blackhole.test @@ -146,5 +146,6 @@ set autocommit=1; --replace_column 2 # 5 # --replace_regex /table_id: [0-9]+/table_id: #/ show binlog events; +drop table if exists t1; # End of 5.0 tests diff --git a/mysql-test/r/binlog_row_blackhole.result b/mysql-test/r/binlog_row_blackhole.result index 29738fcf426..12965e5788c 100644 --- a/mysql-test/r/binlog_row_blackhole.result +++ b/mysql-test/r/binlog_row_blackhole.result @@ -141,8 +141,3 @@ master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `test`; COMMIT drop table if exists t1; -create table t1 (c char(20)) engine=MyISAM; -insert into t1 values ("Monty"),("WAX"),("Walrus"); -alter table t1 engine=blackhole; -ERROR HY000: Table storage engine for 't1' doesn't have this option -drop table t1; diff --git a/mysql-test/r/binlog_stm_blackhole.result b/mysql-test/r/binlog_stm_blackhole.result index 3f4b058003b..6d4785e5644 100644 --- a/mysql-test/r/binlog_stm_blackhole.result +++ b/mysql-test/r/binlog_stm_blackhole.result @@ -141,8 +141,3 @@ master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Query 1 # use `test`; insert into t1 values(1) master-bin.000001 # Query 1 # use `test`; COMMIT drop table if exists t1; -create table t1 (c char(20)) engine=MyISAM; -insert into t1 values ("Monty"),("WAX"),("Walrus"); -alter table t1 engine=blackhole; -ERROR HY000: Table storage engine for 't1' doesn't have this option -drop table t1; From e9af03d328cc462d6ad79e02f4397d8abb4c64ba Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Jul 2006 18:37:35 +0200 Subject: [PATCH 20/22] Disabled ndb_binlog_ignore_db for BUG 21279. --- mysql-test/t/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index c6631485b3a..b4f4f85dfe6 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -18,6 +18,7 @@ im_options : Bug#20294 2006-07-24 stewart Instance manager test #im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog +ndb_binlog_ignore_db : BUG#21279 2006-07-25 ingo Randomly throws a warning ndb_load : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open From bf1f1ea8d813057c786dbc7caa163ce75fd675e9 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Jul 2006 11:50:13 +0200 Subject: [PATCH 21/22] Disabled ndb_restore_compat for BUG#21283. --- mysql-test/t/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index b4f4f85dfe6..81e20585fa9 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -20,6 +20,7 @@ ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_binlog_ignore_db : BUG#21279 2006-07-25 ingo Randomly throws a warning ndb_load : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed +ndb_restore_compat : BUG#21283 2006-07-26 ingo Test fails randomly partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated From 743c4d99739b7c5097abe3757cd30ebc8b853b8a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Jul 2006 20:03:41 +0200 Subject: [PATCH 22/22] ndb - bug#14935 - post-review storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp: bug#14935 - post-review storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp: bug#14935 - post-review storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp: bug#14935 - post-review --- storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp | 4 ++-- .../ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp | 6 +++--- .../src/kernel/blocks/dbtup/DbtupExecQuery.cpp | 18 +++++++++++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp index 0a1e1163635..2b2810008e6 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp +++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp @@ -254,6 +254,8 @@ inline const Uint32* ALIGN_WORD(const void* ptr) #define ZSTORED_PROCEDURE_FREE 0xffff #define ZMIN_PAGE_LIMIT_TUP_COMMITREQ 2 +#define ZSKIP_TUX_TRIGGERS 0x1 // flag for TUP_ABORTREQ + #endif class Dbtup: public SimulatedBlock { @@ -2155,8 +2157,6 @@ private: //------------------------------------------------------------------ //------------------------------------------------------------------ void tupkeyErrorLab(Signal* signal); - - // need flag to skip TUX indexes void do_tup_abortreq(Signal*, Uint32 flags); //------------------------------------------------------------------ diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp index a8170f2897f..16c51f7aa6e 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp @@ -63,6 +63,7 @@ void Dbtup::freeAttrinbufrec(Uint32 anAttrBuf) */ void Dbtup::execTUP_ABORTREQ(Signal* signal) { + ljamEntry(); do_tup_abortreq(signal, 0); } @@ -72,7 +73,6 @@ void Dbtup::do_tup_abortreq(Signal* signal, Uint32 flags) FragrecordPtr regFragPtr; TablerecPtr regTabPtr; - ljamEntry(); regOperPtr.i = signal->theData[0]; c_operation_pool.getPtr(regOperPtr); TransState trans_state= get_trans_state(regOperPtr.p); @@ -97,7 +97,7 @@ void Dbtup::do_tup_abortreq(Signal* signal, Uint32 flags) { ljam(); if (!regTabPtr.p->tuxCustomTriggers.isEmpty() && - (flags & 0x1) == 0) + (flags & ZSKIP_TUX_TRIGGERS) == 0) executeTuxAbortTriggers(signal, regOperPtr.p, regFragPtr.p, @@ -110,7 +110,7 @@ void Dbtup::do_tup_abortreq(Signal* signal, Uint32 flags) c_operation_pool.getPtr(loopOpPtr); if (get_tuple_state(loopOpPtr.p) != TUPLE_ALREADY_ABORTED && !regTabPtr.p->tuxCustomTriggers.isEmpty() && - (flags & 0x1) == 0) { + (flags & ZSKIP_TUX_TRIGGERS) == 0) { ljam(); executeTuxAbortTriggers(signal, loopOpPtr.p, diff --git a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp index 9cf48291a94..6cde3e51e5a 100644 --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp @@ -748,11 +748,19 @@ void Dbtup::execTUPKEYREQ(Signal* signal) regTabPtr) != 0) { jam(); /* - * undo the change before tupkeyErrorLab resets the op - * assume no timeslicing can occur even with diskdata + * TUP insert succeeded but add of TUX entries failed. All + * TUX changes have been rolled back at this point. + * + * We will abort via tupkeyErrorLab() as usual. This routine + * however resets the operation to ZREAD. The TUP_ABORTREQ + * arriving later cannot then undo the insert. + * + * Therefore we call TUP_ABORTREQ already now. Diskdata etc + * should be in memory and timeslicing cannot occur. We must + * skip TUX abort triggers since TUX is already aborted. */ signal->theData[0] = operPtr.i; - do_tup_abortreq(signal, 0x1); + do_tup_abortreq(signal, ZSKIP_TUX_TRIGGERS); tupkeyErrorLab(signal); return; } @@ -782,10 +790,10 @@ void Dbtup::execTUPKEYREQ(Signal* signal) regTabPtr) != 0) { jam(); /* - * see insert case + * See insert case. */ signal->theData[0] = operPtr.i; - do_tup_abortreq(signal, 0x1); + do_tup_abortreq(signal, ZSKIP_TUX_TRIGGERS); tupkeyErrorLab(signal); return; }