Commit 5e458aac authored by unknown's avatar unknown

bug #5872, transactions should only be restarted with transaction.on flag off...

bug #5872, transactions should only be restarted with transaction.on flag off if execute_commit has been performed
added testcase for this
use force send for all executes


mysql-test/r/ndb_blob.result:
  added testcase for alter table of blob from ndb to myisam
mysql-test/t/ndb_blob.test:
  added testcase for alter table of blob from ndb to myisam
sql/ha_ndbcluster.cc:
  bug #5872, transactions should only be restarted with transaction.on flag off if execute_commit has been performed
  use force send for all executes
parent b3b26c05
...@@ -397,4 +397,9 @@ select * from t1 order by a; ...@@ -397,4 +397,9 @@ select * from t1 order by a;
a b a b
1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
drop table t1; drop table t1;
...@@ -309,6 +309,7 @@ select count(*) from t1; ...@@ -309,6 +309,7 @@ select count(*) from t1;
drop table t1; drop table t1;
drop database mysqltest; drop database mysqltest;
# bug #5349
set autocommit=1; set autocommit=1;
use test; use test;
CREATE TABLE t1 ( CREATE TABLE t1 (
...@@ -325,4 +326,8 @@ INSERT INTO t1 VALUES ...@@ -325,4 +326,8 @@ INSERT INTO t1 VALUES
select * from t1 order by a; select * from t1 order by a;
alter table t1 engine=ndb; alter table t1 engine=ndb;
select * from t1 order by a; select * from t1 order by a;
# bug #5872
alter table t1 engine=myisam;
select * from t1 order by a;
drop table t1; drop table t1;
...@@ -147,7 +147,25 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans) ...@@ -147,7 +147,25 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans)
int m_batch_execute= 0; int m_batch_execute= 0;
if (false && m_batch_execute) if (false && m_batch_execute)
return 0; return 0;
return trans->execute(NoCommit); return trans->execute(NoCommit,AbortOnError,1);
}
inline
int execute_commit(ha_ndbcluster *h, NdbConnection *trans)
{
int m_batch_execute= 0;
if (false && m_batch_execute)
return 0;
return trans->execute(Commit,AbortOnError,1);
}
inline
int execute_no_commit_ie(ha_ndbcluster *h, NdbConnection *trans)
{
int m_batch_execute= 0;
if (false && m_batch_execute)
return 0;
return trans->execute(NoCommit,IgnoreError,1);
} }
/* /*
...@@ -1006,7 +1024,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf) ...@@ -1006,7 +1024,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
} }
} }
if (trans->execute(NoCommit, IgnoreError) != 0) if (execute_no_commit_ie(this,trans) != 0)
{ {
table->status= STATUS_NOT_FOUND; table->status= STATUS_NOT_FOUND;
DBUG_RETURN(ndb_err(trans)); DBUG_RETURN(ndb_err(trans));
...@@ -1127,7 +1145,7 @@ int ha_ndbcluster::unique_index_read(const byte *key, ...@@ -1127,7 +1145,7 @@ int ha_ndbcluster::unique_index_read(const byte *key,
} }
} }
if (trans->execute(NoCommit, IgnoreError) != 0) if (execute_no_commit_ie(this,trans) != 0)
{ {
table->status= STATUS_NOT_FOUND; table->status= STATUS_NOT_FOUND;
DBUG_RETURN(ndb_err(trans)); DBUG_RETURN(ndb_err(trans));
...@@ -1197,18 +1215,20 @@ inline int ha_ndbcluster::next_result(byte *buf) ...@@ -1197,18 +1215,20 @@ inline int ha_ndbcluster::next_result(byte *buf)
be sent to NDB be sent to NDB
*/ */
DBUG_PRINT("info", ("ops_pending: %d", ops_pending)); DBUG_PRINT("info", ("ops_pending: %d", ops_pending));
{
if (current_thd->transaction.on) if (current_thd->transaction.on)
{ {
if (ops_pending && (execute_no_commit(this,trans) != 0)) if (execute_no_commit(this,trans) != 0)
DBUG_RETURN(ndb_err(trans)); DBUG_RETURN(ndb_err(trans));
} }
else else
{ {
if (ops_pending && (trans->execute(Commit) != 0)) if (execute_commit(this,trans) != 0)
DBUG_RETURN(ndb_err(trans)); DBUG_RETURN(ndb_err(trans));
trans->restart(); DBUG_ASSERT(trans->restart() == 0);
} }
ops_pending= 0; ops_pending= 0;
}
contact_ndb= (check == 2); contact_ndb= (check == 2);
} }
...@@ -1639,13 +1659,13 @@ int ha_ndbcluster::write_row(byte *record) ...@@ -1639,13 +1659,13 @@ int ha_ndbcluster::write_row(byte *record)
} }
else else
{ {
if (trans->execute(Commit) != 0) if (execute_commit(this,trans) != 0)
{ {
skip_auto_increment= true; skip_auto_increment= true;
no_uncommitted_rows_execute_failure(); no_uncommitted_rows_execute_failure();
DBUG_RETURN(ndb_err(trans)); DBUG_RETURN(ndb_err(trans));
} }
trans->restart(); DBUG_ASSERT(trans->restart() == 0);
} }
} }
if ((has_auto_increment) && (skip_auto_increment)) if ((has_auto_increment) && (skip_auto_increment))
...@@ -2282,7 +2302,7 @@ int ha_ndbcluster::rnd_init(bool scan) ...@@ -2282,7 +2302,7 @@ int ha_ndbcluster::rnd_init(bool scan)
{ {
if (!scan) if (!scan)
DBUG_RETURN(1); DBUG_RETURN(1);
cursor->restart(); DBUG_ASSERT(cursor->restart() == 0);
} }
index_init(table->primary_key); index_init(table->primary_key);
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -2929,7 +2949,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction) ...@@ -2929,7 +2949,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction)
"stmt" : "all")); "stmt" : "all"));
DBUG_ASSERT(ndb && trans); DBUG_ASSERT(ndb && trans);
if (trans->execute(Commit) != 0) if (execute_commit(0,trans) != 0)
{ {
const NdbError err= trans->getNdbError(); const NdbError err= trans->getNdbError();
const NdbOperation *error_op= trans->getNdbErrorOperation(); const NdbOperation *error_op= trans->getNdbErrorOperation();
......
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