Loading mysql-test/r/ndb_blob.result +13 −5 Original line number Diff line number Diff line Loading @@ -481,14 +481,22 @@ msg text NOT NULL insert into t1 (msg) values( 'Tries to validate (8 byte length + inline bytes) as UTF8 :( Fast fix: removed validation for Text. It is not yet indexable so bad data will not crash kernel. Proper fix: Set inline bytes to multiple of mbmaxlen and validate it (after the 8 byte length).'); so bad data will not crash kernel.'); select * from t1; id msg 1 Tries to validate (8 byte length + inline bytes) as UTF8 :( Fast fix: removed validation for Text. It is not yet indexable so bad data will not crash kernel. Proper fix: Set inline bytes to multiple of mbmaxlen and validate it (after the 8 byte length). drop table t1; create table t1 ( a int primary key not null auto_increment, b text ) engine=ndbcluster; select count(*) from t1; count(*) 500 truncate t1; select count(*) from t1; count(*) 0 drop table t1; mysql-test/t/ndb_blob.test +22 −3 Original line number Diff line number Diff line Loading @@ -403,10 +403,29 @@ create table t1 ( insert into t1 (msg) values( 'Tries to validate (8 byte length + inline bytes) as UTF8 :( Fast fix: removed validation for Text. It is not yet indexable so bad data will not crash kernel. Proper fix: Set inline bytes to multiple of mbmaxlen and validate it (after the 8 byte length).'); so bad data will not crash kernel.'); select * from t1; drop table t1; # -- bug #19201 create table t1 ( a int primary key not null auto_increment, b text ) engine=ndbcluster; --disable_query_log set autocommit=1; # more rows than batch size (64) # for this bug no blob parts would be necessary let $1 = 500; while ($1) { insert into t1 (b) values (repeat('x',4000)); dec $1; } --enable_query_log select count(*) from t1; truncate t1; select count(*) from t1; drop table t1; # End of 4.1 tests ndb/include/kernel/signaldata/TcKeyReq.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ class TcKeyReq { friend class NdbOperation; friend class NdbIndexOperation; friend class NdbScanOperation; friend class NdbBlob; friend class DbUtil; /** Loading ndb/include/ndbapi/NdbBlob.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -275,6 +275,7 @@ private: bool isWriteOp(); bool isDeleteOp(); bool isScanOp(); bool isTakeOverOp(); // computations Uint32 getPartNumber(Uint64 pos); Uint32 getPartCount(); Loading ndb/src/ndbapi/NdbBlob.cpp +23 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <NdbBlob.hpp> #include "NdbBlobImpl.hpp" #include <NdbScanOperation.hpp> #include <signaldata/TcKeyReq.hpp> #ifdef NDB_BLOB_DEBUG #define DBG(x) \ Loading Loading @@ -290,6 +291,13 @@ NdbBlob::isScanOp() theNdbOp->theOperationType == NdbOperation::OpenRangeScanRequest; } inline bool NdbBlob::isTakeOverOp() { return TcKeyReq::getTakeOverScanFlag(theNdbOp->theScanInfo); } // computations (inline) inline Uint32 Loading Loading @@ -1218,8 +1226,22 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch) if (isUpdateOp() || isWriteOp() || isDeleteOp()) { // add operation before this one to read head+inline NdbOperation* tOp = theNdbCon->getNdbOperation(theTable, theNdbOp); /* * If main op is from take over scan lock, the added read is done * as committed read: * * In normal transactional case, the row is locked by us and * committed read returns same as normal read. * * In current TRUNCATE TABLE, the deleting trans is committed in * batches and then restarted with new trans id. A normal read * would hang on the scan delete lock and then fail. */ NdbOperation::LockMode lockMode = ! isTakeOverOp() ? NdbOperation::LM_Read : NdbOperation::LM_CommittedRead; if (tOp == NULL || tOp->readTuple() == -1 || tOp->readTuple(lockMode) == -1 || setTableKeyValue(tOp) == -1 || getHeadInlineValue(tOp) == -1) { setErrorCode(tOp); Loading Loading
mysql-test/r/ndb_blob.result +13 −5 Original line number Diff line number Diff line Loading @@ -481,14 +481,22 @@ msg text NOT NULL insert into t1 (msg) values( 'Tries to validate (8 byte length + inline bytes) as UTF8 :( Fast fix: removed validation for Text. It is not yet indexable so bad data will not crash kernel. Proper fix: Set inline bytes to multiple of mbmaxlen and validate it (after the 8 byte length).'); so bad data will not crash kernel.'); select * from t1; id msg 1 Tries to validate (8 byte length + inline bytes) as UTF8 :( Fast fix: removed validation for Text. It is not yet indexable so bad data will not crash kernel. Proper fix: Set inline bytes to multiple of mbmaxlen and validate it (after the 8 byte length). drop table t1; create table t1 ( a int primary key not null auto_increment, b text ) engine=ndbcluster; select count(*) from t1; count(*) 500 truncate t1; select count(*) from t1; count(*) 0 drop table t1;
mysql-test/t/ndb_blob.test +22 −3 Original line number Diff line number Diff line Loading @@ -403,10 +403,29 @@ create table t1 ( insert into t1 (msg) values( 'Tries to validate (8 byte length + inline bytes) as UTF8 :( Fast fix: removed validation for Text. It is not yet indexable so bad data will not crash kernel. Proper fix: Set inline bytes to multiple of mbmaxlen and validate it (after the 8 byte length).'); so bad data will not crash kernel.'); select * from t1; drop table t1; # -- bug #19201 create table t1 ( a int primary key not null auto_increment, b text ) engine=ndbcluster; --disable_query_log set autocommit=1; # more rows than batch size (64) # for this bug no blob parts would be necessary let $1 = 500; while ($1) { insert into t1 (b) values (repeat('x',4000)); dec $1; } --enable_query_log select count(*) from t1; truncate t1; select count(*) from t1; drop table t1; # End of 4.1 tests
ndb/include/kernel/signaldata/TcKeyReq.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ class TcKeyReq { friend class NdbOperation; friend class NdbIndexOperation; friend class NdbScanOperation; friend class NdbBlob; friend class DbUtil; /** Loading
ndb/include/ndbapi/NdbBlob.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -275,6 +275,7 @@ private: bool isWriteOp(); bool isDeleteOp(); bool isScanOp(); bool isTakeOverOp(); // computations Uint32 getPartNumber(Uint64 pos); Uint32 getPartCount(); Loading
ndb/src/ndbapi/NdbBlob.cpp +23 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <NdbBlob.hpp> #include "NdbBlobImpl.hpp" #include <NdbScanOperation.hpp> #include <signaldata/TcKeyReq.hpp> #ifdef NDB_BLOB_DEBUG #define DBG(x) \ Loading Loading @@ -290,6 +291,13 @@ NdbBlob::isScanOp() theNdbOp->theOperationType == NdbOperation::OpenRangeScanRequest; } inline bool NdbBlob::isTakeOverOp() { return TcKeyReq::getTakeOverScanFlag(theNdbOp->theScanInfo); } // computations (inline) inline Uint32 Loading Loading @@ -1218,8 +1226,22 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch) if (isUpdateOp() || isWriteOp() || isDeleteOp()) { // add operation before this one to read head+inline NdbOperation* tOp = theNdbCon->getNdbOperation(theTable, theNdbOp); /* * If main op is from take over scan lock, the added read is done * as committed read: * * In normal transactional case, the row is locked by us and * committed read returns same as normal read. * * In current TRUNCATE TABLE, the deleting trans is committed in * batches and then restarted with new trans id. A normal read * would hang on the scan delete lock and then fail. */ NdbOperation::LockMode lockMode = ! isTakeOverOp() ? NdbOperation::LM_Read : NdbOperation::LM_CommittedRead; if (tOp == NULL || tOp->readTuple() == -1 || tOp->readTuple(lockMode) == -1 || setTableKeyValue(tOp) == -1 || getHeadInlineValue(tOp) == -1) { setErrorCode(tOp); Loading