InfiniSQL
v0.1.2-alpha
Massive Scale Transaction Processing
|
Deadlock manager actor. More...
#include <DeadlockMgr.h>
Public Member Functions | |
DeadlockMgr (Topology::partitionAddress *myIdentityArg) | |
execute Deadlock Manager actor More... | |
virtual | ~DeadlockMgr () |
Private Member Functions | |
void | algorithm () |
wait-for graph algoritm More... | |
void | deadlock (int64_t transactionid) |
bool | walk (int64_t transactionid) |
walk the wait-for graph for items this transactionid is waiting for More... | |
bool | walk (boost::unordered_set< string >::iterator itemIt) |
walk the wait-for graph for transactions that hold this item More... | |
void | removeTransaction (int64_t transactionid) |
remove transactionid from wait-for graph More... | |
Static Private Member Functions | |
static void | makeLockedItem (bool isrow, int64_t rowid, int64_t tableid, int64_t engineid, int64_t domainid, int64_t fieldid, long double floatentry, std::string *stringentry, std::string *returnstring) |
create item to add to waitfor graph More... | |
Private Attributes | |
class Mbox * | mymboxPtr |
Topology::partitionAddress | myIdentity |
class Mboxes | mboxes |
class Topology | myTopology |
REUSEMESSAGES boost::unordered_map< int64_t, boost::unordered_set < std::string > > | transactionLocksMap |
boost::unordered_map< int64_t, boost::unordered_set < std::string > > | transactionWaitsMap |
boost::unordered_map < std::string, boost::unordered_set< int64_t > > | locksTransactionMap |
boost::unordered_map < std::string, boost::unordered_set< int64_t > > | waitsTransactionMap |
boost::unordered_map< int64_t, taCmd > | returnMap |
boost::unordered_set< int64_t > | skipTransactionSet |
boost::unordered_set< std::string > | skipItemSet |
boost::unordered_set< int64_t > | transactionGraphSet |
Friends | |
class | Transaction |
Deadlock manager actor.
Definition at line 48 of file DeadlockMgr.h.
DeadlockMgr::DeadlockMgr | ( | Topology::partitionAddress * | myIdentityArg) |
execute Deadlock Manager actor
uses a wait-for graph to resolve deadlocks
myIdentityArg | how to identify actor instance |
Definition at line 31 of file DeadlockMgr.cc.
References ADDLOCKEDENTRY, ADDLOCKPENDINGENTRY, taCmd::addr, Topology::partitionAddress::address, algorithm(), MessageDeadlock::deadlock_s::deadlockchange, MessageDeadlock::deadlockNode, MessageDeadlock::deadlockStruct, GETMSG, newDeadLockLists_s::locked, locksTransactionMap, logfile, Topology::partitionAddress::mbox, mboxes, Message::messageStruct, MSGRECEIVEBATCHSIZE, myIdentity, myTopology, Topology::addressStruct::nodeid, Mboxes::nodeid, MessageDeadlock::nodes, taCmd::pendingcmdid, REMOVELOCKEDENTRY, REMOVELOCKPENDINGENTRY, removeTransaction(), returnMap, Mboxes::sendObBatch(), Message::message_s::sourceAddr, Message::message_s::topic, TOPIC_DEADLOCKCHANGE, TOPIC_DEADLOCKNEW, TOPIC_DEADLOCKREMOVE, TOPIC_TOPOLOGY, MessageDeadlock::deadlock_s::transaction_pendingcmdid, MessageDeadlock::deadlock_s::transactionid, transactionLocksMap, transactionWaitsMap, TRANSITIONPENDINGTOLOCKEDENTRY, Mboxes::update(), newDeadLockLists_s::waiting, and waitsTransactionMap.
|
virtual |
Definition at line 174 of file DeadlockMgr.cc.
|
private |
wait-for graph algoritm
Definition at line 234 of file DeadlockMgr.cc.
References skipItemSet, skipTransactionSet, transactionGraphSet, transactionWaitsMap, and walk().
Referenced by DeadlockMgr().
|
private |
upon deadlock, send message to TransactionAgent to abort transaction
transactionid |
Definition at line 262 of file DeadlockMgr.cc.
References Topology::partitionAddress::address, MessageDeadlock::deadlockStruct, mboxes, Message::messageStruct, myIdentity, removeTransaction(), returnMap, Mboxes::toActor(), Message::message_s::topic, TOPIC_DEADLOCKABORT, MessageDeadlock::deadlock_s::transaction_pendingcmdid, and MessageDeadlock::deadlock_s::transactionid.
Referenced by walk().
|
staticprivate |
create item to add to waitfor graph
Items are added to wait-for graph under following circumstances: at least 1 row/unique index entry is locked by transaction and at least 1 is pending a lock for that transaction. All locked and pending items are added to wait-for graph as potential causes of a deadlock. the item to add to the wait-for graph is a string (returnstring)
isrow | is a row (otherwise unique index entry) |
rowid | rowid |
tableid | tableid |
engineid | engineid |
domainid | domainid |
fieldid | fieldid |
floatentry | if index entry for float, the float value |
stringentry | if index entry for string, string value |
returnstring | item to add to wait-for graph |
Definition at line 189 of file DeadlockMgr.cc.
Referenced by Transaction::checkLock(), and Transaction::checkSqlLock().
|
private |
remove transactionid from wait-for graph
transactionid | transactionid |
Definition at line 352 of file DeadlockMgr.cc.
References locksTransactionMap, returnMap, transactionLocksMap, transactionWaitsMap, and waitsTransactionMap.
Referenced by deadlock(), and DeadlockMgr().
|
private |
walk the wait-for graph for items this transactionid is waiting for
transactionid | transactionid |
Definition at line 282 of file DeadlockMgr.cc.
References deadlock(), skipTransactionSet, transactionGraphSet, and transactionWaitsMap.
Referenced by algorithm(), and walk().
|
private |
walk the wait-for graph for transactions that hold this item
itemIt | item held by transactions |
Definition at line 321 of file DeadlockMgr.cc.
References locksTransactionMap, skipItemSet, and walk().
|
friend |
Definition at line 61 of file DeadlockMgr.h.
|
private |
Definition at line 138 of file DeadlockMgr.h.
Referenced by DeadlockMgr(), removeTransaction(), and walk().
|
private |
Definition at line 125 of file DeadlockMgr.h.
Referenced by deadlock(), and DeadlockMgr().
|
private |
Definition at line 124 of file DeadlockMgr.h.
Referenced by deadlock(), and DeadlockMgr().
|
private |
Definition at line 123 of file DeadlockMgr.h.
|
private |
Definition at line 126 of file DeadlockMgr.h.
Referenced by DeadlockMgr().
|
private |
Definition at line 143 of file DeadlockMgr.h.
Referenced by deadlock(), DeadlockMgr(), and removeTransaction().
|
private |
Definition at line 146 of file DeadlockMgr.h.
Referenced by algorithm(), and walk().
|
private |
Definition at line 145 of file DeadlockMgr.h.
Referenced by algorithm(), and walk().
|
private |
Definition at line 149 of file DeadlockMgr.h.
Referenced by algorithm(), and walk().
|
private |
Definition at line 132 of file DeadlockMgr.h.
Referenced by DeadlockMgr(), and removeTransaction().
|
private |
Definition at line 135 of file DeadlockMgr.h.
Referenced by algorithm(), DeadlockMgr(), removeTransaction(), and walk().
|
private |
Definition at line 141 of file DeadlockMgr.h.
Referenced by DeadlockMgr(), and removeTransaction().