InfiniSQL
v0.1.2-alpha
Massive Scale Transaction Processing
|
Engine actor. Each Engine corresponds to a data partition. More...
#include <Engine.h>
Classes | |
struct | background_s |
for replication of out-of-order subtransactions More... | |
Public Member Functions | |
Engine (Topology::partitionAddress *myIdentityArg) | |
execute Engine actor More... | |
virtual | ~Engine () |
bool | applyItem (int64_t subtransactionid, class Schema &schemaRef, MessageDispatch::record_s &record) |
apply record on replica More... | |
bool | applyItem (int64_t subtransactionid, class Schema &schemaRef, MessageApply::applyindex_s &indexinfo) |
apply record on replica More... | |
Public Attributes | |
class Message * | msgsnd |
int64_t | operationid |
int64_t | domainid |
int64_t | userid |
int64_t | status |
Topology::addressStruct | taAddr |
class Message * | msgrcv |
REUSEMESSAGES domainidToSchemaMap | domainidsToSchemata |
class Mboxes | mboxes |
Topology::partitionAddress | myIdentity |
int64_t | partitionid |
Private Member Functions | |
int64_t | getnextsubtransactionid () |
generate unique, increasing (per actor) subtransactionid More... | |
void | createschema () |
create Schema More... | |
void | createtable () |
CREATE TABLE. More... | |
void | addcolumn () |
ADD COLUMN with optional index. More... | |
void | deleteindex () |
DELETE INDEX. More... | |
void | deletetable () |
DROP TABLE. More... | |
void | deleteschema () |
delete schema More... | |
void | getMyPartitionid () |
learn global partitionid based on position in replica More... | |
void | apply () |
replicate set of row or index items to data partition More... | |
void | background (class MessageApply &inmsg, MessageDispatch::record_s &item) |
background item with subtransactionid More... | |
void | background (class MessageApply &inmsg, MessageApply::applyindex_s &item) |
background item with subtransactionid More... | |
Private Attributes | |
class Topology | myTopology |
class Mbox * | mymboxPtr |
int64_t | argsize |
int64_t | nextsubtransactionid |
int64_t | instance |
boost::unordered_map< int64_t, class SubTransaction * > | SubTransactions |
std::map< int64_t, background_s > | backgrounded |
Friends | |
class | SubTransaction |
Engine::Engine | ( | Topology::partitionAddress * | myIdentityArg) |
execute Engine actor
myIdentityArg | how to indentify this |
enter message receive event loop
Definition at line 32 of file Engine.cc.
References addcolumn(), Topology::partitionAddress::address, apply(), argsize, MessageUserSchema::userschema_s::argsize, BUILTINADDCOLUMN, MessageUserSchema::userschema_s::builtincmd, BUILTINCREATESCHEMA, BUILTINCREATETABLE, BUILTINDELETEINDEX, BUILTINDELETESCHEMA, BUILTINDELETETABLE, createschema(), createtable(), deleteindex(), deleteschema(), deletetable(), domainid, MessageUserSchema::userschema_s::domainid, GETMSG, getMyPartitionid(), Topology::partitionAddress::instance, instance, logfile, Topology::partitionAddress::mbox, mboxes, Message::messageStruct, msgrcv, MSGRECEIVEBATCHSIZE, myIdentity, myTopology, Topology::addressStruct::nodeid, Mboxes::nodeid, operationid, MessageUserSchema::userschema_s::operationid, Message::message_s::payloadtype, PAYLOADUSERSCHEMA, SubTransaction::processTransactionMessage(), Mboxes::sendObBatch(), Message::message_s::sourceAddr, MessageTransaction::transaction_s::subtransactionid, SubTransactions, taAddr, Message::message_s::topic, TOPIC_APPLY, TOPIC_ENDSUBTRANSACTION, TOPIC_SCHEMAREQUEST, TOPIC_TOPOLOGY, TOPIC_TRANSACTION, MessageTransaction::transactionStruct, Mboxes::update(), userid, MessageUserSchema::userschema_s::userid, and MessageUserSchema::userschemaStruct.
|
private |
ADD COLUMN with optional index.
Definition at line 193 of file Engine.cc.
References BUILTIN_STATUS_OK, domainid, domainidsToSchemata, MessageUserSchema::userschema_s::fieldid, MessageUserSchema::userschema_s::fieldlen, MessageUserSchema::userschema_s::fieldtype, MessageUserSchema::userschema_s::indextype, Message::messageStruct, msgrcv, Message::message_s::sourceAddr, status, MessageUserSchema::userschema_s::tableid, MessageUserSchema::userschemaStruct, and TransactionAgent::usmReply().
Referenced by Engine().
|
private |
replicate set of row or index items to data partition
Definition at line 689 of file Engine.cc.
References Topology::partitionAddress::address, applyItem(), MessageApply::applyStruct, background(), backgrounded, MessageApply::apply_s::domainid, domainidsToSchemata, Engine::background_s::indices, MessageApply::indices, mboxes, Message::messageStruct, msgrcv, myIdentity, Engine::background_s::rows, MessageApply::rows, Message::message_s::sourceAddr, MessageApply::apply_s::subtransactionid, and Mboxes::toActor().
Referenced by Engine().
bool Engine::applyItem | ( | int64_t | subtransactionid, |
class Schema & | schemaRef, | ||
MessageDispatch::record_s & | record | ||
) |
apply record on replica
subtransactionid | subtransactionid |
schemaRef | Schema |
record | row to apply |
Definition at line 249 of file Engine.cc.
References DELETE, INSERT, rowdata_s::previoussubtransactionid, MessageDispatch::record_s::primitive, rowdata_s::row, MessageDispatch::record_s::row, MessageDispatch::record_s::rowid, Table::rows, MessageDispatch::record_s::tableid, Schema::tables, and UPDATE.
Referenced by apply().
bool Engine::applyItem | ( | int64_t | subtransactionid, |
class Schema & | schemaRef, | ||
MessageApply::applyindex_s & | indexinfo | ||
) |
apply record on replica
subtransactionid | subtransactionid |
schemaRef | Schema |
indexinfo | index entry to apply |
Definition at line 322 of file Engine.cc.
References Index::addifnotthere(), fieldInput_u::boolean, fieldInput_u::character, Index::checkifmatch(), Index::checkifthere(), nonLockingIndexEntry_s::engineid, MessageApply::applyindex_s::entry, MessageApply::applyindex_s::fieldid, Table::fields, MessageApply::applyindex_s::fieldVal, MessageApply::applyindex_s::flags, fieldInput_u::floating, MessageApply::getisaddflag(), Index::getprevioussubtransactionid(), Index::indexmaptype, Index::indextype, fieldInput_u::integer, fieldValue_s::isnull, nonuniquebool, Index::nonuniqueBoolIndex, nonuniquechar, Index::nonuniqueCharIndex, nonuniquecharx, nonuniquefloat, Index::nonuniqueFloatIndex, nonuniqueint, Index::nonuniqueIntIndex, Index::nonuniqueStringIndex, nonuniqueuint, Index::nonuniqueUintIndex, nonuniquevarchar, Index::nulls, Index::rm(), nonLockingIndexEntry_s::rowid, fieldValue_s::str, MessageApply::applyindex_s::tableid, Schema::tables, fieldInput_u::uinteger, UNIQUE, UNIQUENOTNULL, UNORDERED, UNORDEREDNOTNULL, and fieldValue_s::value.
|
private |
background item with subtransactionid
items need to be applied in order of subtransactionid. placed in background, need to be applied once previous items have been replicated
inmsg | MessageApply received |
item | row |
Definition at line 759 of file Engine.cc.
References Engine::background_s::applierid, MessageApply::apply_s::applierid, MessageApply::applyStruct, backgrounded, Message::messageStruct, Message::message_s::sourceAddr, MessageApply::apply_s::subtransactionid, and Engine::background_s::taAddress.
Referenced by apply().
|
private |
background item with subtransactionid
items need to be applied in order of subtransactionid. placed in background, need to be applied once previous items have been replicated
inmsg | MessageApply received |
item | index entry |
Definition at line 773 of file Engine.cc.
References Engine::background_s::applierid, MessageApply::apply_s::applierid, MessageApply::applyStruct, backgrounded, Message::messageStruct, Message::message_s::sourceAddr, MessageApply::apply_s::subtransactionid, and Engine::background_s::taAddress.
|
private |
create Schema
Definition at line 175 of file Engine.cc.
References createSchema(), Message::messageStruct, msgrcv, Message::message_s::sourceAddr, and TransactionAgent::usmReply().
Referenced by Engine().
|
private |
CREATE TABLE.
Definition at line 182 of file Engine.cc.
References MessageUserSchema::userschema_s::domainid, domainidsToSchemata, Message::messageStruct, msgrcv, Message::message_s::sourceAddr, status, MessageUserSchema::userschema_s::tableid, MessageUserSchema::userschemaStruct, and TransactionAgent::usmReply().
Referenced by Engine().
|
private |
DELETE INDEX.
Definition at line 208 of file Engine.cc.
References BUILTIN_STATUS_OK, Message::messageStruct, msgrcv, Message::message_s::sourceAddr, status, and TransactionAgent::usmReply().
Referenced by Engine().
|
private |
delete schema
Definition at line 224 of file Engine.cc.
References BUILTIN_STATUS_OK, Message::messageStruct, msgrcv, Message::message_s::sourceAddr, status, and TransactionAgent::usmReply().
Referenced by Engine().
|
private |
DROP TABLE.
Definition at line 216 of file Engine.cc.
References BUILTIN_STATUS_OK, Message::messageStruct, msgrcv, Message::message_s::sourceAddr, status, and TransactionAgent::usmReply().
Referenced by Engine().
|
private |
learn global partitionid based on position in replica
Definition at line 237 of file Engine.cc.
References Topology::partitionAddress::mbox, myIdentity, myTopology, partitionid, and Topology::partitionListThisReplica.
Referenced by Engine().
|
private |
generate unique, increasing (per actor) subtransactionid
Definition at line 232 of file Engine.cc.
References nextsubtransactionid.
Referenced by SubTransaction::SubTransaction().
|
friend |
|
private |
Definition at line 186 of file Engine.h.
Referenced by apply(), and background().
int64_t Engine::domainid |
Definition at line 96 of file Engine.h.
Referenced by addcolumn(), and Engine().
REUSEMESSAGES domainidToSchemaMap Engine::domainidsToSchemata |
Definition at line 103 of file Engine.h.
Referenced by addcolumn(), apply(), createtable(), and SubTransaction::SubTransaction().
class Mboxes Engine::mboxes |
Definition at line 104 of file Engine.h.
Referenced by apply(), Engine(), and SubTransaction::replyTransaction().
class Message* Engine::msgrcv |
Definition at line 101 of file Engine.h.
Referenced by addcolumn(), apply(), createschema(), createtable(), deleteindex(), deleteschema(), deletetable(), and Engine().
Topology::partitionAddress Engine::myIdentity |
Definition at line 105 of file Engine.h.
Referenced by apply(), Engine(), getMyPartitionid(), and SubTransaction::replyTransaction().
|
private |
Definition at line 179 of file Engine.h.
Referenced by Engine(), and getMyPartitionid().
|
private |
Definition at line 183 of file Engine.h.
Referenced by getnextsubtransactionid().
int64_t Engine::partitionid |
Definition at line 106 of file Engine.h.
Referenced by SubTransaction::drainIndexLockQueue(), SubTransaction::drainRowLockQueue(), getMyPartitionid(), and SubTransaction::replyTransaction().
int64_t Engine::status |
Definition at line 98 of file Engine.h.
Referenced by addcolumn(), createtable(), deleteindex(), deleteschema(), and deletetable().
|
private |
Definition at line 185 of file Engine.h.
Referenced by SubTransaction::drainIndexLockQueue(), SubTransaction::drainRowLockQueue(), Engine(), SubTransaction::SubTransaction(), and SubTransaction::~SubTransaction().
Topology::addressStruct Engine::taAddr |