Commit 2f2ab546 authored by unknown's avatar unknown
Browse files

bug#11205 - ndb - 4006 when starting scan


mysql-test/r/ndb_subquery.result:
  Add testing of new 4006 handling
mysql-test/t/ndb_subquery.test:
  Add testing of new 4006 handling
ndb/include/ndbapi/Ndb.hpp:
  Check #transactions in startTransaction instead of getNdbCon
ndb/src/ndbapi/Ndb.cpp:
  Check #transactions in startTransaction instead of getNdbCon
ndb/src/ndbapi/NdbScanOperation.cpp:
  Check #transactions in startTransaction instead of getNdbCon
ndb/src/ndbapi/Ndbif.cpp:
  Check #transactions in startTransaction instead of getNdbCon
ndb/src/ndbapi/Ndbinit.cpp:
  Check #transactions in startTransaction instead of getNdbCon
ndb/src/ndbapi/Ndblist.cpp:
  Check #transactions in startTransaction instead of getNdbCon
ndb/test/ndbapi/testNdbApi.cpp:
  Check #transactions in startTransaction instead of getNdbCon
ndb/test/run-test/daily-basic-tests.txt:
  Check #transactions in startTransaction instead of getNdbCon
sql/ha_ndbcluster.cc:
  Check #transactions in startTransaction instead of getNdbCon
parent af0287be
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -40,3 +40,22 @@ p u o
5	5	5
drop table t1;
drop table t2;
create table t1 (p int not null primary key, u int not null) engine=ndb;
insert into t1 values (1,1),(2,2),(3,3);
create table t2 as 
select t1.*
from t1 as t1, t1 as t2, t1 as t3, t1 as t4, t1 as t5, t1 as t6, t1 as t7, t1 as t8
where t1.u = t2.u
and t2.u = t3.u
and t3.u = t4.u
and t4.u = t5.u
and t5.u = t6.u
and t6.u = t7.u
and t7.u = t8.u;
select * from t2 order by 1;
p	u
1	1
2	2
3	3
drop table t1;
drop table t2;
+23 −0
Original line number Diff line number Diff line
@@ -37,3 +37,26 @@ drop table t1;
drop table t2;
# bug#5367
##########

###
# bug#11205
create table t1 (p int not null primary key, u int not null) engine=ndb;
insert into t1 values (1,1),(2,2),(3,3);

create table t2 as 
select t1.*
from t1 as t1, t1 as t2, t1 as t3, t1 as t4, t1 as t5, t1 as t6, t1 as t7, t1 as t8
where t1.u = t2.u
  and t2.u = t3.u
  and t3.u = t4.u
  and t4.u = t5.u
  and t5.u = t6.u
  and t6.u = t7.u
  and t7.u = t8.u;

select * from t2 order by 1;

drop table t1;
drop table t2;

+1 −1
Original line number Diff line number Diff line
@@ -1543,7 +1543,7 @@ private:
  Uint32                theNoOfPreparedTransactions;
  Uint32                theNoOfSentTransactions;
  Uint32                theNoOfCompletedTransactions;
  Uint32                theNoOfAllocatedTransactions;
  Uint32                theRemainingStartTransactions;
  Uint32                theMaxNoOfTransactions;
  Uint32                theMinNoOfEventsToWakeUp;

+9 −0
Original line number Diff line number Diff line
@@ -390,6 +390,14 @@ Ndb::startTransactionLocal(Uint32 aPriority, Uint32 nodeId)
  DBUG_ENTER("Ndb::startTransactionLocal");
  DBUG_PRINT("enter", ("nodeid: %d", nodeId));

  if(unlikely(theRemainingStartTransactions == 0))
  {
    theError.code = 4006;
    DBUG_RETURN(0);
  }
  
  theRemainingStartTransactions--;

  NdbConnection* tConnection;
  Uint64 tFirstTransId = theFirstTransId;
  tConnection = doConnect(nodeId);
@@ -446,6 +454,7 @@ Ndb::closeTransaction(NdbConnection* aConnection)
  CHECK_STATUS_MACRO_VOID;
  
  tCon = theTransactionList;
  theRemainingStartTransactions++;
  
  DBUG_PRINT("info",("close trans: 0x%x transid: 0x%llx",
		     aConnection, aConnection->getTransactionId()));
+4 −0
Original line number Diff line number Diff line
@@ -104,14 +104,17 @@ NdbScanOperation::init(const NdbTableImpl* tab, NdbConnection* myConnection)
{
  m_transConnection = myConnection;
  //NdbConnection* aScanConnection = theNdb->startTransaction(myConnection);
  theNdb->theRemainingStartTransactions++; // will be checked in hupp...
  NdbConnection* aScanConnection = theNdb->hupp(myConnection);
  if (!aScanConnection){
    theNdb->theRemainingStartTransactions--;
    setErrorCodeAbort(theNdb->getNdbError().code);
    return -1;
  }

  // NOTE! The hupped trans becomes the owner of the operation
  if(NdbOperation::init(tab, aScanConnection) != 0){
    theNdb->theRemainingStartTransactions--;
    return -1;
  }
  
@@ -705,6 +708,7 @@ void NdbScanOperation::closeScan(bool forceSend, bool releaseOp)
  
  tCon->theScanningOp = 0;
  theNdb->closeTransaction(tCon);
  theNdb->theRemainingStartTransactions--;
}

void
Loading