Commit be0ab479 authored by unknown's avatar unknown

ndb - bug#19293 and family

  introduce acc per row logical mutex to fix difficult error handling cases
  


storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp:
  1) Fix per row mutex so that only 1 op at a time is running on a row
  2) Change TUP_ALLOC/DEALLOC semantic, so that a new record will be allocated if LQ = { T1(DEL) - T2(INS) }
  3) Rewrite lock queus to be O(1) in all cases but a few abort cases where we scan parallell queue
  4) Impl. a validate_lock_queue/dump_lock_queue test framework
storage/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp:
  1) Fix per row mutex so that only 1 op at a time is running on a row
  2) Change TUP_ALLOC/DEALLOC semantic, so that a new record will be allocated if LQ = { T1(DEL) - T2(INS) }
  3) Rewrite lock queus to be O(1) in all cases but a few abort cases where we scan parallell queue
  4) Impl. a validate_lock_queue/dump_lock_queue test framework
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp:
  1) Fix per row mutex so that only 1 op at a time is running on a row
  2) Change TUP_ALLOC/DEALLOC semantic, so that a new record will be allocated if LQ = { T1(DEL) - T2(INS) }
  3) Rewrite lock queus to be O(1) in all cases but a few abort cases where we scan parallell queue
  4) Impl. a validate_lock_queue/dump_lock_queue test framework
storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp:
  1) impl. a new read key from operation record needed by acc
  2) expand TRACE_OP toolkit
  3) impl. ACCKEY_ORD as needed by ACC changes
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  1) impl. a new read key from operation record needed by acc
  2) expand TRACE_OP toolkit
  3) impl. ACCKEY_ORD as needed by ACC changes
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp:
  remove unused states/methods
storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
  remove extremly tricky code that handles disk_insert_but_no_mem_insert
    that is no long needed with current acc changes
storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp:
  remove unused states/methods
storage/ndb/test/ndbapi/testOperations.cpp:
  renable last 3 lock upgrade testcases since they now pass
parent 7d6ee98f
...@@ -17,14 +17,13 @@ ...@@ -17,14 +17,13 @@
#ifndef DBACC_H #ifndef DBACC_H
#define DBACC_H #define DBACC_H
#ifdef VM_TRACE
#define ACC_SAFE_QUEUE
#endif
#include <pc.hpp> #include <pc.hpp>
#include <SimulatedBlock.hpp> #include <SimulatedBlock.hpp>
// primary key is stored in TUP
#include "../dbtup/Dbtup.hpp"
#ifdef DBACC_C #ifdef DBACC_C
// Debug Macros // Debug Macros
#define dbgWord32(ptr, ind, val) #define dbgWord32(ptr, ind, val)
...@@ -135,7 +134,10 @@ ndbout << "Ptr: " << ptr.p->word32 << " \tIndex: " << tmp_string << " \tValue: " ...@@ -135,7 +134,10 @@ ndbout << "Ptr: " << ptr.p->word32 << " \tIndex: " << tmp_string << " \tValue: "
#define ZRIGHT 2 #define ZRIGHT 2
#define ZROOTFRAGMENTSIZE 32 #define ZROOTFRAGMENTSIZE 32
#define ZSCAN_LOCK_ALL 3 #define ZSCAN_LOCK_ALL 3
#define ZSCAN_OP 5 /**
* Check kernel_types for other operation types
*/
#define ZSCAN_OP 6
#define ZSCAN_REC_SIZE 256 #define ZSCAN_REC_SIZE 256
#define ZSTAND_BY 2 #define ZSTAND_BY 2
#define ZTABLESIZE 16 #define ZTABLESIZE 16
...@@ -477,6 +479,7 @@ struct Fragmentrec { ...@@ -477,6 +479,7 @@ struct Fragmentrec {
/* OPERATIONREC */ /* OPERATIONREC */
/* --------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------- */
struct Operationrec { struct Operationrec {
Uint32 m_op_bits;
Uint32 localdata[2]; Uint32 localdata[2];
Uint32 elementIsforward; Uint32 elementIsforward;
Uint32 elementPage; Uint32 elementPage;
...@@ -485,36 +488,62 @@ struct Operationrec { ...@@ -485,36 +488,62 @@ struct Operationrec {
Uint32 fragptr; Uint32 fragptr;
Uint32 hashvaluePart; Uint32 hashvaluePart;
Uint32 hashValue; Uint32 hashValue;
Uint32 insertDeleteLen;
Uint32 nextLockOwnerOp; Uint32 nextLockOwnerOp;
Uint32 nextOp; Uint32 nextOp;
Uint32 nextParallelQue; Uint32 nextParallelQue;
union {
Uint32 nextSerialQue; Uint32 nextSerialQue;
Uint32 m_lock_owner_ptr_i; // if nextParallelQue = RNIL, else undefined
};
Uint32 prevOp; Uint32 prevOp;
Uint32 prevLockOwnerOp; Uint32 prevLockOwnerOp;
union {
Uint32 prevParallelQue; Uint32 prevParallelQue;
Uint32 m_lo_last_parallel_op_ptr_i;
};
union {
Uint32 prevSerialQue; Uint32 prevSerialQue;
Uint32 m_lo_last_serial_op_ptr_i;
};
Uint32 scanRecPtr; Uint32 scanRecPtr;
Uint32 transId1; Uint32 transId1;
Uint32 transId2; Uint32 transId2;
State opState;
Uint32 userptr; Uint32 userptr;
State transactionstate;
Uint16 elementContainer; Uint16 elementContainer;
Uint16 tupkeylen; Uint16 tupkeylen;
Uint32 xfrmtupkeylen; Uint32 xfrmtupkeylen;
Uint32 userblockref; Uint32 userblockref;
Uint32 scanBits; Uint32 scanBits;
Uint8 elementIsDisappeared;
Uint8 insertIsDone; enum OpBits {
Uint8 lockMode; OP_MASK = 0x0000F // 4 bits for operation type
Uint8 lockOwner; ,OP_LOCK_MODE = 0x00010 // 0 - shared lock, 1 = exclusive lock
Uint8 nodeType; ,OP_ACC_LOCK_MODE = 0x00020 // Or:de lock mode of all operation
Uint8 operation; // before me
Uint8 opSimple; ,OP_LOCK_OWNER = 0x00040
Uint8 dirtyRead; ,OP_RUN_QUEUE = 0x00080 // In parallell queue of lock owner
Uint8 commitDeleteCheckFlag; ,OP_DIRTY_READ = 0x00100
Uint8 isAccLockReq; ,OP_LOCK_REQ = 0x00200 // isAccLockReq
,OP_COMMIT_DELETE_CHECK = 0x00400
,OP_INSERT_IS_DONE = 0x00800
,OP_ELEMENT_DISAPPEARED = 0x01000
,OP_STATE_MASK = 0xF0000
,OP_STATE_IDLE = 0xF0000
,OP_STATE_WAITING = 0x00000
,OP_STATE_RUNNING = 0x10000
,OP_STATE_EXECUTED = 0x30000
,OP_STATE_RUNNING_ABORT = 0x20000
,OP_EXECUTED_DIRTY_READ = 0x3050F
,OP_INITIAL = ~(Uint32)0
};
bool is_same_trans(const Operationrec* op) const {
return
transId1 == op->transId1 && transId2 == op->transId2;
}
}; /* p2c: size = 168 bytes */ }; /* p2c: size = 168 bytes */
typedef Ptr<Operationrec> OperationrecPtr; typedef Ptr<Operationrec> OperationrecPtr;
...@@ -577,7 +606,6 @@ struct ScanRec { ...@@ -577,7 +606,6 @@ struct ScanRec {
Uint32 scanUserblockref; Uint32 scanUserblockref;
Uint32 scanMask; Uint32 scanMask;
Uint8 scanLockMode; Uint8 scanLockMode;
Uint8 scanKeyinfoFlag;
Uint8 scanTimer; Uint8 scanTimer;
Uint8 scanContinuebCounter; Uint8 scanContinuebCounter;
Uint8 scanReadCommittedFlag; Uint8 scanReadCommittedFlag;
...@@ -602,7 +630,8 @@ public: ...@@ -602,7 +630,8 @@ public:
virtual ~Dbacc(); virtual ~Dbacc();
// pointer to TUP instance in this thread // pointer to TUP instance in this thread
Dbtup* c_tup; class Dbtup* c_tup;
class Dblqh* c_lqh;
void execACCMINUPDATE(Signal* signal); void execACCMINUPDATE(Signal* signal);
...@@ -640,6 +669,7 @@ private: ...@@ -640,6 +669,7 @@ private:
void ACCKEY_error(Uint32 fromWhere); void ACCKEY_error(Uint32 fromWhere);
void commitDeleteCheck(); void commitDeleteCheck();
void report_dealloc(Signal* signal, const Operationrec* opPtrP);
typedef void * RootfragmentrecPtr; typedef void * RootfragmentrecPtr;
void initRootFragPageZero(FragmentrecPtr, Page8Ptr); void initRootFragPageZero(FragmentrecPtr, Page8Ptr);
...@@ -679,14 +709,30 @@ private: ...@@ -679,14 +709,30 @@ private:
bool addfragtotab(Signal* signal, Uint32 rootIndex, Uint32 fragId); bool addfragtotab(Signal* signal, Uint32 rootIndex, Uint32 fragId);
void initOpRec(Signal* signal); void initOpRec(Signal* signal);
void sendAcckeyconf(Signal* signal); void sendAcckeyconf(Signal* signal);
Uint32 placeReadInLockQueue(Signal* signal);
void placeSerialQueueRead(Signal* signal);
void checkOnlyReadEntry(Signal* signal);
Uint32 getNoParallelTransaction(const Operationrec*); Uint32 getNoParallelTransaction(const Operationrec*);
void moveLastParallelQueue(Signal* signal);
void moveLastParallelQueueWrite(Signal* signal); #ifdef VM_TRACE
Uint32 placeWriteInLockQueue(Signal* signal); Uint32 getNoParallelTransactionFull(const Operationrec*);
void placeSerialQueueWrite(Signal* signal); #endif
#ifdef ACC_SAFE_QUEUE
bool validate_lock_queue(OperationrecPtr opPtr);
Uint32 get_parallel_head(OperationrecPtr opPtr);
void dump_lock_queue(OperationrecPtr loPtr);
#else
bool validate_lock_queue(OperationrecPtr) { return true;}
#endif
public:
void execACCKEY_ORD(Signal* signal, Uint32 opPtrI);
void startNext(Signal* signal, OperationrecPtr lastOp);
private:
Uint32 placeReadInLockQueue(OperationrecPtr lockOwnerPtr);
Uint32 placeWriteInLockQueue(OperationrecPtr lockOwnerPtr);
void placeSerialQueue(OperationrecPtr lockOwner, OperationrecPtr op);
void abortSerieQueueOperation(Signal* signal, OperationrecPtr op);
void abortParallelQueueOperation(Signal* signal, OperationrecPtr op);
void expandcontainer(Signal* signal); void expandcontainer(Signal* signal);
void shrinkcontainer(Signal* signal); void shrinkcontainer(Signal* signal);
void nextcontainerinfoExp(Signal* signal); void nextcontainerinfoExp(Signal* signal);
...@@ -716,8 +762,8 @@ private: ...@@ -716,8 +762,8 @@ private:
void increaselistcont(Signal* signal); void increaselistcont(Signal* signal);
void seizeLeftlist(Signal* signal); void seizeLeftlist(Signal* signal);
void seizeRightlist(Signal* signal); void seizeRightlist(Signal* signal);
Uint32 readTablePk(Uint32 localkey1); Uint32 readTablePk(Uint32 localkey1, Uint32 eh, const Operationrec*);
void getElement(Signal* signal); Uint32 getElement(Signal* signal, OperationrecPtr& lockOwner);
void getdirindex(Signal* signal); void getdirindex(Signal* signal);
void commitdelete(Signal* signal); void commitdelete(Signal* signal);
void deleteElement(Signal* signal); void deleteElement(Signal* signal);
...@@ -726,12 +772,17 @@ private: ...@@ -726,12 +772,17 @@ private:
void releaseRightlist(Signal* signal); void releaseRightlist(Signal* signal);
void checkoverfreelist(Signal* signal); void checkoverfreelist(Signal* signal);
void abortOperation(Signal* signal); void abortOperation(Signal* signal);
void accAbortReqLab(Signal* signal);
void commitOperation(Signal* signal); void commitOperation(Signal* signal);
void copyOpInfo(Signal* signal); void copyOpInfo(OperationrecPtr dst, OperationrecPtr src);
Uint32 executeNextOperation(Signal* signal); Uint32 executeNextOperation(Signal* signal);
void releaselock(Signal* signal); void releaselock(Signal* signal);
void release_lockowner(Signal* signal, OperationrecPtr, bool commit);
void startNew(Signal* signal, OperationrecPtr newOwner);
void abortWaitingOperation(Signal*, OperationrecPtr);
void abortExecutedOperation(Signal*, OperationrecPtr);
void takeOutFragWaitQue(Signal* signal); void takeOutFragWaitQue(Signal* signal);
void check_lock_upgrade(Signal* signal, OperationrecPtr release_op, bool lo);
void check_lock_upgrade(Signal* signal, OperationrecPtr lock_owner, void check_lock_upgrade(Signal* signal, OperationrecPtr lock_owner,
OperationrecPtr release_op); OperationrecPtr release_op);
void allocOverflowPage(Signal* signal); void allocOverflowPage(Signal* signal);
...@@ -780,8 +831,8 @@ private: ...@@ -780,8 +831,8 @@ private:
void senddatapagesLab(Signal* signal); void senddatapagesLab(Signal* signal);
void sttorrysignalLab(Signal* signal); void sttorrysignalLab(Signal* signal);
void sendholdconfsignalLab(Signal* signal); void sendholdconfsignalLab(Signal* signal);
void accIsLockedLab(Signal* signal); void accIsLockedLab(Signal* signal, OperationrecPtr lockOwnerPtr);
void insertExistElemLab(Signal* signal); void insertExistElemLab(Signal* signal, OperationrecPtr lockOwnerPtr);
void refaccConnectLab(Signal* signal); void refaccConnectLab(Signal* signal);
void releaseScanLab(Signal* signal); void releaseScanLab(Signal* signal);
void ndbrestart1Lab(Signal* signal); void ndbrestart1Lab(Signal* signal);
...@@ -840,8 +891,6 @@ private: ...@@ -840,8 +891,6 @@ private:
Operationrec *operationrec; Operationrec *operationrec;
OperationrecPtr operationRecPtr; OperationrecPtr operationRecPtr;
OperationrecPtr idrOperationRecPtr; OperationrecPtr idrOperationRecPtr;
OperationrecPtr copyInOperPtr;
OperationrecPtr copyOperPtr;
OperationrecPtr mlpqOperPtr; OperationrecPtr mlpqOperPtr;
OperationrecPtr queOperPtr; OperationrecPtr queOperPtr;
OperationrecPtr readWriteOpPtr; OperationrecPtr readWriteOpPtr;
...@@ -885,8 +934,6 @@ private: ...@@ -885,8 +934,6 @@ private:
Page8Ptr lcnPageptr; Page8Ptr lcnPageptr;
Page8Ptr lcnCopyPageptr; Page8Ptr lcnCopyPageptr;
Page8Ptr lupPageptr; Page8Ptr lupPageptr;
Page8Ptr priPageptr;
Page8Ptr pwiPageptr;
Page8Ptr ciPageidptr; Page8Ptr ciPageidptr;
Page8Ptr gsePageidptr; Page8Ptr gsePageidptr;
Page8Ptr isoPageptr; Page8Ptr isoPageptr;
...@@ -926,8 +973,6 @@ private: ...@@ -926,8 +973,6 @@ private:
Tabrec *tabrec; Tabrec *tabrec;
TabrecPtr tabptr; TabrecPtr tabptr;
Uint32 ctablesize; Uint32 ctablesize;
Uint32 tpwiElementptr;
Uint32 tpriElementptr;
Uint32 tgseElementptr; Uint32 tgseElementptr;
Uint32 tgseContainerptr; Uint32 tgseContainerptr;
Uint32 trlHead; Uint32 trlHead;
...@@ -961,8 +1006,6 @@ private: ...@@ -961,8 +1006,6 @@ private:
Uint32 tdelForward; Uint32 tdelForward;
Uint32 tiopPageId; Uint32 tiopPageId;
Uint32 tipPageId; Uint32 tipPageId;
Uint32 tgeLocked;
Uint32 tgeResult;
Uint32 tgeContainerptr; Uint32 tgeContainerptr;
Uint32 tgeElementptr; Uint32 tgeElementptr;
Uint32 tgeForward; Uint32 tgeForward;
......
...@@ -130,8 +130,6 @@ Dbacc::Dbacc(Block_context& ctx): ...@@ -130,8 +130,6 @@ Dbacc::Dbacc(Block_context& ctx):
&fragrecptr, &fragrecptr,
&operationRecPtr, &operationRecPtr,
&idrOperationRecPtr, &idrOperationRecPtr,
&copyInOperPtr,
&copyOperPtr,
&mlpqOperPtr, &mlpqOperPtr,
&queOperPtr, &queOperPtr,
&readWriteOpPtr, &readWriteOpPtr,
...@@ -161,8 +159,6 @@ Dbacc::Dbacc(Block_context& ctx): ...@@ -161,8 +159,6 @@ Dbacc::Dbacc(Block_context& ctx):
&lcnPageptr, &lcnPageptr,
&lcnCopyPageptr, &lcnCopyPageptr,
&lupPageptr, &lupPageptr,
&priPageptr,
&pwiPageptr,
&ciPageidptr, &ciPageidptr,
&gsePageidptr, &gsePageidptr,
&isoPageptr, &isoPageptr,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -33,8 +33,6 @@ ...@@ -33,8 +33,6 @@
// primary key is stored in TUP // primary key is stored in TUP
#include "../dbtup/Dbtup.hpp" #include "../dbtup/Dbtup.hpp"
#include "../dbacc/Dbacc.hpp"
#ifdef DBLQH_C #ifdef DBLQH_C
// Constants // Constants
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
...@@ -2556,8 +2554,19 @@ private: ...@@ -2556,8 +2554,19 @@ private:
Dbtup* c_tup; Dbtup* c_tup;
Dbacc* c_acc; Dbacc* c_acc;
/**
* Read primary key from tup
*/
Uint32 readPrimaryKeys(ScanRecord*, TcConnectionrec*, Uint32 * dst); Uint32 readPrimaryKeys(ScanRecord*, TcConnectionrec*, Uint32 * dst);
/**
* Read primary key from operation
*/
public:
Uint32 readPrimaryKeys(Uint32 opPtrI, Uint32 * dst, bool xfrm);
private:
void acckeyconf_tupkeyreq(Signal*, TcConnectionrec*, Fragrecord*, Uint32, Uint32); void acckeyconf_tupkeyreq(Signal*, TcConnectionrec*, Fragrecord*, Uint32, Uint32);
void acckeyconf_load_diskpage(Signal*,TcConnectionrecPtr,Fragrecord*,Uint32); void acckeyconf_load_diskpage(Signal*,TcConnectionrecPtr,Fragrecord*,Uint32);
...@@ -2924,6 +2933,11 @@ public: ...@@ -2924,6 +2933,11 @@ public:
} }
DLHashTable<ScanRecord> c_scanTakeOverHash; DLHashTable<ScanRecord> c_scanTakeOverHash;
#ifdef ERROR_INSERT
inline bool TRACE_OP_CHECK(const TcConnectionrec* regTcPtr);
void TRACE_OP_DUMP(const TcConnectionrec* regTcPtr, const char * pos);
#endif
}; };
inline inline
...@@ -2991,10 +3005,19 @@ Dblqh::accminupdate(Signal* signal, Uint32 opId, const Local_key* key) ...@@ -2991,10 +3005,19 @@ Dblqh::accminupdate(Signal* signal, Uint32 opId, const Local_key* key)
signal->theData[1] = key->m_page_no << MAX_TUPLES_BITS | key->m_page_idx; signal->theData[1] = key->m_page_no << MAX_TUPLES_BITS | key->m_page_idx;
c_acc->execACCMINUPDATE(signal); c_acc->execACCMINUPDATE(signal);
if (ERROR_INSERTED(5712)) if (ERROR_INSERTED(5712) || ERROR_INSERTED(5713))
ndbout << " LK: " << *key; ndbout << " LK: " << *key;
regTcPtr.p->m_row_id = *key; regTcPtr.p->m_row_id = *key;
} }
inline
bool
Dblqh::TRACE_OP_CHECK(const TcConnectionrec* regTcPtr)
{
return (ERROR_INSERTED(5712) &&
(regTcPtr->operation == ZINSERT ||
regTcPtr->operation == ZDELETE)) ||
ERROR_INSERTED(5713);
}
#endif #endif
...@@ -297,7 +297,6 @@ enum TransState { ...@@ -297,7 +297,6 @@ enum TransState {
}; };
enum TupleState { enum TupleState {
TUPLE_INITIAL_INSERT = 0,
TUPLE_PREPARED = 1, TUPLE_PREPARED = 1,
TUPLE_ALREADY_ABORTED = 2, TUPLE_ALREADY_ABORTED = 2,
TUPLE_TO_BE_COMMITTED = 3 TUPLE_TO_BE_COMMITTED = 3
...@@ -305,7 +304,6 @@ enum TupleState { ...@@ -305,7 +304,6 @@ enum TupleState {
enum State { enum State {
NOT_INITIALIZED = 0, NOT_INITIALIZED = 0,
COMMON_AREA_PAGES = 1,
IDLE = 17, IDLE = 17,
ACTIVE = 18, ACTIVE = 18,
SYSTEM_RESTART = 19, SYSTEM_RESTART = 19,
...@@ -1441,7 +1439,6 @@ private: ...@@ -1441,7 +1439,6 @@ private:
void execSET_VAR_REQ(Signal* signal); void execSET_VAR_REQ(Signal* signal);
void execDROP_TAB_REQ(Signal* signal); void execDROP_TAB_REQ(Signal* signal);
void execALTER_TAB_REQ(Signal* signal); void execALTER_TAB_REQ(Signal* signal);
void execTUP_ALLOCREQ(Signal* signal);
void execTUP_DEALLOCREQ(Signal* signal); void execTUP_DEALLOCREQ(Signal* signal);
void execTUP_WRITELOG_REQ(Signal* signal); void execTUP_WRITELOG_REQ(Signal* signal);
......
...@@ -202,29 +202,6 @@ Dbtup::receive_attrinfo(Signal* signal, Uint32 op, ...@@ -202,29 +202,6 @@ Dbtup::receive_attrinfo(Signal* signal, Uint32 op,
} }
} }
void Dbtup::execTUP_ALLOCREQ(Signal* signal)
{
OperationrecPtr regOperPtr;
jamEntry();
regOperPtr.i= signal->theData[0];
c_operation_pool.getPtr(regOperPtr);
regOperPtr.p->op_struct.tuple_state= TUPLE_INITIAL_INSERT;
//ndbout_c("execTUP_ALLOCREQ");
signal->theData[0]= 0;
signal->theData[1]= ~0 >> MAX_TUPLES_BITS;
signal->theData[2]= (1 << MAX_TUPLES_BITS) - 1;
return;
mem_error:
jam();
signal->theData[0]= ZMEM_NOMEM_ERROR;
return;
}
void void
Dbtup::setChecksum(Tuple_header* tuple_ptr, Dbtup::setChecksum(Tuple_header* tuple_ptr,
Tablerec* regTabPtr) Tablerec* regTabPtr)
...@@ -455,7 +432,7 @@ Dbtup::load_diskpage(Signal* signal, ...@@ -455,7 +432,7 @@ Dbtup::load_diskpage(Signal* signal,
ptrCheckGuard(tabptr, cnoOfTablerec, tablerec); ptrCheckGuard(tabptr, cnoOfTablerec, tablerec);
Tablerec* regTabPtr = tabptr.p; Tablerec* regTabPtr = tabptr.p;
if(regOperPtr->op_struct.tuple_state == TUPLE_INITIAL_INSERT) if(local_key == ~(Uint32)0)
{ {
jam(); jam();
regOperPtr->op_struct.m_wait_log_buffer= 1; regOperPtr->op_struct.m_wait_log_buffer= 1;
...@@ -663,7 +640,7 @@ void Dbtup::execTUPKEYREQ(Signal* signal) ...@@ -663,7 +640,7 @@ void Dbtup::execTUPKEYREQ(Signal* signal)
regOperPtr->savepointId= sig1; regOperPtr->savepointId= sig1;
regOperPtr->op_struct.primary_replica= sig2; regOperPtr->op_struct.primary_replica= sig2;
regOperPtr->m_tuple_location.m_page_idx= sig3; Uint32 pageidx = regOperPtr->m_tuple_location.m_page_idx= sig3;
sig1= tupKeyReq->opRef; sig1= tupKeyReq->opRef;
sig2= tupKeyReq->tcOpIndex; sig2= tupKeyReq->tcOpIndex;
...@@ -673,7 +650,7 @@ void Dbtup::execTUPKEYREQ(Signal* signal) ...@@ -673,7 +650,7 @@ void Dbtup::execTUPKEYREQ(Signal* signal)
req_struct.tc_operation_ptr= sig1; req_struct.tc_operation_ptr= sig1;
req_struct.TC_index= sig2; req_struct.TC_index= sig2;
req_struct.TC_ref= sig3; req_struct.TC_ref= sig3;
req_struct.frag_page_id= sig4; Uint32 pageid = req_struct.frag_page_id= sig4;
req_struct.m_use_rowid = (TrequestInfo >> 11) & 1; req_struct.m_use_rowid = (TrequestInfo >> 11) & 1;
sig1= tupKeyReq->attrBufLen; sig1= tupKeyReq->attrBufLen;
...@@ -706,7 +683,8 @@ void Dbtup::execTUPKEYREQ(Signal* signal) ...@@ -706,7 +683,8 @@ void Dbtup::execTUPKEYREQ(Signal* signal)
copyAttrinfo(regOperPtr, &cinBuffer[0]); copyAttrinfo(regOperPtr, &cinBuffer[0]);
if(Roptype == ZINSERT && get_tuple_state(regOperPtr)== TUPLE_INITIAL_INSERT) Uint32 localkey = (pageid << MAX_TUPLES_BITS) + pageidx;
if(Roptype == ZINSERT && localkey == ~0)
{ {
// No tuple allocatated yet // No tuple allocatated yet
goto do_insert; goto do_insert;
...@@ -1159,49 +1137,6 @@ Dbtup::prepare_initial_insert(KeyReqStruct *req_struct, ...@@ -1159,49 +1137,6 @@ Dbtup::prepare_initial_insert(KeyReqStruct *req_struct,
disk_undo ? (Tuple_header::DISK_ALLOC | Tuple_header::DISK_INLINE) : 0; disk_undo ? (Tuple_header::DISK_ALLOC | Tuple_header::DISK_INLINE) : 0;
} }
void
Dbtup::fix_disk_insert_no_mem_insert(KeyReqStruct *req_struct,
Operationrec* regOperPtr,
Tablerec* regTabPtr)
{
regOperPtr->m_undo_buffer_space= sizeof(Dbtup::Disk_undo::Alloc);
req_struct->check_offset[DD]= regTabPtr->get_check_offset(DD);
const Uint32 cnt1= regTabPtr->m_attributes[MM].m_no_of_varsize;
const Uint32 cnt2= regTabPtr->m_attributes[DD].m_no_of_varsize;
Uint32 *ptr= req_struct->m_tuple_ptr->get_var_part_ptr(regTabPtr);
if(cnt1)
{
// Disk part is 32-bit aligned
char *varptr = req_struct->m_var_data[MM].m_data_ptr;
ptr= ALIGN_WORD(varptr + regTabPtr->m_offsets[MM].m_max_var_offset);
}
else
{
ptr -= Tuple_header::HeaderSize;
}
req_struct->m_disk_ptr= (Tuple_header*)ptr;
if(cnt2)
{
KeyReqStruct::Var_data *dst= &req_struct->m_var_data[DD];
ptr=((Tuple_header*)ptr)->m_data+regTabPtr->m_offsets[DD].m_varpart_offset;
dst->m_data_ptr= (char*)(((Uint16*)ptr)+cnt2+1);
dst->m_offset_array_ptr= req_struct->var_pos_array + (cnt1 << 1);
dst->m_var_len_offset= cnt2;
dst->m_max_var_offset= regTabPtr->m_offsets[DD].m_max_var_offset;
}
// Set all null bits
memset(req_struct->m_disk_ptr->m_null_bits+
regTabPtr->m_offsets[DD].m_null_offset, 0xFF,
4*regTabPtr->m_offsets[DD].m_null_words);
req_struct->m_tuple_ptr->m_header_bits =
(Tuple_header::DISK_ALLOC | Tuple_header::DISK_INLINE);
}
int Dbtup::handleInsertReq(Signal* signal, int Dbtup::handleInsertReq(Signal* signal,
Ptr<Operationrec> regOperPtr, Ptr<Operationrec> regOperPtr,
Ptr<Fragrecord> fragPtr, Ptr<Fragrecord> fragPtr,
...@@ -1215,8 +1150,8 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1215,8 +1150,8 @@ int Dbtup::handleInsertReq(Signal* signal,
Tuple_header *tuple_ptr; Tuple_header *tuple_ptr;
bool disk = regTabPtr->m_no_of_disk_attributes > 0; bool disk = regTabPtr->m_no_of_disk_attributes > 0;
bool mem_insert = get_tuple_state(regOperPtr.p) == TUPLE_INITIAL_INSERT; bool mem_insert = regOperPtr.p->is_first_operation();
bool disk_insert = regOperPtr.p->is_first_operation() && disk; bool disk_insert = mem_insert && disk;
bool varsize = regTabPtr->m_attributes[MM].m_no_of_varsize; bool varsize = regTabPtr->m_attributes[MM].m_no_of_varsize;
bool rowid = req_struct->m_use_rowid; bool rowid = req_struct->m_use_rowid;
Uint32 real_page_id = regOperPtr.p->m_tuple_location.m_page_no; Uint32 real_page_id = regOperPtr.p->m_tuple_location.m_page_no;
...@@ -1244,12 +1179,9 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1244,12 +1179,9 @@ int Dbtup::handleInsertReq(Signal* signal,
if(mem_insert) if(mem_insert)
{ {
jam(); jam();
ndbassert(regOperPtr.p->is_first_operation()); // disk insert
prepare_initial_insert(req_struct, regOperPtr.p, regTabPtr); prepare_initial_insert(req_struct, regOperPtr.p, regTabPtr);
} }
else else
{
if (!regOperPtr.p->is_first_operation())
{ {
Operationrec* prevOp= req_struct->prevOpPtr.p; Operationrec* prevOp= req_struct->prevOpPtr.p;
ndbassert(prevOp->op_struct.op_type == ZDELETE); ndbassert(prevOp->op_struct.op_type == ZDELETE);
...@@ -1257,8 +1189,6 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1257,8 +1189,6 @@ int Dbtup::handleInsertReq(Signal* signal,
if(!prevOp->is_first_operation()) if(!prevOp->is_first_operation())
org= (Tuple_header*)c_undo_buffer.get_ptr(&prevOp->m_copy_tuple_location); org= (Tuple_header*)c_undo_buffer.get_ptr(&prevOp->m_copy_tuple_location);
}
if (regTabPtr->need_expand()) if (regTabPtr->need_expand())
expand_tuple(req_struct, sizes, org, regTabPtr, !disk_insert); expand_tuple(req_struct, sizes, org, regTabPtr, !disk_insert);
else else
...@@ -1268,11 +1198,6 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1268,11 +1198,6 @@ int Dbtup::handleInsertReq(Signal* signal,
if (disk_insert) if (disk_insert)
{ {
int res; int res;
if (unlikely(!mem_insert))
{
sizes[DD] = sizes[DD+2] = regTabPtr->m_offsets[DD].m_fix_header_size;
fix_disk_insert_no_mem_insert(req_struct, regOperPtr.p, regTabPtr);
}
if (ERROR_INSERTED(4015)) if (ERROR_INSERTED(4015))
{ {
...@@ -1381,6 +1306,7 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1381,6 +1306,7 @@ int Dbtup::handleInsertReq(Signal* signal,
} }
if (unlikely(ptr == 0)) if (unlikely(ptr == 0))
{ {
jam();
goto alloc_rowid_error; goto alloc_rowid_error;
} }
} }
...@@ -1396,7 +1322,7 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1396,7 +1322,7 @@ int Dbtup::handleInsertReq(Signal* signal,
(varsize ? Tuple_header::CHAINED_ROW : 0); (varsize ? Tuple_header::CHAINED_ROW : 0);
regOperPtr.p->m_tuple_location.m_page_no = real_page_id; regOperPtr.p->m_tuple_location.m_page_no = real_page_id;
} }
else if(!rowid || !regOperPtr.p->is_first_operation()) else
{ {
int ret; int ret;
if (ERROR_INSERTED(4020)) if (ERROR_INSERTED(4020))
...@@ -1417,20 +1343,6 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1417,20 +1343,6 @@ int Dbtup::handleInsertReq(Signal* signal,
req_struct->m_use_rowid = false; req_struct->m_use_rowid = false;
base->m_header_bits &= ~(Uint32)Tuple_header::FREE; base->m_header_bits &= ~(Uint32)Tuple_header::FREE;
} }
else
{
if ((req_struct->m_row_id.m_page_no == frag_page_id &&
req_struct->m_row_id.m_page_idx == regOperPtr.p->m_tuple_location.m_page_idx))
{
ndbout_c("no mem insert but rowid (same)");
base->m_header_bits &= ~(Uint32)Tuple_header::FREE;
}
else
{
// no mem insert, but rowid
ndbrequire(false);
}
}
base->m_header_bits |= Tuple_header::ALLOC & base->m_header_bits |= Tuple_header::ALLOC &
(regOperPtr.p->is_first_operation() ? ~0 : 1); (regOperPtr.p->is_first_operation() ? ~0 : 1);
......
...@@ -89,7 +89,6 @@ Dbtup::Dbtup(Block_context& ctx, Pgman* pgman) ...@@ -89,7 +89,6 @@ Dbtup::Dbtup(Block_context& ctx, Pgman* pgman)
addRecSignal(GSN_DROP_TAB_REQ, &Dbtup::execDROP_TAB_REQ); addRecSignal(GSN_DROP_TAB_REQ, &Dbtup::execDROP_TAB_REQ);
addRecSignal(GSN_TUP_ALLOCREQ, &Dbtup::execTUP_ALLOCREQ);
addRecSignal(GSN_TUP_DEALLOCREQ, &Dbtup::execTUP_DEALLOCREQ); addRecSignal(GSN_TUP_DEALLOCREQ, &Dbtup::execTUP_DEALLOCREQ);
addRecSignal(GSN_TUP_WRITELOG_REQ, &Dbtup::execTUP_WRITELOG_REQ); addRecSignal(GSN_TUP_WRITELOG_REQ, &Dbtup::execTUP_WRITELOG_REQ);
......
...@@ -665,7 +665,7 @@ main(int argc, const char** argv){ ...@@ -665,7 +665,7 @@ main(int argc, const char** argv){
for(Uint32 i = 0; i < 12; i++) for(Uint32 i = 0; i < 12; i++)
{ {
if(i == 6 || i == 8 || i == 10) if(false && (i == 6 || i == 8 || i == 10))
continue; continue;
BaseString name("bug_9749"); BaseString name("bug_9749");
......
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