List:Commits« Previous MessageNext Message »
From:Frazer Clement Date:April 28 2008 4:17pm
Subject:bk commit into 5.1 tree (frazer:1.2588) BUG#36124
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of frazer.  When frazer does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-04-28 15:17:28+01:00, frazer@stripped +4 -0
  Bug #36124 
  Checks on operation type were not correct, resulting in corrupted signals being sent
when the 
  old interpreted code Api is used with scans.

  storage/ndb/include/ndbapi/NdbOperation.hpp@stripped, 2008-04-28 15:17:12+01:00,
frazer@stripped +1 -0
    Bug #36124 
    Checks on operation type were not correct, resulting in corrupted signals being sent
when the 
    old interpreted code Api is used with scans.

  storage/ndb/src/ndbapi/NdbOperationInt.cpp@stripped, 2008-04-28 15:17:14+01:00,
frazer@stripped +56 -36
    Bug #36124 
    Checks on operation type were not correct, resulting in corrupted signals being sent
when the 
    old interpreted code Api is used with scans.

  storage/ndb/test/ndbapi/testScan.cpp@stripped, 2008-04-28 15:17:16+01:00,
frazer@stripped +45 -0
    Bug #36124 
    Checks on operation type were not correct, resulting in corrupted signals being sent
when the 
    old interpreted code Api is used with scans.

  storage/ndb/test/run-test/daily-basic-tests.txt@stripped, 2008-04-28 15:17:18+01:00,
frazer@stripped +4 -0
    Bug #36124 
    Checks on operation type were not correct, resulting in corrupted signals being sent
when the 
    old interpreted code Api is used with scans.

diff -Nrup a/storage/ndb/include/ndbapi/NdbOperation.hpp
b/storage/ndb/include/ndbapi/NdbOperation.hpp
--- a/storage/ndb/include/ndbapi/NdbOperation.hpp	2008-02-19 15:00:27 +00:00
+++ b/storage/ndb/include/ndbapi/NdbOperation.hpp	2008-04-28 15:17:12 +01:00
@@ -1254,6 +1254,7 @@ protected:
   virtual void setErrorCode(int aErrorCode) const;
   virtual void setErrorCodeAbort(int aErrorCode) const;
 
+  bool        isNdbRecordOperation();
   int	      incCheck(const NdbColumnImpl* anAttrObject);
   int	      initial_interpreterCheck();
   int	      intermediate_interpreterCheck();
diff -Nrup a/storage/ndb/src/ndbapi/NdbOperationInt.cpp
b/storage/ndb/src/ndbapi/NdbOperationInt.cpp
--- a/storage/ndb/src/ndbapi/NdbOperationInt.cpp	2008-04-08 09:29:10 +01:00
+++ b/storage/ndb/src/ndbapi/NdbOperationInt.cpp	2008-04-28 15:17:14 +01:00
@@ -58,12 +58,28 @@ NdbOperation::initInterpreter(){
   theTotalCurrAI_Len = AttrInfo::SectionSizeInfoLength;
 }
 
+bool
+NdbOperation::isNdbRecordOperation()
+{
+  /* All scans are 'NdbRecord'.  For PK and UK access
+   * check if we've got an m_attribute_record set 
+   */
+  return !(((m_type == PrimaryKeyAccess) ||
+            (m_type == UniqueIndexAccess)) &&
+           (m_attribute_record == NULL));
+}
+
 int
 NdbOperation::incCheck(const NdbColumnImpl* tNdbColumnImpl)
 {
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
-    if ((tNdbColumnImpl == NULL) ||
-        (theStatus == UseNdbRecord)) 
+    if (tNdbColumnImpl == NULL)
       goto inc_check_error1;
     if ((tNdbColumnImpl->getInterpretableType() != true) ||
         (tNdbColumnImpl->m_pk != false) ||
@@ -90,11 +106,6 @@ NdbOperation::incCheck(const NdbColumnIm
   return -1;
   
  inc_check_error1:
-  if (theStatus == UseNdbRecord) {
-    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-    setErrorCodeAbort(4537);
-    return -1;
-  }
   setErrorCodeAbort(4004);
   return -1;
   
@@ -118,9 +129,14 @@ NdbOperation::incCheck(const NdbColumnIm
 int
 NdbOperation::write_attrCheck(const NdbColumnImpl* tNdbColumnImpl)
 {
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
-    if ((tNdbColumnImpl == NULL) ||
-        (theStatus == UseNdbRecord)) 
+    if (tNdbColumnImpl == NULL)
       goto write_attr_check_error1;
     if ((tNdbColumnImpl->getInterpretableType() == false) ||
         (tNdbColumnImpl->m_pk))
@@ -143,11 +159,6 @@ NdbOperation::write_attrCheck(const NdbC
   return -1;
 
 write_attr_check_error1:
-  if (theStatus == UseNdbRecord) {
-    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-    setErrorCodeAbort(4537);
-    return -1;
-  }
   setErrorCodeAbort(4004);
   return -1;
 
@@ -167,9 +178,14 @@ write_attr_check_error2:
 int
 NdbOperation::read_attrCheck(const NdbColumnImpl* tNdbColumnImpl)
 {
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
-    if ((tNdbColumnImpl == NULL) ||
-        (theStatus == UseNdbRecord))
+    if (tNdbColumnImpl == NULL)
       goto read_attr_check_error1;
     if (tNdbColumnImpl->getInterpretableType() == false)
       goto read_attr_check_error2;
@@ -194,11 +210,6 @@ NdbOperation::read_attrCheck(const NdbCo
   return -1;
   
  read_attr_check_error1:
-  if (theStatus == UseNdbRecord) {
-    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-    setErrorCodeAbort(4537);
-    return -1;
-  }
   setErrorCodeAbort(4004);
   return -1;
   
@@ -214,13 +225,18 @@ NdbOperation::read_attrCheck(const NdbCo
 int
 NdbOperation::initial_interpreterCheck()
 {
+  printf("initial_interpreterCheck(), theStatus=%u\n",
+         theStatus);
+
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
     if (theStatus == ExecInterpretedValue) {
-       return 0; // Simply continue with interpretation
-    } else if (theStatus == UseNdbRecord) {
-      /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-      setErrorCodeAbort(4537);
-      return -1;
+      return 0; // Simply continue with interpretation
     } else if (theStatus == GetValue) {
       theInitialReadSize = theTotalCurrAI_Len - AttrInfo::SectionSizeInfoLength;
       theStatus = ExecInterpretedValue;
@@ -242,13 +258,15 @@ NdbOperation::initial_interpreterCheck()
 int
 NdbOperation::labelCheck()
 {
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
     if (theStatus == ExecInterpretedValue) {
-       return 0; // Simply continue with interpretation
-    } else if (theStatus == UseNdbRecord) {
-      /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-      setErrorCodeAbort(4537);
-      return -1;
+      return 0; // Simply continue with interpretation
     } else if (theStatus == GetValue) {
       theInitialReadSize = theTotalCurrAI_Len - AttrInfo::SectionSizeInfoLength;
       theStatus = ExecInterpretedValue;
@@ -272,13 +290,15 @@ NdbOperation::labelCheck()
 int
 NdbOperation::intermediate_interpreterCheck()
 {
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
     if (theStatus == ExecInterpretedValue) {
-       return 0; // Simply continue with interpretation
-    } else if (theStatus == UseNdbRecord) {
-      /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-      setErrorCodeAbort(4537);
-      return -1;
+      return 0; // Simply continue with interpretation
     } else if (theStatus == SubroutineExec) {
        return 0; // Simply continue with interpretation
     } else {
diff -Nrup a/storage/ndb/test/ndbapi/testScan.cpp b/storage/ndb/test/ndbapi/testScan.cpp
--- a/storage/ndb/test/ndbapi/testScan.cpp	2008-02-19 15:00:28 +00:00
+++ b/storage/ndb/test/ndbapi/testScan.cpp	2008-04-28 15:17:16 +01:00
@@ -1164,6 +1164,45 @@ runScanVariants(NDBT_Context* ctx, NDBT_
 }
 
 int
+runBug36124(NDBT_Context* ctx, NDBT_Step* step){
+  Ndb * pNdb = GETNDB(step);
+  const NdbDictionary::Table*  pTab = ctx->getTab();
+
+  NdbTransaction* pCon = pNdb->startTransaction();
+  NdbScanOperation* pOp = pCon->getNdbScanOperation(pTab->getName());
+  if (pOp == NULL) {
+    ERR(pCon->getNdbError());
+    return NDBT_FAILED;
+  }
+  
+  if( pOp->readTuples(NdbOperation::LM_Read) != 0) 
+  {
+    ERR(pCon->getNdbError());
+    return NDBT_FAILED;
+  }
+
+  if( pOp->getValue(NdbDictionary::Column::ROW_COUNT) == 0)
+  {
+    ERR(pCon->getNdbError());
+    return NDBT_FAILED;
+  }
+
+  /* Old style interpreted code api should fail when 
+   * we try to use it 
+   */
+  if( pOp->interpret_exit_last_row() == 0)
+  {
+    return NDBT_FAILED;
+  }
+
+  pOp->close();
+
+  pCon->close();
+
+  return NDBT_OK;
+}
+
+int
 runBug24447(NDBT_Context* ctx, NDBT_Step* step){
   int loops = 1; //ctx->getNumLoops();
   int records = ctx->getNumRecords();
@@ -1678,6 +1717,12 @@ TESTCASE("Bug24447",
 	 ""){
   INITIALIZER(runLoadTable);
   STEP(runBug24447);
+  FINALIZER(runClearTable);
+}
+TESTCASE("Bug36124",
+         "Old interpreted Api usage"){
+  INITIALIZER(runLoadTable);
+  STEP(runBug36124);
   FINALIZER(runClearTable);
 }
 NDBT_TESTSUITE_END(testScan);
diff -Nrup a/storage/ndb/test/run-test/daily-basic-tests.txt
b/storage/ndb/test/run-test/daily-basic-tests.txt
--- a/storage/ndb/test/run-test/daily-basic-tests.txt	2008-04-25 10:17:13 +01:00
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2008-04-28 15:17:18 +01:00
@@ -485,6 +485,10 @@ max-time: 1000
 cmd: testScan
 args: -n ScanVariants
 
+max-time: 500
+cmd: testScan
+args: -n Bug36124 T1
+
 max-time: 1000
 cmd: testNodeRestart
 args: -n Bug27003 T1
Thread
bk commit into 5.1 tree (frazer:1.2588) BUG#36124Frazer Clement28 Apr 2008