Commit 9ba92d7c authored by unknown's avatar unknown

Fix testOIBasic

1) Close transaction whenever Con goes out of scope so that it don't leave open
   transactions in TC
2) Close transaction when starting a transaction wo/ closing first
3) Allow 499 as deadlock
4) Don't use buddy as: 1) no need 2) harder to read signal log
parent 526f2ddb
...@@ -624,6 +624,11 @@ struct Con { ...@@ -624,6 +624,11 @@ struct Con {
Con() : Con() :
m_ndb(0), m_dic(0), m_tx(0), m_op(0), m_ndb(0), m_dic(0), m_tx(0), m_op(0),
m_scanop(0), m_indexscanop(0), m_resultset(0), m_scanmode(ScanNo), m_errtype(ErrNone) {} m_scanop(0), m_indexscanop(0), m_resultset(0), m_scanmode(ScanNo), m_errtype(ErrNone) {}
~Con(){
if(m_tx) closeTransaction();
}
int connect(); int connect();
void disconnect(); void disconnect();
int startTransaction(); int startTransaction();
...@@ -674,7 +679,8 @@ Con::disconnect() ...@@ -674,7 +679,8 @@ Con::disconnect()
int int
Con::startTransaction() Con::startTransaction()
{ {
assert(m_ndb != 0 && m_tx == 0); assert(m_ndb != 0);
if(m_tx) closeTransaction();
CHKCON((m_tx = m_ndb->startTransaction()) != 0, *this); CHKCON((m_tx = m_ndb->startTransaction()) != 0, *this);
return 0; return 0;
} }
...@@ -824,7 +830,7 @@ Con::printerror(NdbOut& out) ...@@ -824,7 +830,7 @@ Con::printerror(NdbOut& out)
if (m_tx) { if (m_tx) {
if ((code = m_tx->getNdbError().code) != 0) { if ((code = m_tx->getNdbError().code) != 0) {
LL0(++any << " con: error " << m_tx->getNdbError()); LL0(++any << " con: error " << m_tx->getNdbError());
if (code == 266 || code == 274 || code == 296 || code == 297) if (code == 266 || code == 274 || code == 296 || code == 297 || code == 499)
m_errtype = ErrDeadlock; m_errtype = ErrDeadlock;
} }
if (m_op && m_op->getNdbError().code != 0) { if (m_op && m_op->getNdbError().code != 0) {
...@@ -2295,7 +2301,7 @@ scanupdatetable(Par par) ...@@ -2295,7 +2301,7 @@ scanupdatetable(Par par)
// updating trans // updating trans
Con con2; Con con2;
con2.m_ndb = con.m_ndb; con2.m_ndb = con.m_ndb;
CHK(con2.startBuddyTransaction(con) == 0); CHK(con2.startTransaction(con) == 0);
while (1) { while (1) {
int ret; int ret;
CHK((ret = con.nextScanResult()) == 0 || ret == 1); CHK((ret = con.nextScanResult()) == 0 || ret == 1);
...@@ -2341,7 +2347,7 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset) ...@@ -2341,7 +2347,7 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset)
// updating trans // updating trans
Con con2; Con con2;
con2.m_ndb = con.m_ndb; con2.m_ndb = con.m_ndb;
CHK(con2.startBuddyTransaction(con) == 0); CHK(con2.startTransaction(con) == 0);
while (1) { while (1) {
int ret; int ret;
CHK((ret = con.nextScanResult()) == 0 || ret == 1); CHK((ret = con.nextScanResult()) == 0 || ret == 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