Commit 3962e2d4 authored by unknown's avatar unknown

ndb - bug#27437

  bug in interpretedupdate (used for auto-increment) that made TUPKEYREF be sent twice
  this was however "normally" shadowed, but made LQH crash when LCP was about to start


mysql-test/r/ndb_basic.result:
  testcase
mysql-test/t/ndb_basic.test:
  testcase
ndb/src/kernel/blocks/dblqh/Dblqh.hpp:
  add extra variable to make sure TUPKEYREF is not received twice (VM_TRACE)
ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  add extra variable to make sure TUPKEYREF is not received twice (VM_TRACE)
ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
  make sure TUPKEYREF is not sent twice in case of "error" in interpreted program
parent 16f8fa13
...@@ -667,6 +667,12 @@ counter datavalue ...@@ -667,6 +667,12 @@ counter datavalue
57 newval 57 newval
58 newval 58 newval
drop table t1; drop table t1;
create table t1 (a int primary key auto_increment) engine = ndb;
insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
insert into t1(a) values (20),(28);
insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
insert into t1() values (21), (22);
drop table t1;
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb; CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1; select * from t1;
b b
......
...@@ -606,6 +606,21 @@ select * from t1 order by counter; ...@@ -606,6 +606,21 @@ select * from t1 order by counter;
drop table t1; drop table t1;
#
# bug#27437
connection con1;
create table t1 (a int primary key auto_increment) engine = ndb;
insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
connection con2;
insert into t1(a) values (20),(28);
connection con1;
insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
connection con2;
insert into t1() values (21), (22);
connection con1;
drop table t1;
# #
# BUG#14514 Creating table with packed key fails silently # BUG#14514 Creating table with packed key fails silently
# #
......
...@@ -2059,6 +2059,9 @@ public: ...@@ -2059,6 +2059,9 @@ public:
Uint8 simpleRead; Uint8 simpleRead;
Uint8 seqNoReplica; Uint8 seqNoReplica;
Uint8 tcNodeFailrec; Uint8 tcNodeFailrec;
#ifdef VM_TRACE
Uint8 tupkeyref;
#endif
}; /* p2c: size = 280 bytes */ }; /* p2c: size = 280 bytes */
typedef Ptr<TcConnectionrec> TcConnectionrecPtr; typedef Ptr<TcConnectionrec> TcConnectionrecPtr;
......
...@@ -2766,6 +2766,12 @@ void Dblqh::execTUPKEYREF(Signal* signal) ...@@ -2766,6 +2766,12 @@ void Dblqh::execTUPKEYREF(Signal* signal)
tcConnectptr.i = tupKeyRef->userRef; tcConnectptr.i = tupKeyRef->userRef;
terrorCode = tupKeyRef->errorCode; terrorCode = tupKeyRef->errorCode;
ptrCheckGuard(tcConnectptr, ctcConnectrecFileSize, tcConnectionrec); ptrCheckGuard(tcConnectptr, ctcConnectrecFileSize, tcConnectionrec);
#ifdef VM_TRACE
ndbrequire(tcConnectptr.p->tupkeyref == 0);
tcConnectptr.p->tupkeyref = 1;
#endif
switch (tcConnectptr.p->transactionState) { switch (tcConnectptr.p->transactionState) {
case TcConnectionrec::WAIT_TUP: case TcConnectionrec::WAIT_TUP:
jam(); jam();
...@@ -3331,6 +3337,10 @@ void Dblqh::seizeTcrec() ...@@ -3331,6 +3337,10 @@ void Dblqh::seizeTcrec()
locTcConnectptr.p->tcTimer = cLqhTimeOutCount; locTcConnectptr.p->tcTimer = cLqhTimeOutCount;
locTcConnectptr.p->tableref = RNIL; locTcConnectptr.p->tableref = RNIL;
locTcConnectptr.p->savePointId = 0; locTcConnectptr.p->savePointId = 0;
#ifdef VM_TRACE
locTcConnectptr.p->tupkeyref = 0;
#endif
cfirstfreeTcConrec = nextTc; cfirstfreeTcConrec = nextTc;
tcConnectptr = locTcConnectptr; tcConnectptr = locTcConnectptr;
locTcConnectptr.p->connectState = TcConnectionrec::CONNECTED; locTcConnectptr.p->connectState = TcConnectionrec::CONNECTED;
...@@ -5861,6 +5871,10 @@ void Dblqh::completeUnusualLab(Signal* signal) ...@@ -5861,6 +5871,10 @@ void Dblqh::completeUnusualLab(Signal* signal)
void Dblqh::releaseTcrec(Signal* signal, TcConnectionrecPtr locTcConnectptr) void Dblqh::releaseTcrec(Signal* signal, TcConnectionrecPtr locTcConnectptr)
{ {
jam(); jam();
#ifdef VM_TRACE
locTcConnectptr.p->tupkeyref = 0;
#endif
locTcConnectptr.p->tcTimer = 0; locTcConnectptr.p->tcTimer = 0;
locTcConnectptr.p->transactionState = TcConnectionrec::TC_NOT_CONNECTED; locTcConnectptr.p->transactionState = TcConnectionrec::TC_NOT_CONNECTED;
locTcConnectptr.p->nextTcConnectrec = cfirstfreeTcConrec; locTcConnectptr.p->nextTcConnectrec = cfirstfreeTcConrec;
...@@ -5883,6 +5897,9 @@ void Dblqh::releaseTcrec(Signal* signal, TcConnectionrecPtr locTcConnectptr) ...@@ -5883,6 +5897,9 @@ void Dblqh::releaseTcrec(Signal* signal, TcConnectionrecPtr locTcConnectptr)
void Dblqh::releaseTcrecLog(Signal* signal, TcConnectionrecPtr locTcConnectptr) void Dblqh::releaseTcrecLog(Signal* signal, TcConnectionrecPtr locTcConnectptr)
{ {
jam(); jam();
#ifdef VM_TRACE
locTcConnectptr.p->tupkeyref = 0;
#endif
locTcConnectptr.p->tcTimer = 0; locTcConnectptr.p->tcTimer = 0;
locTcConnectptr.p->transactionState = TcConnectionrec::TC_NOT_CONNECTED; locTcConnectptr.p->transactionState = TcConnectionrec::TC_NOT_CONNECTED;
locTcConnectptr.p->nextTcConnectrec = cfirstfreeTcConrec; locTcConnectptr.p->nextTcConnectrec = cfirstfreeTcConrec;
......
...@@ -1139,7 +1139,11 @@ Dbtup::updateStartLab(Signal* signal, ...@@ -1139,7 +1139,11 @@ Dbtup::updateStartLab(Signal* signal,
regOperPtr->attrinbufLen); regOperPtr->attrinbufLen);
} else { } else {
jam(); jam();
retValue = interpreterStartLab(signal, pagePtr, regOperPtr->pageOffset); if (interpreterStartLab(signal, pagePtr, regOperPtr->pageOffset) == -1)
{
jam();
return -1;
}
}//if }//if
if (retValue == -1) { if (retValue == -1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment