#At file:///home/tomas/mysql_src/mysql-5.1-telco-6.2-merge/
2821 Tomas Ulin 2009-02-04 [merge]
merge
modified:
mysql-test/r/partition_mgm.result
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
mysql-test/t/partition_mgm.test
sql/sql_partition.cc
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
storage/ndb/src/ndbapi/NdbScanOperation.cpp
storage/ndb/test/ndbapi/testScan.cpp
storage/ndb/test/run-test/daily-basic-tests.txt
storage/ndb/test/src/HugoTransactions.cpp
=== modified file 'mysql-test/r/partition_mgm.result'
--- a/mysql-test/r/partition_mgm.result 2008-12-10 08:06:58 +0000
+++ b/mysql-test/r/partition_mgm.result 2009-02-03 14:17:59 +0000
@@ -5,6 +5,11 @@ PARTITION BY HASH (a)
PARTITIONS 1;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
ALTER TABLE t1 REORGANIZE PARTITION;
+ERROR HY000: REORGANISE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs
+ALTER ONLINE TABLE t1 REORGANIZE PARTITION;
+ERROR HY000: REORGANISE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs
+ALTER OFFLINE TABLE t1 REORGANIZE PARTITION;
+ERROR HY000: REORGANISE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs
DROP TABLE t1;
create table t1 (a int)
partition by range (a)
=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_ndb.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_ndb.result 2008-11-05 20:13:54 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_ndb.result 2009-02-03 14:17:59 +0000
@@ -122,7 +122,7 @@ INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
-test.t1 optimize note The storage engine for the table doesn't support optimize
+test.t1 optimize status OK
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -389,7 +389,7 @@ INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
-test.t1 optimize note The storage engine for the table doesn't support optimize
+test.t1 optimize status OK
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
=== modified file 'mysql-test/t/partition_mgm.test'
--- a/mysql-test/t/partition_mgm.test 2009-01-23 12:22:05 +0000
+++ b/mysql-test/t/partition_mgm.test 2009-02-04 13:06:44 +0000
@@ -11,7 +11,12 @@ ENGINE MYISAM
PARTITION BY HASH (a)
PARTITIONS 1;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+--error ER_REORG_NO_PARAM_ERROR
ALTER TABLE t1 REORGANIZE PARTITION;
+--error ER_REORG_NO_PARAM_ERROR
+ALTER ONLINE TABLE t1 REORGANIZE PARTITION;
+--error ER_REORG_NO_PARAM_ERROR
+ALTER OFFLINE TABLE t1 REORGANIZE PARTITION;
DROP TABLE t1;
#
=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc 2009-01-15 07:32:40 +0000
+++ b/sql/sql_partition.cc 2009-02-03 14:17:59 +0000
@@ -4207,43 +4207,25 @@ uint prep_alter_part_table(THD *thd, TAB
}
if (alter_info->flags & ALTER_TABLE_REORG)
{
- uint new_part_no, curr_part_no;
+ DBUG_ASSERT(table->s->db_type()->partition_flags);
+ /* 'ALTER TABLE t REORG PARTITION' only allowed with auto partition */
if (tab_part_info->part_type != HASH_PARTITION ||
- tab_part_info->use_default_no_partitions)
+ !tab_part_info->use_default_no_partitions ||
+ (table->s->db_type()->partition_flags &&
+ !(table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION)))
{
my_error(ER_REORG_NO_PARAM_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
- new_part_no= table->file->get_default_no_partitions(create_info);
- curr_part_no= tab_part_info->no_parts;
- if (new_part_no == curr_part_no)
- {
- /*
- No change is needed, we will have the same number of partitions
- after the change as before. Thus we can reply ok immediately
- without any changes at all.
- */
- *fast_alter_partition= TRUE;
- DBUG_RETURN(FALSE);
- }
- else if (new_part_no > curr_part_no)
- {
- /*
- We will add more partitions, we use the ADD PARTITION without
- setting the flag for no default number of partitions
- */
- alter_info->flags|= ALTER_ADD_PARTITION;
- thd->work_part_info->no_parts= new_part_no - curr_part_no;
- }
- else
- {
- /*
- We will remove hash partitions, we use the COALESCE PARTITION
- without setting the flag for no default number of partitions
- */
- alter_info->flags|= ALTER_COALESCE_PARTITION;
- alter_info->no_parts= curr_part_no - new_part_no;
- }
+ DBUG_ASSERT(!alt_part_info ||
+ alt_part_info->part_type == NOT_A_PARTITION);
+ /*
+ This is really a table operation, handled by native engines.
+ NDB can handle this fast/online. Skip the partitioning path.
+ */
+ if (alt_part_info)
+ thd->work_part_info= NULL;
+ DBUG_RETURN(FALSE);
}
if (table->s->db_type()->alter_partition_flags &&
(!(flags= table->s->db_type()->alter_partition_flags())))
=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2008-12-15 19:35:37 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2009-02-04 12:35:22 +0000
@@ -15520,8 +15520,21 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal
}//if
if (signal->theData[0] == DumpStateOrd::DihMinTimeBetweenLCP) {
// Set time between LCP to min value
- g_eventLogger->info("Set time between LCP to min value");
- c_lcpState.clcpDelay = 0; // TimeBetweenLocalCheckpoints.min
+ if (signal->getLength() == 2)
+ {
+ Uint32 tmp;
+ const ndb_mgm_configuration_iterator * p =
+ m_ctx.m_config.getOwnConfigIterator();
+ ndbrequire(p != 0);
+ ndb_mgm_get_int_parameter(p, CFG_DB_LCP_INTERVAL, &tmp);
+ g_eventLogger->info("Reset time between LCP to %u", tmp);
+ c_lcpState.clcpDelay = tmp;
+ }
+ else
+ {
+ g_eventLogger->info("Set time between LCP to min value");
+ c_lcpState.clcpDelay = 0; // TimeBetweenLocalCheckpoints.min
+ }
return;
}
if (signal->theData[0] == DumpStateOrd::DihMaxTimeBetweenLCP) {
=== modified file 'storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp 2009-01-13 14:42:48 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp 2009-02-02 21:21:34 +0000
@@ -704,7 +704,8 @@ public:
* fragment operations on the fragment.
* A maximum of four concurrently active is allowed.
*/
- typedef Bitmask<4> ScanNumberMask;
+
+ typedef Bitmask<8> ScanNumberMask; // Max 255 KeyInfo20::ScanNo
ScanNumberMask m_scanNumberMask;
DLList<ScanRecord>::Head m_activeScans;
DLFifoList<ScanRecord>::Head m_queuedScans;
=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2009-01-13 14:42:48 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2009-02-02 21:21:34 +0000
@@ -9832,6 +9832,7 @@ Uint32 Dblqh::initScanrec(const ScanFrag
Uint32 tupScan = ScanFragReq::getTupScanFlag(reqinfo);
const Uint32 attrLen = ScanFragReq::getAttrLen(reqinfo);
const Uint32 scanPrio = ScanFragReq::getScanPrio(reqinfo);
+ const Uint32 accScan = (rangeScan == 0) && (tupScan == 0);
scanptr.p->scanKeyinfoFlag = keyinfo;
scanptr.p->scanLockHold = scanLockHold;
@@ -9847,12 +9848,7 @@ Uint32 Dblqh::initScanrec(const ScanFrag
scanptr.p->m_max_batch_size_rows = max_rows;
scanptr.p->m_max_batch_size_bytes = max_bytes;
-#if 0
- if (! rangeScan)
- tupScan = 1;
-#endif
-
- if (! rangeScan && ! tupScan)
+ if (accScan)
scanptr.p->scanBlockref = tcConnectptr.p->tcAccBlockref;
else if (! tupScan)
scanptr.p->scanBlockref = tcConnectptr.p->tcTuxBlockref;
@@ -9895,12 +9891,27 @@ Uint32 Dblqh::initScanrec(const ScanFrag
* !idx uses 1 - (MAX_PARALLEL_SCANS_PER_FRAG - 1) = 1-11
* idx uses from MAX_PARALLEL_SCANS_PER_FRAG - MAX = 12-42)
*/
- Uint32 start = (rangeScan || tupScan) ? MAX_PARALLEL_SCANS_PER_FRAG : 1 ;
- Uint32 stop = (rangeScan || tupScan) ? MAX_PARALLEL_INDEX_SCANS_PER_FRAG :
- MAX_PARALLEL_SCANS_PER_FRAG - 1;
- stop += start;
+ Uint32 start, stop;
+ if (accScan)
+ {
+ start = 1;
+ stop = MAX_PARALLEL_SCANS_PER_FRAG - 1;
+ }
+ else if (rangeScan)
+ {
+ start = MAX_PARALLEL_SCANS_PER_FRAG;
+ stop = start + MAX_PARALLEL_INDEX_SCANS_PER_FRAG - 1;
+ }
+ else
+ {
+ ndbassert(tupScan);
+ start = MAX_PARALLEL_SCANS_PER_FRAG + MAX_PARALLEL_INDEX_SCANS_PER_FRAG;
+ stop = start + MAX_PARALLEL_INDEX_SCANS_PER_FRAG - 1;
+ }
+ ndbrequire((start < 32 * tFragPtr.p->m_scanNumberMask.Size) &&
+ (stop < 32 * tFragPtr.p->m_scanNumberMask.Size));
Uint32 free = tFragPtr.p->m_scanNumberMask.find(start);
-
+
if(free == Fragrecord::ScanNumberMask::NotFound || free >= stop){
jam();
=== modified file 'storage/ndb/src/ndbapi/NdbScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2008-11-08 21:06:51 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2009-02-04 06:52:21 +0000
@@ -1295,39 +1295,74 @@ NdbScanOperation::executeCursor(int node
* Call finaliseScanOldApi() for old style scans before
* proceeding
*/
- if (m_scanUsingOldApi &&
- finaliseScanOldApi() == -1)
- return -1;
-
- NdbTransaction * tCon = theNdbCon;
+ bool locked = false;
TransporterFacade* tp = theNdb->theImpl->m_transporter_facade;
- Guard guard(tp->theMutexPtr);
- Uint32 seq = tCon->theNodeSequence;
+ int res = 0;
+ if (m_scanUsingOldApi && finaliseScanOldApi() == -1)
+ {
+ res = -1;
+ goto done;
+ }
- if (tp->get_node_alive(nodeId) &&
- (tp->getNodeSequence(nodeId) == seq)) {
+ {
+ locked = true;
+ NdbTransaction * tCon = theNdbCon;
+ NdbMutex_Lock(tp->theMutexPtr);
+
+ Uint32 seq = tCon->theNodeSequence;
+
+ if (tp->get_node_alive(nodeId) &&
+ (tp->getNodeSequence(nodeId) == seq)) {
+
+ tCon->theMagicNumber = 0x37412619;
+
+ if (doSendScan(nodeId) == -1)
+ {
+ res = -1;
+ goto done;
+ }
+
+ m_executed= true; // Mark operation as executed
+ }
+ else
+ {
+ if (!(tp->get_node_stopping(nodeId) &&
+ (tp->getNodeSequence(nodeId) == seq)))
+ {
+ TRACE_DEBUG("The node is hard dead when attempting to start a scan");
+ setErrorCode(4029);
+ tCon->theReleaseOnClose = true;
+ }
+ else
+ {
+ TRACE_DEBUG("The node is stopping when attempting to start a scan");
+ setErrorCode(4030);
+ }//if
+ res = -1;
+ tCon->theCommitStatus = NdbTransaction::Aborted;
+ }//if
+ }
- tCon->theMagicNumber = 0x37412619;
+done:
+ /**
+ * Set pointers correctly
+ * so that nextResult will handle it correctly
+ * even if doSendScan was never called
+ * bug#42454
+ */
+ m_curr_row = 0;
+ m_sent_receivers_count = theParallelism;
+ if(m_ordered)
+ {
+ m_current_api_receiver = theParallelism;
+ m_api_receivers_count = theParallelism;
+ }
- if (doSendScan(nodeId) == -1)
- return -1;
+ if (locked)
+ NdbMutex_Unlock(tp->theMutexPtr);
- m_executed= true; // Mark operation as executed
- return 0;
- } else {
- if (!(tp->get_node_stopping(nodeId) &&
- (tp->getNodeSequence(nodeId) == seq))){
- TRACE_DEBUG("The node is hard dead when attempting to start a scan");
- setErrorCode(4029);
- tCon->theReleaseOnClose = true;
- } else {
- TRACE_DEBUG("The node is stopping when attempting to start a scan");
- setErrorCode(4030);
- }//if
- tCon->theCommitStatus = NdbTransaction::Aborted;
- }//if
- return -1;
+ return res;
}
@@ -2046,14 +2081,6 @@ NdbScanOperation::doSendScan(int aProces
}
theStatus = WaitResponse;
- m_curr_row = 0;
- m_sent_receivers_count = theParallelism;
- if(m_ordered)
- {
- m_current_api_receiver = theParallelism;
- m_api_receivers_count = theParallelism;
- }
-
return tSignalCount;
}//NdbOperation::doSendScan()
=== modified file 'storage/ndb/test/ndbapi/testScan.cpp'
--- a/storage/ndb/test/ndbapi/testScan.cpp 2008-04-28 14:17:28 +0000
+++ b/storage/ndb/test/ndbapi/testScan.cpp 2009-02-04 12:35:22 +0000
@@ -1235,6 +1235,96 @@ runBug24447(NDBT_Context* ctx, NDBT_Step
return NDBT_OK;
}
+int runBug42545(NDBT_Context* ctx, NDBT_Step* step){
+
+ int loops = ctx->getNumLoops();
+
+ Ndb* pNdb = GETNDB(step);
+ NdbRestarter res;
+
+ if (res.getNumDbNodes() < 2)
+ {
+ ctx->stopTest();
+ return NDBT_OK;
+ }
+
+ const NdbDictionary::Index * pIdx =
+ GETNDB(step)->getDictionary()->getIndex(orderedPkIdxName,
+ ctx->getTab()->getName());
+
+
+ int i = 0;
+ while (pIdx && i++ < loops && !ctx->isTestStopped())
+ {
+ g_info << i << ": ";
+ NdbTransaction* pTrans = pNdb->startTransaction();
+ int nodeId = pTrans->getConnectedNodeId();
+
+ {
+ Uint32 cnt = 0;
+ Vector<NdbTransaction*> translist;
+ while (cnt < 3)
+ {
+ NdbTransaction* p2 = pNdb->startTransaction();
+ translist.push_back(p2);
+ if (p2->getConnectedNodeId() == (Uint32)nodeId)
+ cnt++;
+ }
+
+ for (size_t t = 0; t < translist.size(); t++)
+ translist[t]->close();
+ translist.clear();
+ }
+
+ NdbIndexScanOperation*
+ pOp = pTrans->getNdbIndexScanOperation(pIdx, ctx->getTab());
+
+ int r0 = pOp->readTuples(NdbOperation::LM_CommittedRead,
+ NdbScanOperation::SF_OrderBy);
+
+ ndbout << "Restart node " << nodeId << endl;
+ res.restartOneDbNode(nodeId,
+ /** initial */ false,
+ /** nostart */ true,
+ /** abort */ true);
+
+ res.waitNodesNoStart(&nodeId, 1);
+ res.startNodes(&nodeId, 1);
+ res.waitNodesStarted(&nodeId, 1);
+
+ int r1 = pTrans->execute(NdbTransaction::NoCommit);
+
+ int r2;
+ while ((r2 = pOp->nextResult()) == 0);
+
+ ndbout_c("r0: %d r1: %d r2: %d", r0, r1, r2);
+
+ pTrans->close();
+ }
+
+ return NDBT_OK;
+}
+
+int
+initBug42559(NDBT_Context* ctx, NDBT_Step* step){
+
+ int dump[] = { 7017 }; // Max LCP speed
+ NdbRestarter res;
+ res.dumpStateAllNodes(dump, 1);
+
+ return NDBT_OK;
+}
+int
+finalizeBug42559(NDBT_Context* ctx, NDBT_Step* step){
+
+ int dump[] = { 7017, 1 }; // Restore config value
+ NdbRestarter res;
+ res.dumpStateAllNodes(dump, 2);
+
+ return NDBT_OK;
+}
+
+
NDBT_TESTSUITE(testScan);
TESTCASE("ScanRead",
"Verify scan requirement: It should be possible "\
@@ -1725,6 +1815,24 @@ TESTCASE("Bug36124",
STEP(runBug36124);
FINALIZER(runClearTable);
}
+TESTCASE("Bug42545", "")
+{
+ INITIALIZER(createOrderedPkIndex);
+ INITIALIZER(runLoadTable);
+ STEP(runBug42545);
+ FINALIZER(createOrderedPkIndex_Drop);
+ FINALIZER(runClearTable);
+}
+TESTCASE("Bug42559", "")
+{
+ INITIALIZER(initBug42559);
+ INITIALIZER(createOrderedPkIndex);
+ INITIALIZER(runLoadTable);
+ STEPS(runScanReadIndex, 70);
+ FINALIZER(createOrderedPkIndex_Drop);
+ FINALIZER(finalizeBug42559);
+ FINALIZER(runClearTable);
+}
NDBT_TESTSUITE_END(testScan);
int main(int argc, const char** argv){
@@ -1734,3 +1842,4 @@ int main(int argc, const char** argv){
}
template class Vector<Attrib*>;
+template class Vector<NdbTransaction*>;
=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt 2009-01-29 10:56:52 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt 2009-02-04 12:35:22 +0000
@@ -309,6 +309,10 @@ max-time: 500
cmd: testScan
args: -n ScanRead488O -l 10 T6 D1 D2
+max-time: 500
+cmd: testScan
+args: -n Bug42559 T6 D1 D2
+
max-time: 1000
cmd: testScan
args: -n ScanRead488T -l 10 T6 D1 D2
@@ -1183,4 +1187,8 @@ args: -n Bug41295 T1
max-time: 1200
cmd: testNodeRestart
args: -n Bug42422 -l 1 T1
+
+max-time: 300
+cmd: testScan
+args: -n Bug42545 -l 1 T1
=== modified file 'storage/ndb/test/src/HugoTransactions.cpp'
--- a/storage/ndb/test/src/HugoTransactions.cpp 2008-11-17 09:26:25 +0000
+++ b/storage/ndb/test/src/HugoTransactions.cpp 2009-02-04 12:32:27 +0000
@@ -51,8 +51,8 @@ HugoTransactions::scanReadRecords(Ndb* p
while (true){
if (retryAttempt >= m_retryMax){
- g_err << "ERROR: has retried this operation " << retryAttempt
- << " times, failing!" << endl;
+ g_err << __LINE__ << " ERROR: has retried this operation "
+ << retryAttempt << " times, failing!" << endl;
return NDBT_FAILED;
}
@@ -154,6 +154,18 @@ HugoTransactions::scanReadRecords(Ndb* p
// Too many active scans, no limit on number of retry attempts
break;
default:
+ if (err.classification == NdbError::TimeoutExpired)
+ {
+ if (retryAttempt >= (m_retryMax / 10) &&
+ (parallelism == 0 || parallelism > 1))
+ {
+ /**
+ * decrease parallelism
+ */
+ parallelism = 1;
+ ndbout_c("decrease parallelism");
+ }
+ }
retryAttempt++;
}
continue;
@@ -195,8 +207,10 @@ HugoTransactions::scanReadRecords(Ndb* p
while (true){
if (retryAttempt >= m_retryMax){
- g_err << "ERROR: has retried this operation " << retryAttempt
- << " times, failing!" << endl;
+ g_err << __LINE__ << " ERROR: has retried this operation "
+ << retryAttempt << " times, failing!" << endl;
+ g_err << "lm: " << Uint32(lm) << " flags: H'" << hex << scan_flags
+ << endl;
return NDBT_FAILED;
}
@@ -298,6 +312,18 @@ HugoTransactions::scanReadRecords(Ndb* p
// Too many active scans, no limit on number of retry attempts
break;
default:
+ if (err.classification == NdbError::TimeoutExpired)
+ {
+ if (retryAttempt >= (m_retryMax / 10) &&
+ (parallelism == 0 || parallelism > 1))
+ {
+ /**
+ * decrease parallelism
+ */
+ parallelism = 1;
+ ndbout_c("decrease parallelism");
+ }
+ }
retryAttempt++;
}
continue;
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-6.2-merge branch (tomas.ulin:2821) | Tomas Ulin | 4 Feb |