mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
NDB blobs - try to handle insert-update-delete under autocommit=0
ndb/src/ndbapi/ndberror.c: 826 error text mysql-test/r/ndb_blob.result: result displayed error mysql-test/t/ndb_blob.test: result displayed error ndb/src/ndbapi/NdbBlob.cpp: update head+inline earlier ndb/src/ndbapi/NdbOperationExec.cpp: blob IgnoreError bug ndb/test/ndbapi/testBlobs.cpp: tried to set non-nullable to null, causing a complex abort case ndb/src/ndbapi/NdbConnection.cpp: prepared ops CAN be left in complex abort
This commit is contained in:
@@ -414,6 +414,7 @@ a b c d
|
|||||||
9 b9 999 dd9
|
9 b9 999 dd9
|
||||||
drop table t1;
|
drop table t1;
|
||||||
drop database test2;
|
drop database test2;
|
||||||
|
set autocommit=0;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
a int not null primary key,
|
a int not null primary key,
|
||||||
b tinytext
|
b tinytext
|
||||||
@@ -422,9 +423,13 @@ insert into t1 values(1, 'x');
|
|||||||
update t1 set b = 'y';
|
update t1 set b = 'y';
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a b
|
a b
|
||||||
1 x
|
1 y
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
select * from t1;
|
||||||
|
a b
|
||||||
|
commit;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
set autocommit=0;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
a int not null primary key,
|
a int not null primary key,
|
||||||
b text not null
|
b text not null
|
||||||
@@ -433,6 +438,7 @@ insert into t1 values(1, '');
|
|||||||
select * from t1;
|
select * from t1;
|
||||||
a b
|
a b
|
||||||
1
|
1
|
||||||
|
commit;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
set autocommit=1;
|
set autocommit=1;
|
||||||
use test;
|
use test;
|
||||||
@@ -454,6 +460,7 @@ select * from t1 order by a;
|
|||||||
a b
|
a b
|
||||||
1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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BBBBBBBBBBBBBBBBBBBBBBBBBBB
|
2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
||||||
|
set autocommit=1;
|
||||||
alter table t1 engine=myisam;
|
alter table t1 engine=myisam;
|
||||||
select * from t1 order by a;
|
select * from t1 order by a;
|
||||||
a b
|
a b
|
||||||
|
@@ -337,8 +337,9 @@ select * from t1 order by a;
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
drop database test2;
|
drop database test2;
|
||||||
|
|
||||||
# -- bug-5252 tinytext crashes --
|
# -- bug-5252 tinytext crashes plus no-commit result --
|
||||||
|
|
||||||
|
set autocommit=0;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
a int not null primary key,
|
a int not null primary key,
|
||||||
b tinytext
|
b tinytext
|
||||||
@@ -348,10 +349,13 @@ insert into t1 values(1, 'x');
|
|||||||
update t1 set b = 'y';
|
update t1 set b = 'y';
|
||||||
select * from t1;
|
select * from t1;
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
select * from t1;
|
||||||
|
commit;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
# -- bug-5013 insert empty string to text --
|
# -- bug-5013 insert empty string to text --
|
||||||
|
|
||||||
|
set autocommit=0;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
a int not null primary key,
|
a int not null primary key,
|
||||||
b text not null
|
b text not null
|
||||||
@@ -359,6 +363,7 @@ create table t1 (
|
|||||||
|
|
||||||
insert into t1 values(1, '');
|
insert into t1 values(1, '');
|
||||||
select * from t1;
|
select * from t1;
|
||||||
|
commit;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
# -- bug #5349 --
|
# -- bug #5349 --
|
||||||
@@ -380,6 +385,7 @@ alter table t1 engine=ndb;
|
|||||||
select * from t1 order by a;
|
select * from t1 order by a;
|
||||||
|
|
||||||
# -- bug #5872 --
|
# -- bug #5872 --
|
||||||
|
set autocommit=1;
|
||||||
alter table t1 engine=myisam;
|
alter table t1 engine=myisam;
|
||||||
select * from t1 order by a;
|
select * from t1 order by a;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@@ -1428,6 +1428,18 @@ NdbBlob::postExecute(ExecType anExecType)
|
|||||||
if (invokeActiveHook() == -1)
|
if (invokeActiveHook() == -1)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (anExecType == NoCommit && theHeadInlineUpdateFlag) {
|
||||||
|
NdbOperation* tOp = theNdbCon->getNdbOperation(theTable);
|
||||||
|
if (tOp == NULL ||
|
||||||
|
tOp->updateTuple() == -1 ||
|
||||||
|
setTableKeyValue(tOp) == -1 ||
|
||||||
|
setHeadInlineValue(tOp) == -1) {
|
||||||
|
setErrorCode(ErrAbort);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
tOp->m_abortOption = AbortOnError;
|
||||||
|
DBG("added op to update head+inline");
|
||||||
|
}
|
||||||
DBG("postExecute [out]");
|
DBG("postExecute [out]");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -340,7 +340,12 @@ NdbConnection::execute(ExecType aTypeOfExec,
|
|||||||
|
|
||||||
if (executeNoBlobs(tExecType, abortOption, forceSend) == -1)
|
if (executeNoBlobs(tExecType, abortOption, forceSend) == -1)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
#ifndef VM_TRACE
|
||||||
|
// can happen in complex abort cases
|
||||||
|
theFirstOpInList = theLastOpInList = NULL;
|
||||||
|
#else
|
||||||
assert(theFirstOpInList == NULL && theLastOpInList == NULL);
|
assert(theFirstOpInList == NULL && theLastOpInList == NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
NdbOperation* tOp = theCompletedFirstOp;
|
NdbOperation* tOp = theCompletedFirstOp;
|
||||||
|
@@ -552,7 +552,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal)
|
|||||||
theNdbCon->theReturnStatus = NdbConnection::ReturnFailure;
|
theNdbCon->theReturnStatus = NdbConnection::ReturnFailure;
|
||||||
|
|
||||||
theError.code = aSignal->readData(4);
|
theError.code = aSignal->readData(4);
|
||||||
theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4), ao);
|
theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4), m_abortOption);
|
||||||
|
|
||||||
if(theOperationType != ReadRequest || !theSimpleIndicator) // not simple read
|
if(theOperationType != ReadRequest || !theSimpleIndicator) // not simple read
|
||||||
return theNdbCon->OpCompleteFailure(ao, m_abortOption != IgnoreError);
|
return theNdbCon->OpCompleteFailure(ao, m_abortOption != IgnoreError);
|
||||||
|
@@ -150,7 +150,7 @@ ErrorBundle ErrorCodes[] = {
|
|||||||
{ 623, IS, "623" },
|
{ 623, IS, "623" },
|
||||||
{ 624, IS, "624" },
|
{ 624, IS, "624" },
|
||||||
{ 625, IS, "Out of memory in Ndb Kernel, index part" },
|
{ 625, IS, "Out of memory in Ndb Kernel, index part" },
|
||||||
{ 826, IS, "826" },
|
{ 826, IS, "Too many tables and attributes (increase MaxNoOfAttributes)" },
|
||||||
{ 827, IS, "Out of memory in Ndb Kernel, data part" },
|
{ 827, IS, "Out of memory in Ndb Kernel, data part" },
|
||||||
{ 832, IS, "832" },
|
{ 832, IS, "832" },
|
||||||
|
|
||||||
|
@@ -42,6 +42,7 @@ struct Opt {
|
|||||||
bool m_core;
|
bool m_core;
|
||||||
bool m_dbg;
|
bool m_dbg;
|
||||||
bool m_dbgall;
|
bool m_dbgall;
|
||||||
|
const char* m_dbug;
|
||||||
bool m_full;
|
bool m_full;
|
||||||
unsigned m_loop;
|
unsigned m_loop;
|
||||||
unsigned m_parts;
|
unsigned m_parts;
|
||||||
@@ -66,6 +67,7 @@ struct Opt {
|
|||||||
m_core(false),
|
m_core(false),
|
||||||
m_dbg(false),
|
m_dbg(false),
|
||||||
m_dbgall(false),
|
m_dbgall(false),
|
||||||
|
m_dbug(0),
|
||||||
m_full(false),
|
m_full(false),
|
||||||
m_loop(1),
|
m_loop(1),
|
||||||
m_parts(10),
|
m_parts(10),
|
||||||
@@ -100,6 +102,7 @@ printusage()
|
|||||||
<< " -core dump core on error" << endl
|
<< " -core dump core on error" << endl
|
||||||
<< " -dbg print debug" << endl
|
<< " -dbg print debug" << endl
|
||||||
<< " -dbgall print also NDB API debug (if compiled in)" << endl
|
<< " -dbgall print also NDB API debug (if compiled in)" << endl
|
||||||
|
<< " -dbug opt dbug options" << endl
|
||||||
<< " -full read/write only full blob values" << endl
|
<< " -full read/write only full blob values" << endl
|
||||||
<< " -loop N loop N times 0=forever [" << d.m_loop << "]" << endl
|
<< " -loop N loop N times 0=forever [" << d.m_loop << "]" << endl
|
||||||
<< " -parts N max parts in blob value [" << d.m_parts << "]" << endl
|
<< " -parts N max parts in blob value [" << d.m_parts << "]" << endl
|
||||||
@@ -1046,8 +1049,12 @@ writeIdx(int style)
|
|||||||
if (style == 0) {
|
if (style == 0) {
|
||||||
CHK(setBlobValue(tup) == 0);
|
CHK(setBlobValue(tup) == 0);
|
||||||
} else if (style == 1) {
|
} else if (style == 1) {
|
||||||
|
// non-nullable must be set
|
||||||
|
CHK(g_bh1->setValue("", 0) == 0);
|
||||||
CHK(setBlobWriteHook(tup) == 0);
|
CHK(setBlobWriteHook(tup) == 0);
|
||||||
} else {
|
} else {
|
||||||
|
// non-nullable must be set
|
||||||
|
CHK(g_bh1->setValue("", 0) == 0);
|
||||||
CHK(g_con->execute(NoCommit) == 0);
|
CHK(g_con->execute(NoCommit) == 0);
|
||||||
CHK(writeBlobData(tup) == 0);
|
CHK(writeBlobData(tup) == 0);
|
||||||
}
|
}
|
||||||
@@ -1463,6 +1470,12 @@ NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
|
|||||||
putenv(strdup("NDB_BLOB_DEBUG=1"));
|
putenv(strdup("NDB_BLOB_DEBUG=1"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (strcmp(arg, "-dbug") == 0) {
|
||||||
|
if (++argv, --argc > 0) {
|
||||||
|
g_opt.m_dbug = strdup(argv[0]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (strcmp(arg, "-full") == 0) {
|
if (strcmp(arg, "-full") == 0) {
|
||||||
g_opt.m_full = true;
|
g_opt.m_full = true;
|
||||||
continue;
|
continue;
|
||||||
@@ -1533,6 +1546,9 @@ NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
|
|||||||
printusage();
|
printusage();
|
||||||
return NDBT_ProgramExit(NDBT_WRONGARGS);
|
return NDBT_ProgramExit(NDBT_WRONGARGS);
|
||||||
}
|
}
|
||||||
|
if (g_opt.m_dbug != 0) {
|
||||||
|
DBUG_PUSH(g_opt.m_dbug);
|
||||||
|
}
|
||||||
if (g_opt.m_pk2len == 0) {
|
if (g_opt.m_pk2len == 0) {
|
||||||
char b[100];
|
char b[100];
|
||||||
b[0] = 0;
|
b[0] = 0;
|
||||||
|
Reference in New Issue
Block a user