Commit 35ded492 authored by unknown's avatar unknown
Browse files

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
parent dc1e7edb
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -414,6 +414,7 @@ a b c d
9	b9	999	dd9
drop table t1;
drop database test2;
set autocommit=0;
create table t1 (
a int not null primary key,
b tinytext
@@ -422,9 +423,13 @@ insert into t1 values(1, 'x');
update t1 set b = 'y';
select * from t1;
a	b
1	x
1	y
delete from t1;
select * from t1;
a	b
commit;
drop table t1;
set autocommit=0;
create table t1 (
a int not null primary key,
b text not null
@@ -433,6 +438,7 @@ insert into t1 values(1, '');
select * from t1;
a	b
1	
commit;
drop table t1;
set autocommit=1;
use test;
@@ -454,6 +460,7 @@ select * from t1 order by a;
a	b
1	AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2	BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
set autocommit=1;
alter table t1 engine=myisam;
select * from t1 order by a;
a	b
+7 −1
Original line number Diff line number Diff line
@@ -337,8 +337,9 @@ select * from t1 order by a;
drop table t1;
drop database test2;

# -- bug-5252 tinytext crashes --
# -- bug-5252 tinytext crashes plus no-commit result --

set autocommit=0;
create table t1 (
  a int not null primary key,
  b tinytext
@@ -348,10 +349,13 @@ insert into t1 values(1, 'x');
update t1 set b = 'y';
select * from t1;
delete from t1;
select * from t1;
commit;
drop table t1;

# -- bug-5013 insert empty string to text --

set autocommit=0;
create table t1 (
  a int not null primary key,
  b text not null
@@ -359,6 +363,7 @@ create table t1 (

insert into t1 values(1, '');
select * from t1;
commit;
drop table t1;

# -- bug #5349 --
@@ -380,6 +385,7 @@ alter table t1 engine=ndb;
select * from t1 order by a;

# -- bug #5872 --
set autocommit=1;
alter table t1 engine=myisam;
select * from t1 order by a;
drop table t1;
+12 −0
Original line number Diff line number Diff line
@@ -1428,6 +1428,18 @@ NdbBlob::postExecute(ExecType anExecType)
    if (invokeActiveHook() == -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]");
  return 0;
}
+5 −0
Original line number Diff line number Diff line
@@ -340,7 +340,12 @@ NdbConnection::execute(ExecType aTypeOfExec,

    if (executeNoBlobs(tExecType, abortOption, forceSend) == -1)
        ret = -1;
#ifndef VM_TRACE
    // can happen in complex abort cases
    theFirstOpInList = theLastOpInList = NULL;
#else
    assert(theFirstOpInList == NULL && theLastOpInList == NULL);
#endif

    {
      NdbOperation* tOp = theCompletedFirstOp;
+1 −1
Original line number Diff line number Diff line
@@ -552,7 +552,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal)
    theNdbCon->theReturnStatus = NdbConnection::ReturnFailure;

  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
    return theNdbCon->OpCompleteFailure(ao, m_abortOption != IgnoreError);
Loading