4441 Jan Wedvik 2011-06-07
This fix only applies to pushed queries (i.e. those using NdbQuery and the SPJ block).
This commit fixes an error related to bushy scans where the right hand side (i.e. the scan that is executed
several times for genrating a cross product) used pruning. The algoritm for couning how many fragments to scan
only worked correctly for the first execution. The second execution would typically cause an assert.
modified:
storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
4440 jonas oreland 2011-06-07 [merge]
ndb - wl4124 - merge ndbapi part into 70
added:
storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp
storage/ndb/src/ndbapi/NdbIndexStatImpl.hpp
storage/ndb/tools/ndb_index_stat.cpp
modified:
sql/ha_ndbcluster.cc
storage/ndb/include/ndbapi/NdbApi.hpp
storage/ndb/include/ndbapi/NdbDictionary.hpp
storage/ndb/include/ndbapi/NdbIndexStat.hpp
storage/ndb/src/kernel/blocks/trix/Trix.cpp
storage/ndb/src/ndbapi/API.hpp
storage/ndb/src/ndbapi/CMakeLists.txt
storage/ndb/src/ndbapi/Makefile.am
storage/ndb/src/ndbapi/NdbDictionary.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
storage/ndb/src/ndbapi/NdbIndexStat.cpp
storage/ndb/src/ndbapi/Ndberr.cpp
storage/ndb/src/ndbapi/Ndbif.cpp
storage/ndb/src/ndbapi/ndberror.c
storage/ndb/test/ndbapi/testIndexStat.cpp
storage/ndb/test/run-test/daily-basic-tests.txt
storage/ndb/tools/Makefile.am
=== modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2011-05-25 09:31:27 +0000
+++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2011-06-07 12:08:29 +0000
@@ -4879,12 +4879,6 @@ Dbspj::scanIndex_parent_row(Signal* sign
}
Uint32 ptrI = fragPtr.p->m_rangePtrI;
- if (ptrI == RNIL)
- {
- jam();
- data.m_frags_not_complete++;
- }
-
bool hasNull;
if (treeNodePtr.p->m_bits & TreeNode::T_KEYINFO_CONSTRUCTED)
{
@@ -4972,6 +4966,39 @@ Dbspj::scanIndex_parent_batch_complete(S
data.m_rows_received = 0;
data.m_rows_expecting = 0;
ndbassert(data.m_frags_outstanding == 0);
+ ndbassert(data.m_frags_not_complete == 0);
+
+ Ptr<ScanFragHandle> fragPtr;
+ {
+ Local_ScanFragHandle_list list(m_scanfraghandle_pool, data.m_fragments);
+ list.first(fragPtr);
+
+ if ((treeNodePtr.p->m_bits & TreeNode::T_PRUNE_PATTERN) == 0)
+ {
+ if (fragPtr.p->m_rangePtrI != RNIL)
+ {
+ // No pruning, so we must scan all fragments.
+ jam();
+ data.m_frags_not_complete = data.m_fragCount;
+ }
+ }
+ else
+ {
+ while(!fragPtr.isNull())
+ {
+ if (fragPtr.p->m_rangePtrI != RNIL)
+ {
+ jam();
+ /**
+ * This is a pruned scan, so we must scan those fragments that
+ * some distribution key hashed to.
+ */
+ data.m_frags_not_complete++;
+ }
+ list.next(fragPtr);
+ }
+ }
+ }
if (data.m_frags_not_complete == 0)
{
@@ -4981,11 +5008,6 @@ Dbspj::scanIndex_parent_batch_complete(S
*/
return;
}
- else if ((treeNodePtr.p->m_bits & TreeNode::T_PRUNE_PATTERN) == 0)
- {
- jam();
- data.m_frags_not_complete = data.m_fragCount;
- }
/**
* When parent's batch is complete, we send our batch
@@ -5014,7 +5036,6 @@ Dbspj::scanIndex_parent_batch_repeat(Sig
DEBUG("Register TreeNode for restart, m_node_no: " << treeNodePtr.p->m_node_no);
ndbrequire(treeNodePtr.p->m_state != TreeNode::TN_ACTIVE);
registerActiveCursor(requestPtr, treeNodePtr);
- data.m_frags_not_complete = 1;
data.m_batch_chunks = 0;
}
}
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (jan.wedvik:4440 to 4441) | Jan Wedvik | 7 Jun |