#At file:///export/home2/tmp/jw1159207/mysql/mysql-5.1-telco-7.0-spj/ based on revid:jan.wedvik@stripped
2960 Jan Wedvik 2009-09-01
Halfway implementation of operations with empty user projection.
modified:
storage/ndb/src/ndbapi/NdbQueryOperation.cpp
storage/ndb/test/tools/test_spj.cpp
=== modified file 'storage/ndb/src/ndbapi/NdbQueryOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2009-09-01 07:42:03 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2009-09-01 08:58:06 +0000
@@ -522,7 +522,7 @@ NdbQueryOperationImpl::~NdbQueryOperatio
ndb->theImpl->theNdbObjectIdMap.unmap(m_id, this);
}
#ifndef NDEBUG // Buffer overrun check activated.
- if(m_batchBuffer){
+ if(m_batchBuffer!=NULL){
// Check against buffer overun.
assert(m_batchBuffer[m_batchByteSize*getQuery().getParallelism()] == 'a' &&
m_batchBuffer[m_batchByteSize*getQuery().getParallelism()+1]
@@ -709,11 +709,12 @@ NdbQueryOperationImpl::setResultRowBuf (
}else if(unlikely(m_resultStyle==Style_NdbRecord)){
return QRY_RESULT_ROW_ALREADY_DEFINED;
}
+ assert(m_ndbRecord == NULL);
m_ndbRecord = rec;
m_resultStyle = Style_NdbRecord;
m_resultBuffer = resBuffer;
assert(m_batchBuffer==NULL);
- for(Uint32 i = 0; i<rec->noOfColumns; i++){
+ for(Uint32 i = 0; i<rec->noOfColumns; i++){
if(likely(result_mask==NULL || isSetInMask(result_mask, i))){
m_userProjection.addColumn(*m_operationDef.getTable()
.getColumn(rec->columns[i].column_no));
@@ -809,11 +810,13 @@ NdbQueryOperationImpl::nextResult(NdbQue
return NdbQuery::NextResult_bufferEmpty;
}
}
- const char* const rootBuff = root.m_applStreams.top()->m_receiver.get_row();
- assert(rootBuff!=NULL);
if(root.m_resultStyle==Style_NdbRecAttr){
+ const char* const rootBuff = root.m_applStreams.top()->m_receiver.get_row();
+ assert(rootBuff!=NULL);
root.fetchRecAttrResults(root.m_applStreams.top()->m_streamNo);
}else if(root.m_resultStyle==Style_NdbRecord){
+ const char* const rootBuff = root.m_applStreams.top()->m_receiver.get_row();
+ assert(rootBuff!=NULL);
if(root.m_resultRef!=NULL){
// Set application pointer to point into internal buffer.
*root.m_resultRef = rootBuff;
@@ -841,10 +844,11 @@ NdbQueryOperationImpl::nextResult(NdbQue
assert(operation.m_resultStreams[0]->m_transidAICount<=1);
if(operation.m_resultStreams[0]->m_transidAICount==1){
operation.m_isRowNull = false;
- const char* buff = operation.m_resultStreams[0]->m_receiver.get_row();
if(operation.m_resultStyle==Style_NdbRecAttr){
+ const char* buff = operation.m_resultStreams[0]->m_receiver.get_row();
operation.fetchRecAttrResults(0);
}else if(operation.m_resultStyle==Style_NdbRecord){
+ const char* buff = operation.m_resultStreams[0]->m_receiver.get_row();
if(operation.m_resultRef!=NULL){
// Set application pointer to point into internal buffer.
*operation.m_resultRef = buff;
@@ -884,11 +888,13 @@ NdbQueryOperationImpl::updateChildResult
ResultStream& resultStream = *m_resultStreams[streamNo];
assert(rowNo < resultStream.m_receiver.m_result_rows);
resultStream.m_receiver.setCurrentRow(rowNo);
- const char* buff = resultStream.m_receiver.get_row();
- assert(buff!=NULL);
if(m_resultStyle==Style_NdbRecAttr){
+ const char* buff = resultStream.m_receiver.get_row();
+ assert(buff!=NULL);
fetchRecAttrResults(streamNo);
}else if(m_resultStyle==Style_NdbRecord){
+ const char* buff = resultStream.m_receiver.get_row();
+ assert(buff!=NULL);
if(m_resultRef!=NULL){
// Set application pointer to point into internal buffer.
*m_resultRef = buff;
@@ -1191,43 +1197,48 @@ NdbQueryOperationImpl::prepareSend(Uint3
break;
case Style_None:
assert(m_ndbRecord == NULL);
- m_ndbRecord = m_operationDef.getTable().getDefaultRecord();
- rowSize = 0;
- break;
+ // m_ndbRecord = m_operationDef.getTable().getDefaultRecord();
+ rowSize = 0;
+ m_batchBuffer = NULL;
+ break;
default:
assert(false);
}
+ for(Uint32 i = 0; i<getQuery().getParallelism(); i++){
+ m_resultStreams[i]->prepare();
+ }
m_batchByteSize = rowSize * getRoot().m_maxBatchRows;
ndbout << "m_batchByteSize=" << m_batchByteSize << endl;
- assert(m_batchByteSize>0);
+ if(m_resultStyle!=Style_None){
+ assert(m_batchByteSize>0);
#ifdef NDEBUG
- m_batchBuffer = new char[m_batchByteSize*getQuery().getParallelism()];
+ m_batchBuffer = new char[m_batchByteSize*getQuery().getParallelism()];
#else
- /* To be able to check for buffer overrun.*/
- m_batchBuffer = new char[m_batchByteSize*getQuery().getParallelism()+4];
+ /* To be able to check for buffer overrun.*/
+ m_batchBuffer = new char[m_batchByteSize*getQuery().getParallelism()+4];
#endif
- for(Uint32 i = 0; i<getQuery().getParallelism(); i++){
- m_resultStreams[i]->prepare();
- m_resultStreams[i]->m_receiver
- .do_setup_ndbrecord(m_ndbRecord,
- getRoot().m_maxBatchRows,
- 0 /*key_size*/,
- 0 /*read_range_no*/,
- rowSize,
- &m_batchBuffer[m_batchByteSize*i],
- m_userProjection.getColumnCount());
- }
-
+ for(Uint32 i = 0; i<getQuery().getParallelism(); i++){
+ m_resultStreams[i]->m_receiver
+ .do_setup_ndbrecord(m_ndbRecord,
+ getRoot().m_maxBatchRows,
+ 0 /*key_size*/,
+ 0 /*read_range_no*/,
+ rowSize,
+ &m_batchBuffer[m_batchByteSize*i],
+ m_userProjection.getColumnCount());
+ }
+
#ifndef NDEBUG // Buffer overrun check activated.
- m_batchBuffer[m_batchByteSize*getQuery().getParallelism()] = 'a';
- m_batchBuffer[m_batchByteSize*getQuery().getParallelism()+1] = 'b';
- m_batchBuffer[m_batchByteSize*getQuery().getParallelism()+2] = 'c';
- m_batchBuffer[m_batchByteSize*getQuery().getParallelism()+3] = 'd';
+ m_batchBuffer[m_batchByteSize*getQuery().getParallelism()] = 'a';
+ m_batchBuffer[m_batchByteSize*getQuery().getParallelism()+1] = 'b';
+ m_batchBuffer[m_batchByteSize*getQuery().getParallelism()+2] = 'c';
+ m_batchBuffer[m_batchByteSize*getQuery().getParallelism()+3] = 'd';
#endif
- for(Uint32 i = 0; i<getQuery().getParallelism(); i++)
- {
- m_resultStreams[i]->m_receiver.prepareSend();
+ for(Uint32 i = 0; i<getQuery().getParallelism(); i++)
+ {
+ m_resultStreams[i]->m_receiver.prepareSend();
+ }
}
if (def.getIndex() != NULL)
@@ -1372,10 +1383,12 @@ NdbQueryOperationImpl::execTRANSID_AI(co
root.m_resultStreams[streamNo]->m_receiver.getId() != receiverId;
streamNo++);
assert(streamNo<getQuery().getParallelism());
- // Process result values.
- const int retVal = m_resultStreams[streamNo]->m_receiver
- .execTRANSID_AI(ptr, len - correlationWordCount);
- assert(retVal==0); // FIXME.
+ if(m_resultStyle!=Style_None){
+ // Process result values.
+ const int retVal = m_resultStreams[streamNo]->m_receiver
+ .execTRANSID_AI(ptr, len - correlationWordCount);
+ assert(retVal==0); // FIXME.
+ }
m_resultStreams[streamNo]->m_transidAICount++;
/* Put into the map such that parent and child can be macthed.
@@ -1397,9 +1410,11 @@ NdbQueryOperationImpl::execTRANSID_AI(co
return false;
}else{
// The root operation is a lookup.
- const int retVal = m_resultStreams[0]->m_receiver
- .execTRANSID_AI(ptr, len);
- assert(retVal==0); // FIXME.
+ if(m_resultStyle!=Style_None){
+ const int retVal = m_resultStreams[0]->m_receiver
+ .execTRANSID_AI(ptr, len);
+ assert(retVal==0); // FIXME.
+ }
m_resultStreams[0]->m_transidAICount++;
m_resultStreams[0]->m_pendingResults--;
=== modified file 'storage/ndb/test/tools/test_spj.cpp'
--- a/storage/ndb/test/tools/test_spj.cpp 2009-09-01 07:42:03 +0000
+++ b/storage/ndb/test/tools/test_spj.cpp 2009-09-01 08:58:06 +0000
@@ -652,11 +652,11 @@ int testSerialize(bool scan, int argc, c
/*scanOp->setResultRowRef(resultRec,
reinterpret_cast<const char*&>(scanResultPtr),
NULL);*/
- Uint32 scanResultPtr[6];
- for(Uint32 i = 0; i<6; i++){
+ Uint32 scanResultPtr[6] = {0};
+ /*for(Uint32 i = 0; i<6; i++){
assert(scanOp->getValue(i, reinterpret_cast<char*>(scanResultPtr+i))
!=NULL);
- }
+ }*/
const Uint32* lookupResultPtr;
NdbQueryOperation* const lookupOp = query->getQueryOperation(1);
lookupOp->setResultRowRef(resultRec,
Attachment: [text/bzr-bundle] bzr/jan.wedvik@sun.com-20090901085806-ig7iigulhwkckgzu.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0-spj branch (jan.wedvik:2960) | Jan Wedvik | 1 Sep |