mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
BUG#27495: Missing implementation of NdbTransaction::executeAsynch().
NdbTransaction::executeAsynch() was not implemented. Add implementation.
This commit is contained in:
parent
a449d1de33
commit
32e7f9e62d
6 changed files with 167 additions and 3 deletions
35
mysql-test/r/bdb_notembedded.result
Normal file
35
mysql-test/r/bdb_notembedded.result
Normal file
|
@ -0,0 +1,35 @@
|
|||
set autocommit=1;
|
||||
reset master;
|
||||
create table bug16206 (a int);
|
||||
insert into bug16206 values(1);
|
||||
start transaction;
|
||||
insert into bug16206 values(2);
|
||||
commit;
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
|
||||
f n Query 1 n use `test`; create table bug16206 (a int)
|
||||
f n Query 1 n use `test`; insert into bug16206 values(1)
|
||||
f n Query 1 n use `test`; insert into bug16206 values(2)
|
||||
drop table bug16206;
|
||||
reset master;
|
||||
create table bug16206 (a int) engine= bdb;
|
||||
insert into bug16206 values(0);
|
||||
insert into bug16206 values(1);
|
||||
start transaction;
|
||||
insert into bug16206 values(2);
|
||||
commit;
|
||||
insert into bug16206 values(3);
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
|
||||
f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb
|
||||
f n Query 1 n use `test`; insert into bug16206 values(0)
|
||||
f n Query 1 n use `test`; insert into bug16206 values(1)
|
||||
f n Query 1 n use `test`; BEGIN
|
||||
f n Query 1 n use `test`; insert into bug16206 values(2)
|
||||
f n Query 1 n use `test`; COMMIT
|
||||
f n Query 1 n use `test`; insert into bug16206 values(3)
|
||||
drop table bug16206;
|
||||
set autocommit=0;
|
||||
End of 5.0 tests
|
38
mysql-test/t/bdb_notembedded.test
Normal file
38
mysql-test/t/bdb_notembedded.test
Normal file
|
@ -0,0 +1,38 @@
|
|||
-- source include/not_embedded.inc
|
||||
-- source include/have_bdb.inc
|
||||
|
||||
#
|
||||
# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode
|
||||
#
|
||||
set autocommit=1;
|
||||
|
||||
let $VERSION=`select version()`;
|
||||
|
||||
reset master;
|
||||
create table bug16206 (a int);
|
||||
insert into bug16206 values(1);
|
||||
start transaction;
|
||||
insert into bug16206 values(2);
|
||||
commit;
|
||||
--replace_result $VERSION VERSION
|
||||
--replace_column 1 f 2 n 5 n
|
||||
show binlog events;
|
||||
drop table bug16206;
|
||||
|
||||
reset master;
|
||||
create table bug16206 (a int) engine= bdb;
|
||||
insert into bug16206 values(0);
|
||||
insert into bug16206 values(1);
|
||||
start transaction;
|
||||
insert into bug16206 values(2);
|
||||
commit;
|
||||
insert into bug16206 values(3);
|
||||
--replace_result $VERSION VERSION
|
||||
--replace_column 1 f 2 n 5 n
|
||||
show binlog events;
|
||||
drop table bug16206;
|
||||
|
||||
set autocommit=0;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
|
@ -379,14 +379,16 @@ public:
|
|||
void executeAsynch(ExecType aTypeOfExec,
|
||||
NdbAsynchCallback aCallback,
|
||||
void* anyObject,
|
||||
AbortOption abortOption = AbortOnError);
|
||||
AbortOption abortOption = AbortOnError,
|
||||
int forceSend= 0);
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
|
||||
void executeAsynch(::ExecType aTypeOfExec,
|
||||
NdbAsynchCallback aCallback,
|
||||
void* anyObject,
|
||||
::AbortOption abortOption= ::AbortOnError)
|
||||
::AbortOption abortOption= ::AbortOnError,
|
||||
int forceSend= 0)
|
||||
{ executeAsynch((ExecType)aTypeOfExec, aCallback, anyObject,
|
||||
(AbortOption)abortOption); }
|
||||
(AbortOption)abortOption, forceSend); }
|
||||
#endif
|
||||
#endif
|
||||
/**
|
||||
|
|
|
@ -694,6 +694,17 @@ NdbTransaction::executeAsynchPrepare( ExecType aTypeOfExec,
|
|||
DBUG_VOID_RETURN;
|
||||
}//NdbTransaction::executeAsynchPrepare()
|
||||
|
||||
void
|
||||
NdbTransaction::executeAsynch(ExecType aTypeOfExec,
|
||||
NdbAsynchCallback aCallback,
|
||||
void* anyObject,
|
||||
AbortOption abortOption,
|
||||
int forceSend)
|
||||
{
|
||||
executeAsynchPrepare(aTypeOfExec, aCallback, anyObject, abortOption);
|
||||
theNdb->sendPreparedTransactions(forceSend);
|
||||
}
|
||||
|
||||
void NdbTransaction::close()
|
||||
{
|
||||
theNdb->closeTransaction(this);
|
||||
|
|
|
@ -1234,6 +1234,76 @@ int runScan_4006(NDBT_Context* ctx, NDBT_Step* step){
|
|||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
testExecuteAsynchCallback(int res, NdbTransaction *con, void *data_ptr)
|
||||
{
|
||||
int *res_ptr= (int *)data_ptr;
|
||||
|
||||
*res_ptr= res;
|
||||
}
|
||||
|
||||
int runTestExecuteAsynch(NDBT_Context* ctx, NDBT_Step* step){
|
||||
/* Test that NdbTransaction::executeAsynch() works (BUG#27495). */
|
||||
int result = NDBT_OK;
|
||||
const NdbDictionary::Table* pTab = ctx->getTab();
|
||||
|
||||
Ndb* pNdb = new Ndb(&ctx->m_cluster_connection, "TEST_DB");
|
||||
if (pNdb == NULL){
|
||||
ndbout << "pNdb == NULL" << endl;
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
if (pNdb->init(2048)){
|
||||
ERR(pNdb->getNdbError());
|
||||
delete pNdb;
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
|
||||
NdbConnection* pCon = pNdb->startTransaction();
|
||||
if (pCon == NULL){
|
||||
ERR(pNdb->getNdbError());
|
||||
delete pNdb;
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
|
||||
NdbScanOperation* pOp = pCon->getNdbScanOperation(pTab->getName());
|
||||
if (pOp == NULL){
|
||||
ERR(pOp->getNdbError());
|
||||
pNdb->closeTransaction(pCon);
|
||||
delete pNdb;
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
|
||||
if (pOp->readTuples() != 0){
|
||||
ERR(pOp->getNdbError());
|
||||
pNdb->closeTransaction(pCon);
|
||||
delete pNdb;
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
|
||||
if (pOp->getValue(NdbDictionary::Column::FRAGMENT) == 0){
|
||||
ERR(pOp->getNdbError());
|
||||
pNdb->closeTransaction(pCon);
|
||||
delete pNdb;
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
int res= 42;
|
||||
pCon->executeAsynch(NoCommit, testExecuteAsynchCallback, &res);
|
||||
while(pNdb->pollNdb(100000) == 0)
|
||||
;
|
||||
if (res != 0){
|
||||
ERR(pCon->getNdbError());
|
||||
ndbout << "Error returned from execute: " << res << endl;
|
||||
result= NDBT_FAILED;
|
||||
}
|
||||
|
||||
pNdb->closeTransaction(pCon);
|
||||
|
||||
delete pNdb;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
template class Vector<NdbScanOperation*>;
|
||||
|
||||
|
||||
|
@ -1322,6 +1392,10 @@ TESTCASE("Scan_4006",
|
|||
INITIALIZER(runScan_4006);
|
||||
FINALIZER(runClearTable);
|
||||
}
|
||||
TESTCASE("ExecuteAsynch",
|
||||
"Check that executeAsync() works (BUG#27495)\n"){
|
||||
INITIALIZER(runTestExecuteAsynch);
|
||||
}
|
||||
NDBT_TESTSUITE_END(testNdbApi);
|
||||
|
||||
int main(int argc, const char** argv){
|
||||
|
|
|
@ -609,6 +609,10 @@ max-time: 500
|
|||
cmd: testNdbApi
|
||||
args: -n Scan_4006 T1
|
||||
|
||||
max-time: 500
|
||||
cmd: testNdbApi
|
||||
args: -n ExecuteAsynch T1
|
||||
|
||||
#max-time: 500
|
||||
#cmd: testInterpreter
|
||||
#args: T1
|
||||
|
|
Loading…
Add table
Reference in a new issue