#At file:///export/home2/tmp/jw1159207/mysql/mysql-5.1-telco-7.0-spj/ based on revid:jan.wedvik@stripped
2984 Jan Wedvik 2009-09-29
Before adding descendant row counter for SPJ.
modified:
storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp
storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
storage/ndb/src/ndbapi/TransporterFacade.cpp
storage/ndb/test/tools/spj_sanity_test.cpp
=== modified file 'storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp'
--- a/storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp 2009-08-24 13:45:49 +0000
+++ b/storage/ndb/src/kernel/blocks/dbspj/Dbspj.hpp 2009-09-29 12:16:24 +0000
@@ -218,7 +218,8 @@ public:
void (Dbspj::*m_count_descendant_signal)(Signal* signal,
Ptr<Request> requestPtr,
Ptr<TreeNode> rootPtr,
- Uint32 globalSignalNo);
+ Uint32 globalSignalNo,
+ bool hasUserProjecion);
};
struct LookupData
@@ -257,8 +258,11 @@ public:
Uint32 m_rows_received; // #execTRANSID_AI
Uint32 m_rows_expecting; // ScanFragConf
/** Number of receiced LQHKEYCONF messages from descendant lookup
- * operations.*/
+ * operations which has user projections.*/
Uint32 m_descendant_keyconfs_received;
+ /** Number of receiced LQHKEYCONF messages from descendant lookup
+ * operations which has no user projections.*/
+ Uint32 m_descendant_silent_keyconfs_received;
/** Number of received LQHKEYREF messages from descendant lookup
* operations.*/
Uint32 m_descendant_keyrefs_received;
@@ -357,6 +361,11 @@ public:
*/
T_LEAF = 0x10,
+ /**
+ * Does this node have a user projection
+ */
+ T_USER_PROJECTION = 0x20,
+
// End marker...
T_END = 0
};
@@ -528,7 +537,8 @@ private:
void lookup_count_descendant_signal(Signal* signal,
Ptr<Request> requestPtr,
Ptr<TreeNode> rootPtr,
- Uint32 globalSignalNo){};
+ Uint32 globalSignalNo,
+ bool hasUserProjection){};
Uint32 handle_special_hash(Uint32 tableId, Uint32 dstHash[4],
const Uint64* src,
@@ -556,7 +566,8 @@ private:
void scanFrag_count_descendant_signal(Signal* signal,
Ptr<Request> requestPtr,
Ptr<TreeNode> rootPtr,
- Uint32 globalSignalNo);
+ Uint32 globalSignalNo,
+ bool hasUserProjection);
/**
* Scratch buffers...
=== modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2009-09-28 08:12:13 +0000
+++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2009-09-29 12:16:24 +0000
@@ -1311,10 +1311,13 @@ Dbspj::lookup_send(Signal* signal,
treeNodePtr.p->m_lookup_data.m_outstanding += add;
Ptr<TreeNode> root = getRoot(requestPtr.p->m_nodes);
- (this->*(root.p->m_info->m_count_descendant_signal))(NULL,
- requestPtr,
- root,
- GSN_LQHKEYREQ);
+ (this->*(root.p->m_info
+ ->m_count_descendant_signal))(NULL,
+ requestPtr,
+ root,
+ GSN_LQHKEYREQ,
+ treeNodePtr.p->m_bits &
+ TreeNode::T_USER_PROJECTION);
}
void
@@ -1393,10 +1396,13 @@ Dbspj::lookup_execLQHKEYREF(Signal* sign
treeNodePtr.p->m_lookup_data.m_outstanding -= cnt;
Ptr<TreeNode> root = getRoot(requestPtr.p->m_nodes);
- (this->*(root.p->m_info->m_count_descendant_signal))(signal,
- requestPtr,
- root,
- GSN_LQHKEYREF);
+ (this->*(root.p->m_info
+ ->m_count_descendant_signal))(signal,
+ requestPtr,
+ root,
+ GSN_LQHKEYREF,
+ treeNodePtr.p->m_bits &
+ TreeNode::T_USER_PROJECTION);
if (treeNodePtr.p->m_lookup_data.m_outstanding == 0)
{
jam();
@@ -1413,10 +1419,13 @@ Dbspj::lookup_execLQHKEYCONF(Signal* sig
treeNodePtr.p->m_lookup_data.m_outstanding --;
Ptr<TreeNode> root = getRoot(requestPtr.p->m_nodes);
- (this->*(root.p->m_info->m_count_descendant_signal))(signal,
- requestPtr,
- root,
- GSN_LQHKEYCONF);
+ (this->*(root.p
+ ->m_info->m_count_descendant_signal))(signal,
+ requestPtr,
+ root,
+ GSN_LQHKEYCONF,
+ treeNodePtr.p->m_bits &
+ TreeNode::T_USER_PROJECTION);
if (treeNodePtr.p->m_lookup_data.m_outstanding == 0)
{
jam();
@@ -1480,13 +1489,20 @@ Dbspj::lookup_start_child(Signal* signal
* TODO merge better with lookup_start (refactor)
*/
{
- /* Increment lower half-word by one. This is done to ensure that each
- * instance of this operation gets a different correlation value.
- * (If the root operation is a scan, there may be many instances of a
- * lookup). Otherwise, instances of children of this operation would all
- * see the same correlation value.*/
- treeNodePtr.p->m_send.m_correlation = (corrVal << 16) +
- (treeNodePtr.p->m_send.m_correlation & 0xffff) + 1;
+ if(treeNodePtr.p->m_bits & TreeNode::T_USER_PROJECTION)
+ {
+ /* Increment lower half-word by one. This is done to ensure that each
+ * instance of this operation gets a different correlation value.
+ * (If the root operation is a scan, there may be many instances of a
+ * lookup). Otherwise, instances of children of this operation would all
+ * see the same correlation value.*/
+ treeNodePtr.p->m_send.m_correlation = (corrVal << 16) +
+ (treeNodePtr.p->m_send.m_correlation & 0xffff) + 1;
+ }
+ else
+ {
+ treeNodePtr.p->m_send.m_correlation = corrVal;
+ }
treeNodePtr.p->m_send.m_ref = tmp.receiverRef;
LqhKeyReq * dst = (LqhKeyReq*)treeNodePtr.p->m_lookup_data.m_lqhKeyReq;
dst->hashValue = tmp.hashInfo[0];
@@ -1944,6 +1960,7 @@ Dbspj::scanFrag_send(Signal* signal,
treeNodePtr.p->m_scanfrag_data.m_rows_received = 0;
treeNodePtr.p->m_scanfrag_data.m_rows_expecting = 0;
treeNodePtr.p->m_scanfrag_data.m_descendant_keyconfs_received = 0;
+ treeNodePtr.p->m_scanfrag_data.m_descendant_silent_keyconfs_received = 0;
treeNodePtr.p->m_scanfrag_data.m_descendant_keyrefs_received = 0;
treeNodePtr.p->m_scanfrag_data.m_descendant_keyreqs_sent = 0;
}
@@ -1958,6 +1975,7 @@ static bool isScanComplete(const Dbspj::
// All rows for descendant lookups received.
scanFragData.m_descendant_keyreqs_sent ==
scanFragData.m_descendant_keyconfs_received +
+ scanFragData.m_descendant_silent_keyconfs_received +
scanFragData.m_descendant_keyrefs_received;
}
@@ -2060,6 +2078,7 @@ Dbspj::scanFrag_batch_complete(Signal* s
Ptr<Request> requestPtr,
Ptr<TreeNode> treeNodePtr)
{
+ DEBUG("scanFrag_batch_complete()");
ndbrequire(treeNodePtr.p->m_scanfrag_data.m_scan_state ==
ScanFragData::SF_RUNNING);
@@ -2121,20 +2140,39 @@ void
Dbspj::scanFrag_count_descendant_signal(Signal* signal,
Ptr<Request> requestPtr,
Ptr<TreeNode> rootPtr,
- Uint32 globalSignalNo)
+ Uint32 globalSignalNo,
+ bool hasUserProjection)
{
- const bool trace = false;
+ const bool trace = true;
switch(globalSignalNo){
case GSN_LQHKEYCONF:
jam();
- rootPtr.p->m_scanfrag_data.m_descendant_keyconfs_received++;
- if(trace)
+ if(hasUserProjection)
{
- ndbout << "Dbspj::scanFrag_count_descendant_signal() incremented "
- "m_scanfrag_data.m_descendant_keyconfs_received to "<<
- rootPtr.p->m_scanfrag_data.m_descendant_keyconfs_received << endl;
+ rootPtr.p->m_scanfrag_data.m_descendant_keyconfs_received++;
+ if(trace)
+ {
+ ndbout << "Dbspj::scanFrag_count_descendant_signal() incremented "
+ "m_scanfrag_data.m_descendant_keyconfs_received to "<<
+ rootPtr.p->m_scanfrag_data.m_descendant_keyconfs_received << endl;
+ }
}
+ else
+ {
+ /* There is no user projection. Typically, this will be the operation
+ * that retrieves an index tuple as part of an index lookup operation.
+ * (Only the base table tuple will then be sent to the API.)*/
+ rootPtr.p->m_scanfrag_data.m_descendant_silent_keyconfs_received++;
+ if(trace)
+ {
+ ndbout << "Dbspj::scanFrag_count_descendant_signal() incremented "
+ "m_scanfrag_data.m_descendant_silent_keyconfs_received to "
+ << rootPtr.p->m_scanfrag_data.
+ m_descendant_silent_keyconfs_received
+ << endl;
+ }
+ }
break;
case GSN_LQHKEYREF:
jam();
@@ -2942,6 +2980,7 @@ Dbspj::parseDA(Build_context& ctx,
Uint32 len = * param.ptr++;
DEBUG("PI_ATTR_LIST");
+ treeNodePtr.p->m_bits |= TreeNode::T_USER_PROJECTION;
err = DbspjErr::OutOfSectionMemory;
if (!appendToSection(attrInfoPtrI, param.ptr, len))
{
=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.cpp 2009-09-28 08:12:13 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp 2009-09-29 12:16:24 +0000
@@ -40,7 +40,7 @@
#include <signaldata/SumaImpl.hpp>
//#define REPORT_TRANSPORTER
-//#define API_TRACE
+#define API_TRACE
static int numberToIndex(int number)
{
=== modified file 'storage/ndb/test/tools/spj_sanity_test.cpp'
--- a/storage/ndb/test/tools/spj_sanity_test.cpp 2009-09-28 14:15:02 +0000
+++ b/storage/ndb/test/tools/spj_sanity_test.cpp 2009-09-29 12:16:24 +0000
@@ -723,9 +723,12 @@ namespace SPJSanityTest{
makeTable<Row, Key>(mysql, "tt", tableSize);
Query<Row> query(ndb);
TableScanOperation<Row> root(query);
- LookupOperation<Row, Key> child(query, &root);
- LookupOperation<Row, Key> child2(query, &root);
- LookupOperation<Row, Key> child3(query, &child2);
+ //LookupOperation<Row, Key> child(query, &root);
+ IndexLookupOperation<Row, Key> child1(query, "UIX", &root);
+ LookupOperation<Row, Key> child2(query, &child1);
+ IndexLookupOperation<Row, Key> child3(query, "UIX", &child2);
+ //LookupOperation<Row, Key> child2(query, &root);
+ //LookupOperation<Row, Key> child3(query, &child2);
NdbQueryBuilder builder(ndb);
NdbDictionary::Dictionary* const dict = ndb.getDictionary();
const NdbDictionary::Table* const tab = dict->getTable("tt");
@@ -891,7 +894,7 @@ int main(int argc, char* argv[]){
}
mySQLExec(mysql, "create database if not exists CK_DB");
mySQLExec(mysql, "use CK_DB");
- for(int testNo = 0; testNo<4; testNo++){
+ for(int testNo = 2; testNo<3; testNo++){
Ndb_cluster_connection con(connectString);
if(con.connect(12, 5, 1) != 0){
ndbout << "Unable to connect to management server." << endl;
@@ -917,7 +920,7 @@ int main(int argc, char* argv[]){
testIndexLookup<RowInt, KeyInt>(mysql, ndb, 5);
break;
case 2:
- testTableScanWithLookup<RowInt, KeyInt>(mysql, ndb, 5);
+ testTableScanWithLookup<RowInt, KeyInt>(mysql, ndb, 10);
break;
case 3:
testIndexScanWithLookup<RowInt, KeyInt>(mysql, ndb, 5);
Attachment: [text/bzr-bundle] bzr/jan.wedvik@sun.com-20090929121624-lxne9p517ab67zjd.bundle
Thread |
---|
• bzr commit into mysql-5.1-telco-7.0-spj branch (jan.wedvik:2984) | Jan Wedvik | 29 Sep |