InfiniSQL  v0.1.2-alpha
Massive Scale Transaction Processing
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
defs.h File Reference

Global struct & enum types, global function declarations, global symbols in general. More...

#include "infinisql.h"
Include dependency graph for defs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cfg_s
 global config parameters More...
 
struct  serventIdentity_s
 orphan More...
 
struct  procedures_s
 stored procedure creator and destructor function pointers More...
 
struct  newDeadLockLists_s
 items to add to wait-for graph More...
 
struct  rowOrField_s
 data items describing manipulation request More...
 
struct  searchParams_s
 describes how to perform an SQL search expression predicate More...
 
struct  nonLockingIndexEntry_s
 index map value for non-unique indices More...
 
struct  subtransactionCmd_s
 command contents between Transaction and Subtransaction More...
 
struct  listenerStruct_s
 used by Listner to know what to listen to More...
 
struct  locked_s
 orphan? More...
 
struct  lockFieldValue_s
 for tracking lock types for transactions with unique index entries More...
 
struct  stagedRow_s
 rows and unique index entries worked on by Transaction More...
 

Macros

#define BUILTIN_STATUS_OK   0
 
#define BUILTIN_STATUS_NOTOK   1
 
#define PAYLOADSIZE   128
 
#define NUMSOCKETS   1048576
 
#define RTPRIO   30
 
#define MSGRECEIVEBATCHSIZE   500
 
#define OBGWMSGBATCHSIZE   5000
 
#define OPERAND_STRING   'a'
 
#define OPERAND_IDENTIFIER   'b'
 
#define OPERAND_PARAMETER   'c'
 
#define OPERAND_SUBQUERY   'd'
 
#define OPERAND_INTEGER   'e'
 
#define OPERAND_FLOAT   'f'
 
#define OPERAND_AGGREGATE   'g'
 
#define OPERAND_FIELDID   'h'
 
#define OPERAND_NULL   'i'
 
#define OPERAND_PREDICATERESULTS   'j'
 
#define OPERAND_SUBQUERYRESULTS   'k'
 
#define OPERAND_BOOLEAN   'l'
 
#define AGGREGATE_AVG   'a'
 
#define AGGREGATE_COUNT   'b'
 
#define AGGREGATE_MAX   'c'
 
#define AGGREGATE_MIN   'd'
 
#define AGGREGATE_SUM   'e'
 
#define BUILTINCREATESCHEMA   3
 
#define BUILTINCREATETABLE   4
 
#define BUILTINADDCOLUMN   5
 
#define BUILTINDELETEINDEX   6
 
#define BUILTINDELETETABLE   7
 
#define BUILTINDELETESCHEMA   8
 
#define BUILTINDUMPCONFIG   9
 
#define ST_USM   1
 
#define ST_TASENGINES   2
 
#define OP_AUTH   1
 
#define OP_SCHEMA   2
 
#define OP_PGLOGIN   3
 
#define SERIALIZEDMAXSIZE   1048576
 
#define DELETEFLAG   0
 
#define INSERTFLAG   1
 
#define LOCKEDFLAG   2
 
#define LOCKTYPEFLAG   3
 
#define REPLACEDELETEFLAG   4
 

Typedefs

typedef nonLockingIndexEntry_s indexEntry_s
 
typedef boost::unordered_map
< int64_t, class Schema * > 
domainidToSchemaMap
 

Enumerations

enum  listenertype_e { LISTENER_NONE = 0, LISTENER_RAW, LISTENER_PG }
 type of network listener More...
 
enum  builtincmds_e {
  NOCMD = 0, STARTCMD, OKCMD, NOTOKCMD,
  USMRESPONSECMD, TASENGINESRESPONSECMD, ABORTCMD
}
 state of DDL operation on raw interface for create table, index, etc. More...
 
enum  indextype_e {
  NONE = 0, UNIQUE = 1, NONUNIQUE = 2, UNORDERED = 3,
  UNIQUENOTNULL = 4, NONUNIQUENOTNULL = 5, UNORDEREDNOTNULL = 6
}
 index types with or without NULL constraint More...
 
enum  indexmaptype_e {
  noindexmaptype = -1, uniqueint = 0, nonuniqueint = 1, unorderedint = 2,
  uniqueuint = 3, nonuniqueuint = 4, unordereduint = 5, uniquebool = 6,
  nonuniquebool = 7, unorderedbool = 8, uniquefloat = 9, nonuniquefloat = 10,
  unorderedfloat = 11, uniquechar = 12, nonuniquechar = 13, unorderedchar = 14,
  uniquecharx = 15, nonuniquecharx = 16, unorderedcharx = 17, uniquevarchar = 18,
  nonuniquevarchar = 19, unorderedvarchar = 20
}
 types of maps for various indices More...
 
enum  maptype_e { Nomaptype = -1, Unique = 0, Nonunique = 1, Unordered = 2 }
 map types More...
 
enum  topic_e {
  TOPIC_NONE = 0, TOPIC_MBOXES = 1, TOPIC_SOCKET = 2, TOPIC_LOGIN = 3,
  TOPIC_LOGINOK = 4, TOPIC_LOGINFAIL = 5, TOPIC_CHANGEPASSWORD = 6, TOPIC_CHANGEPASSWORDOK = 7,
  TOPIC_CHANGEPASSWORDFAIL = 8, TOPIC_CREATEDOMAIN = 9, TOPIC_CREATEDOMAINOK = 10, TOPIC_CREATEDOMAINFAIL = 11,
  TOPIC_CREATEUSER = 12, TOPIC_CREATEUSEROK = 13, TOPIC_CREATEUSERFAIL = 14, TOPIC_DELETEUSER = 15,
  TOPIC_DELETEUSEROK = 16, TOPIC_DELETEUSERFAIL = 17, TOPIC_DELETEDOMAIN = 18, TOPIC_DELETEDOMAINOK = 19,
  TOPIC_DELETEDOMAINFAIL = 20, TOPIC_SCHEMAREQUEST = 21, TOPIC_SCHEMAREPLY = 22, TOPIC_DEADLOCKNEW = 23,
  TOPIC_DEADLOCKCHANGE = 24, TOPIC_DEADLOCKREMOVE = 25, TOPIC_LOADPROCEDURE = 26, TOPIC_TRANSACTION = 27,
  TOPIC_DISPATCH = 28, TOPIC_ACKDISPATCH = 29, TOPIC_DEADLOCKABORT = 30, TOPIC_ENDSUBTRANSACTION = 31,
  TOPIC_TOPOLOGY = 33, TOPIC_NEWPROCEDURE = 34, TOPIC_PROCEDURE1 = 35, TOPIC_PROCEDURE2 = 36,
  TOPIC_APPLY = 37, TOPIC_ACKAPPLY = 38, TOPIC_OPERATION = 41, TOPIC_COMPILE = 42,
  TOPIC_TABLENAME = 43, TOPIC_FIELDNAME = 44, TOPIC_SERIALIZED = 45, TOPIC_BATCHSERIALIZED = 46,
  TOPIC_SOCKETCONNECTED = 47
}
 Message variant topics. More...
 
enum  payloadtype_e {
  PAYLOADNONE = 0, PAYLOADMESSAGE, PAYLOADSOCKET, PAYLOADUSERSCHEMA,
  PAYLOADDEADLOCK, PAYLOADSUBTRANSACTION, PAYLOADCOMMITROLLBACK, PAYLOADDISPATCH,
  PAYLOADACKDISPATCH, PAYLOADAPPLY, PAYLOADACKAPPLY, PAYLOADSERIALIZED,
  PAYLOADBATCHSERIALIZED
}
 Message variant payloads. More...
 
enum  operationtype_e { OPERATION_NONE = 0, OPERATION_LOGIN }
 type of Operation (only currently used for SQL login) More...
 
enum  enginecmds_e { enginecmdnewrow }
 
enum  pendingprimitive_e {
  NOCOMMAND = 0, INSERT, UPDATE, DELETE,
  REPLACE, SELECT, FETCH, UNLOCK,
  COMMIT, ROLLBACK, PRIMITIVE_SQLPREDICATE, PRIMITIVE_SQLSELECTALL,
  PRIMITIVE_SQLSELECTALLFORDELETE, PRIMITIVE_SQLSELECTALLFORUPDATE, PRIMITIVE_SQLDELETE, PRIMITIVE_SQLINSERT,
  PRIMITIVE_SQLUPDATE, PRIMITIVE_SQLREPLACE
}
 pending transactional activity More...
 
enum  enginecmd_e {
  NOENGINECMD = 0, NEWROW, UNIQUEINDEX, UPDATEROW,
  DELETEROW, REPLACEDELETEROW, INDEXSEARCH, SELECTROWS,
  COMMITCMD, ROLLBACKCMD, REVERTCMD, UNLOCKCMD,
  SEARCHRETURN1
}
 command for Engine / Subtransaction to perform More...
 
enum  deadlockchange_e {
  ADDLOCKEDENTRY = 1, ADDLOCKPENDINGENTRY, REMOVELOCKEDENTRY, REMOVELOCKPENDINGENTRY,
  TRANSITIONPENDINGTOLOCKEDENTRY
}
 type of change for DeadlockMgr wait-for graph More...
 

Functions

void debug (char *, int, char *)
 
void trimspace (string &)
 
void msgpack2Vector (vector< string > *resultvector, char *payload, int64_t length)
 convert msgpack to a vector of strings More...
 
char setdeleteflag (char *c)
 for delete operations on row More...
 
bool getdeleteflag (char c)
 check if row operation is delete More...
 
char cleardeleteflag (char *c)
 clear delete operation on row More...
 
char setinsertflag (char *c)
 for insert operations on row More...
 
bool getinsertflag (char c)
 check if row operation is insert More...
 
char clearinsertflag (char *c)
 clear insert operation on row More...
 
char clearlockedflag (char *c)
 clear locked flag on row More...
 
locktype_e getlocktype (char c)
 check if row is locked and type More...
 
bool setwritelock (char *c)
 set write lock on row More...
 
bool setreadlock (char *c)
 set read lock on row More...
 
char setreplacedeleteflag (char *c)
 set delete as part of replace row flag More...
 
bool getreplacedeleteflag (char c)
 get whether or not row is deleted as part of row replacement More...
 
char clearreplacedeleteflag (char *c)
 clear row as deleted as part of row replacement More...
 
int16_t getPartitionid (fieldValue_s &fieldVal, fieldtype_e type, int16_t numpartitions)
 hash of field value for partition id More...
 
void like2Regex (string &likeStr)
 might be orpha, but convert LIKE operand to regex More...
 
bool compareFields (fieldtype_e type, const fieldValue_s &val1, const fieldValue_s &val2)
 compare field values for equality More...
 
void stagedRow2ReturnRow (const stagedRow_s &stagedRow, returnRow_s &returnRow)
 convert stagedRow_s to returnRow_s More...
 
void setprio ()
 set real-time priority More...
 

Variables

cfg_s cfgs
 
FILE * logfile
 
std::string zmqsocket
 
void * zmqcontext
 
std::string storedprocprefix
 
class Topology nodeTopology
 
pthread_mutex_t nodeTopologyMutex
 
pthread_mutex_t connectionsMutex
 
std::vector< class MboxProducer * > socketAffinity
 
std::vector< listenertype_elistenerTypes
 

Detailed Description

Global struct & enum types, global function declarations, global symbols in general.

Author
Mark Travis mtrav.nosp@m.is15.nosp@m.432+s.nosp@m.rc@g.nosp@m.mail..nosp@m.com
Date
Tue Dec 17 12:47:30 2013

Definition in file defs.h.

Macro Definition Documentation

#define AGGREGATE_AVG   'a'

Definition at line 232 of file defs.h.

#define AGGREGATE_COUNT   'b'

Definition at line 233 of file defs.h.

#define AGGREGATE_MAX   'c'

Definition at line 234 of file defs.h.

#define AGGREGATE_MIN   'd'

Definition at line 235 of file defs.h.

#define AGGREGATE_SUM   'e'

Definition at line 236 of file defs.h.

#define BUILTIN_STATUS_NOTOK   1
#define BUILTINADDCOLUMN   5
#define BUILTINCREATESCHEMA   3
#define BUILTINCREATETABLE   4
#define BUILTINDELETEINDEX   6
#define BUILTINDELETESCHEMA   8
#define BUILTINDELETETABLE   7
#define BUILTINDUMPCONFIG   9

Definition at line 245 of file defs.h.

#define DELETEFLAG   0

Definition at line 507 of file defs.h.

Referenced by cleardeleteflag(), getdeleteflag(), and setdeleteflag().

#define INSERTFLAG   1

Definition at line 508 of file defs.h.

Referenced by clearinsertflag(), getinsertflag(), and setinsertflag().

#define LOCKEDFLAG   2

Definition at line 509 of file defs.h.

Referenced by clearlockedflag(), getlocktype(), setreadlock(), and setwritelock().

#define LOCKTYPEFLAG   3

Definition at line 510 of file defs.h.

Referenced by getlocktype(), setreadlock(), and setwritelock().

#define MSGRECEIVEBATCHSIZE   500
#define NUMSOCKETS   1048576

Definition at line 37 of file defs.h.

Referenced by Listener::Listener(), and Pg::pgclosesocket().

#define OBGWMSGBATCHSIZE   5000

Definition at line 44 of file defs.h.

Referenced by MboxProducer::sendMsg().

#define OP_AUTH   1

Definition at line 252 of file defs.h.

#define OP_PGLOGIN   3

Definition at line 254 of file defs.h.

#define OP_SCHEMA   2

Definition at line 253 of file defs.h.

Referenced by Operation::Operation().

#define OPERAND_AGGREGATE   'g'

Definition at line 225 of file defs.h.

Referenced by Larxer::pushaggregate(), and Statement::resolveTableFields2().

#define OPERAND_BOOLEAN   'l'
#define OPERAND_IDENTIFIER   'b'
#define OPERAND_NULL   'i'
#define OPERAND_PARAMETER   'c'

Definition at line 221 of file defs.h.

Referenced by Ast::evaluate(), Ast::normalizeSetAssignmentOperand(), and Larxer::printstack().

#define OPERAND_PREDICATERESULTS   'j'

Definition at line 228 of file defs.h.

#define OPERAND_SUBQUERY   'd'
#define OPERAND_SUBQUERYRESULTS   'k'

Definition at line 229 of file defs.h.

#define PAYLOADSIZE   128

Definition at line 36 of file defs.h.

Referenced by TransactionAgent::readSocket(), and TransactionAgent::sendResponse().

#define REPLACEDELETEFLAG   4

Definition at line 511 of file defs.h.

Referenced by clearreplacedeleteflag(), getreplacedeleteflag(), and setreplacedeleteflag().

#define RTPRIO   30

Definition at line 42 of file defs.h.

Referenced by setprio().

#define SERIALIZEDMAXSIZE   1048576

Global configs

Definition at line 321 of file defs.h.

Referenced by IbGateway::IbGateway(), IbGateway::inbufhandler(), and ObGateway::ObGateway().

#define ST_TASENGINES   2

Definition at line 249 of file defs.h.

#define ST_USM   1

Definition at line 248 of file defs.h.

Typedef Documentation

typedef boost::unordered_map<int64_t, class Schema *> domainidToSchemaMap

Definition at line 500 of file defs.h.

Definition at line 412 of file defs.h.

Enumeration Type Documentation

state of DDL operation on raw interface for create table, index, etc.

Enumerator
NOCMD 
STARTCMD 
OKCMD 
NOTOKCMD 
USMRESPONSECMD 
TASENGINESRESPONSECMD 
ABORTCMD 

Definition at line 64 of file defs.h.

65 {
66  NOCMD = 0,
67  STARTCMD,
68  OKCMD,
69  NOTOKCMD,
72  ABORTCMD
73 };

type of change for DeadlockMgr wait-for graph

Enumerator
ADDLOCKEDENTRY 
ADDLOCKPENDINGENTRY 
REMOVELOCKEDENTRY 
REMOVELOCKPENDINGENTRY 
TRANSITIONPENDINGTOLOCKEDENTRY 

Definition at line 517 of file defs.h.

command for Engine / Subtransaction to perform

Enumerator
NOENGINECMD 
NEWROW 
UNIQUEINDEX 
UPDATEROW 
DELETEROW 
REPLACEDELETEROW 
INDEXSEARCH 
SELECTROWS 
COMMITCMD 
ROLLBACKCMD 
REVERTCMD 
UNLOCKCMD 
SEARCHRETURN1 

Definition at line 303 of file defs.h.

304 {
305  NOENGINECMD = 0,
306  NEWROW,
307  UNIQUEINDEX,
308  UPDATEROW,
309  DELETEROW,
311  INDEXSEARCH,
312  SELECTROWS,
313  COMMITCMD,
314  ROLLBACKCMD,
315  REVERTCMD,
316  UNLOCKCMD,
318 };
Enumerator
enginecmdnewrow 

Definition at line 268 of file defs.h.

269 {
271 };

types of maps for various indices

Enumerator
noindexmaptype 
uniqueint 
nonuniqueint 
unorderedint 
uniqueuint 
nonuniqueuint 
unordereduint 
uniquebool 
nonuniquebool 
unorderedbool 
uniquefloat 
nonuniquefloat 
unorderedfloat 
uniquechar 
nonuniquechar 
unorderedchar 
uniquecharx 
nonuniquecharx 
unorderedcharx 
uniquevarchar 
nonuniquevarchar 
unorderedvarchar 

Definition at line 94 of file defs.h.

95 {
96  noindexmaptype = -1,
97  uniqueint = 0,
98  nonuniqueint = 1,
99  unorderedint = 2,
100  uniqueuint = 3,
101  nonuniqueuint = 4,
102  unordereduint = 5,
103  uniquebool = 6,
104  nonuniquebool = 7,
105  unorderedbool = 8,
106  uniquefloat = 9,
107  nonuniquefloat = 10,
108  unorderedfloat = 11,
109  uniquechar = 12,
110  nonuniquechar = 13,
111  unorderedchar = 14,
112  uniquecharx = 15,
113  nonuniquecharx = 16,
114  unorderedcharx = 17,
115  uniquevarchar = 18,
116  nonuniquevarchar = 19,
117  unorderedvarchar = 20
118 };

index types with or without NULL constraint

Enumerator
NONE 
UNIQUE 
NONUNIQUE 
UNORDERED 
UNIQUENOTNULL 
NONUNIQUENOTNULL 
UNORDEREDNOTNULL 

Definition at line 79 of file defs.h.

80 {
81  NONE = 0,
82  UNIQUE = 1,
83  NONUNIQUE = 2,
84  UNORDERED = 3,
85  UNIQUENOTNULL = 4,
86  NONUNIQUENOTNULL = 5,
88  };

type of network listener

Enumerator
LISTENER_NONE 
LISTENER_RAW 

for create table, etc.

LISTENER_PG 

for SQL

Definition at line 52 of file defs.h.

53 {
54  LISTENER_NONE = 0,
55  LISTENER_RAW,
57  };
enum maptype_e

map types

Enumerator
Nomaptype 
Unique 
Nonunique 
Unordered 

Definition at line 124 of file defs.h.

125 {
126  Nomaptype = -1,
127  Unique = 0,
128  Nonunique = 1,
129  Unordered = 2
130 };

type of Operation (only currently used for SQL login)

Enumerator
OPERATION_NONE 
OPERATION_LOGIN 

Definition at line 212 of file defs.h.

213 {
214  OPERATION_NONE = 0,
216  };

Message variant payloads.

tend to correspond with specific Message variant

Enumerator
PAYLOADNONE 
PAYLOADMESSAGE 
PAYLOADSOCKET 
PAYLOADUSERSCHEMA 
PAYLOADDEADLOCK 
PAYLOADSUBTRANSACTION 
PAYLOADCOMMITROLLBACK 
PAYLOADDISPATCH 
PAYLOADACKDISPATCH 
PAYLOADAPPLY 
PAYLOADACKAPPLY 
PAYLOADSERIALIZED 
PAYLOADBATCHSERIALIZED 

Definition at line 191 of file defs.h.

pending transactional activity

Enumerator
NOCOMMAND 
INSERT 
UPDATE 
DELETE 
REPLACE 
SELECT 
FETCH 
UNLOCK 
COMMIT 
ROLLBACK 
PRIMITIVE_SQLPREDICATE 
PRIMITIVE_SQLSELECTALL 
PRIMITIVE_SQLSELECTALLFORDELETE 
PRIMITIVE_SQLSELECTALLFORUPDATE 
PRIMITIVE_SQLDELETE 
PRIMITIVE_SQLINSERT 
PRIMITIVE_SQLUPDATE 
PRIMITIVE_SQLREPLACE 

Definition at line 277 of file defs.h.

enum topic_e

Message variant topics.

Enumerator
TOPIC_NONE 
TOPIC_MBOXES 
TOPIC_SOCKET 
TOPIC_LOGIN 
TOPIC_LOGINOK 
TOPIC_LOGINFAIL 
TOPIC_CHANGEPASSWORD 
TOPIC_CHANGEPASSWORDOK 
TOPIC_CHANGEPASSWORDFAIL 
TOPIC_CREATEDOMAIN 
TOPIC_CREATEDOMAINOK 
TOPIC_CREATEDOMAINFAIL 
TOPIC_CREATEUSER 
TOPIC_CREATEUSEROK 
TOPIC_CREATEUSERFAIL 
TOPIC_DELETEUSER 
TOPIC_DELETEUSEROK 
TOPIC_DELETEUSERFAIL 
TOPIC_DELETEDOMAIN 
TOPIC_DELETEDOMAINOK 
TOPIC_DELETEDOMAINFAIL 
TOPIC_SCHEMAREQUEST 
TOPIC_SCHEMAREPLY 
TOPIC_DEADLOCKNEW 
TOPIC_DEADLOCKCHANGE 
TOPIC_DEADLOCKREMOVE 
TOPIC_LOADPROCEDURE 
TOPIC_TRANSACTION 
TOPIC_DISPATCH 
TOPIC_ACKDISPATCH 
TOPIC_DEADLOCKABORT 
TOPIC_ENDSUBTRANSACTION 
TOPIC_TOPOLOGY 
TOPIC_NEWPROCEDURE 
TOPIC_PROCEDURE1 
TOPIC_PROCEDURE2 
TOPIC_APPLY 
TOPIC_ACKAPPLY 
TOPIC_OPERATION 
TOPIC_COMPILE 
TOPIC_TABLENAME 
TOPIC_FIELDNAME 
TOPIC_SERIALIZED 
TOPIC_BATCHSERIALIZED 
TOPIC_SOCKETCONNECTED 

Definition at line 136 of file defs.h.

137 {
138  TOPIC_NONE = 0,
139  TOPIC_MBOXES = 1,
140  TOPIC_SOCKET = 2,
141  TOPIC_LOGIN = 3,
142  TOPIC_LOGINOK = 4,
143  TOPIC_LOGINFAIL = 5,
147  TOPIC_CREATEDOMAIN = 9,
150  TOPIC_CREATEUSER = 12,
151  TOPIC_CREATEUSEROK = 13,
153  TOPIC_DELETEUSER = 15,
154  TOPIC_DELETEUSEROK = 16,
156  TOPIC_DELETEDOMAIN = 18,
159  TOPIC_SCHEMAREQUEST = 21,
160  TOPIC_SCHEMAREPLY = 22,
161  TOPIC_DEADLOCKNEW = 23,
164  TOPIC_LOADPROCEDURE = 26,
165  TOPIC_TRANSACTION = 27,
166  TOPIC_DISPATCH = 28,
167  TOPIC_ACKDISPATCH = 29,
168  TOPIC_DEADLOCKABORT = 30,
170  TOPIC_TOPOLOGY = 33,
171  TOPIC_NEWPROCEDURE = 34,
172  TOPIC_PROCEDURE1 = 35,
173  TOPIC_PROCEDURE2 = 36,
174  TOPIC_APPLY = 37,
175  TOPIC_ACKAPPLY = 38,
176  TOPIC_OPERATION = 41,
177  TOPIC_COMPILE = 42,
178  TOPIC_TABLENAME = 43,
179  TOPIC_FIELDNAME = 44,
180  TOPIC_SERIALIZED = 45,
183  };

Function Documentation

char cleardeleteflag ( char *  c)

clear delete operation on row

Parameters
crowdata_s flags
Returns
rowdata_s flags

Definition at line 156 of file main.cc.

References DELETEFLAG.

Referenced by Table::commitRollbackUnlock().

157 {
158  return *c &= ~(1 << DELETEFLAG);
159 }

Here is the caller graph for this function:

char clearinsertflag ( char *  c)

clear insert operation on row

Parameters
crowdata_s flags
Returns
rowdata_s flags

Definition at line 171 of file main.cc.

References INSERTFLAG.

172 {
173  return *c &= ~(1 << INSERTFLAG);
174 }
char clearlockedflag ( char *  c)

clear locked flag on row

Parameters
crowdata_s flags
Returns
rowdata_s flags

Definition at line 200 of file main.cc.

References LOCKEDFLAG.

Referenced by Table::commitRollbackUnlock().

201 {
202  return *c &= ~(1 << LOCKEDFLAG);
203 }

Here is the caller graph for this function:

char clearreplacedeleteflag ( char *  c)

clear row as deleted as part of row replacement

Parameters
crowdata_s flags
Returns
rowdata_s flags

Definition at line 222 of file main.cc.

References REPLACEDELETEFLAG.

Referenced by Table::commitRollbackUnlock().

223 {
224  return *c &= ~(1 << REPLACEDELETEFLAG);
225 }

Here is the caller graph for this function:

bool compareFields ( fieldtype_e  type,
const fieldValue_s val1,
const fieldValue_s val2 
)

compare field values for equality

Parameters
typefield type
val1operand 1
val2operand 2
Returns
true (equal), false (unequal)

Definition at line 305 of file main.cc.

References BOOL, fieldInput_u::boolean, CHAR, fieldInput_u::character, CHARX, FLOAT, fieldInput_u::floating, INT, fieldInput_u::integer, fieldValue_s::isnull, fieldValue_s::str, UINT, fieldInput_u::uinteger, fieldValue_s::value, and VARCHAR.

Referenced by Statement::andPredicate(), Statement::stagedPredicate(), and Statement::subqueryUnique().

307 {
308  if (val1.isnull==true && val2.isnull==true)
309  {
310  return true;
311  }
312  else if (val1.isnull==true || val2.isnull==true)
313  {
314  return false;
315  }
316 
317  switch (type)
318  {
319  case INT:
320  if (val1.value.integer==val2.value.integer)
321  {
322  return true;
323  }
324 
325  break;
326 
327  case UINT:
328  if (val1.value.uinteger==val2.value.uinteger)
329  {
330  return true;
331  }
332 
333  break;
334 
335  case BOOL:
336  if (val1.value.boolean==val2.value.boolean)
337  {
338  return true;
339  }
340 
341  break;
342 
343  case FLOAT:
344  if (val1.value.floating==val2.value.floating)
345  {
346  return true;
347  }
348 
349  break;
350 
351  case CHAR:
352  if (val1.value.character==val2.value.character)
353  {
354  return true;
355  }
356 
357  break;
358 
359  case CHARX:
360  if (val1.str.compare(val2.str)==0)
361  {
362  return true;
363  }
364 
365  break;
366 
367  case VARCHAR:
368  if (val1.str.compare(val2.str)==0)
369  {
370  return true;
371  }
372 
373  break;
374 
375  default:
376  printf("%s %i anomaly %i\n", __FILE__, __LINE__, type);
377  }
378 
379  return false;
380 }

Here is the caller graph for this function:

void debug ( char *  ,
int  ,
char *   
)

Definition at line 141 of file main.cc.

References logfile.

142 {
143  fprintf(logfile, "DEBUG %i %s %s\n", line, file, description);
144 }
bool getdeleteflag ( char  c)

check if row operation is delete

Parameters
crowdata_s flags
Returns
is or is not set

Definition at line 151 of file main.cc.

References DELETEFLAG.

Referenced by Table::commitRollbackUnlock().

152 {
153  return c & 1 << DELETEFLAG;
154 }

Here is the caller graph for this function:

bool getinsertflag ( char  c)

check if row operation is insert

Parameters
crowdata_s flags
Returns
is or is not set

Definition at line 166 of file main.cc.

References INSERTFLAG.

Referenced by Table::assignToLockQueue(), Table::commitRollbackUnlock(), and Table::getrows().

167 {
168  return c & 1 << INSERTFLAG;
169 }

Here is the caller graph for this function:

locktype_e getlocktype ( char  c)

check if row is locked and type

Parameters
crowdata_s flags
Returns
NOLOCK|READLOCK|WRITELOCK

Definition at line 205 of file main.cc.

References LOCKEDFLAG, LOCKTYPEFLAG, NOLOCK, READLOCK, and WRITELOCK.

Referenced by Table::commitRollbackUnlock(), Table::deleterow(), Table::getrows(), Table::selectrows(), and Table::updaterow().

206 {
207  if (!(c & 1 << LOCKEDFLAG))
208  {
209  return NOLOCK;
210  }
211 
212  if (c & 1 << LOCKTYPEFLAG)
213  {
214  return WRITELOCK;
215  }
216  else
217  {
218  return READLOCK;
219  }
220 }

Here is the caller graph for this function:

int16_t getPartitionid ( fieldValue_s fieldVal,
fieldtype_e  type,
int16_t  numpartitions 
)

hash of field value for partition id

Parameters
fieldValfield value
typefield type
numpartitionsnumber of partitions
Returns

Definition at line 237 of file main.cc.

References BOOL, fieldInput_u::boolean, CHAR, fieldInput_u::character, CHARX, FLOAT, fieldInput_u::floating, SpookyHash::Hash64(), INT, fieldInput_u::integer, fieldValue_s::str, UINT, fieldInput_u::uinteger, fieldValue_s::value, and VARCHAR.

Referenced by TransactionAgent::handledispatch().

239 {
240  switch (type)
241  {
242  case INT:
243  return SpookyHash::Hash64((void *) &fieldVal.value.integer,
244  sizeof(fieldVal.value.integer), 0) %
245  numpartitions;
246  break;
247 
248  case UINT:
249  return SpookyHash::Hash64((void *) &fieldVal.value.uinteger,
250  sizeof(fieldVal.value.uinteger), 0) %
251  numpartitions;
252  break;
253 
254  case BOOL:
255  return SpookyHash::Hash64((void *) &fieldVal.value.boolean,
256  sizeof(fieldVal.value.boolean), 0) %
257  numpartitions;
258  break;
259 
260  case FLOAT:
261  return SpookyHash::Hash64((void *) &fieldVal.value.floating,
262  sizeof(fieldVal.value.floating), 0) %
263  numpartitions;
264  break;
265 
266  case CHAR:
267  return SpookyHash::Hash64((void *) &fieldVal.value.character,
268  sizeof(fieldVal.value.character), 0) %
269  numpartitions;
270  break;
271 
272  case CHARX:
273  return SpookyHash::Hash64((void *) fieldVal.str.c_str(),
274  fieldVal.str.length(), 0) % numpartitions;
275  break;
276 
277  case VARCHAR:
278  return SpookyHash::Hash64((void *) fieldVal.str.c_str(),
279  fieldVal.str.length(), 0) % numpartitions;
280  break;
281 
282  default:
283  printf("%s %i anomaly fieldtype %i\n", __FILE__, __LINE__, type);
284  return -1;
285  }
286 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool getreplacedeleteflag ( char  c)

get whether or not row is deleted as part of row replacement

Parameters
crowdata_s flags
Returns
is or is not

Definition at line 227 of file main.cc.

References REPLACEDELETEFLAG.

Referenced by Table::commitRollbackUnlock().

228 {
229  return c & 1 << REPLACEDELETEFLAG;
230 }

Here is the caller graph for this function:

void like2Regex ( string &  likeStr)

might be orpha, but convert LIKE operand to regex

Parameters
likeStrLIKE operand

Definition at line 289 of file main.cc.

Referenced by Statement::andPredicate(), Index::like(), and Index::notlike().

290 {
291  size_t pos;
292 
293  while ((pos = likeStr.find('_', 0)) != string::npos)
294  {
295  likeStr[pos]='.';
296  }
297 
298  while ((pos = likeStr.find('%', 0)) != string::npos)
299  {
300  likeStr[pos]='*';
301  likeStr.insert(pos, 1, '.');
302  }
303 }

Here is the caller graph for this function:

void msgpack2Vector ( vector< string > *  resultvector,
char *  payload,
int64_t  length 
)

convert msgpack to a vector of strings

Parameters
resultvectoroutput
payloadmsgpack data
lengthmsgpack length

Definition at line 133 of file main.cc.

Referenced by TransactionAgent::compile(), TransactionAgent::login(), TransactionAgent::newprocedure(), and UserSchemaMgr::UserSchemaMgr().

134 {
135  msgpack::unpacked msg;
136  msgpack::unpack(&msg, payload, length);
137  msgpack::object obj = msg.get();
138  obj.convert(resultvector);
139 }

Here is the caller graph for this function:

char setdeleteflag ( char *  c)

for delete operations on row

Parameters
crowdata_s flags
Returns
rowdata_s flags

Definition at line 146 of file main.cc.

References DELETEFLAG.

Referenced by Table::deleterow().

147 {
148  return *c |= 1 << DELETEFLAG;
149 }

Here is the caller graph for this function:

char setinsertflag ( char *  c)

for insert operations on row

Parameters
crowdata_s flags
Returns
rowdata_s flags

Definition at line 161 of file main.cc.

References INSERTFLAG.

Referenced by Table::newrow().

162 {
163  return *c |= 1 << INSERTFLAG;
164 }

Here is the caller graph for this function:

void setprio ( )

set real-time priority

for IbGateway and ObGateway to maximize throughput. Needs to be configured at OS level

Definition at line 424 of file main.cc.

References logfile, and RTPRIO.

Referenced by IbGateway::IbGateway(), and ObGateway::updateRemoteGateways().

425 {
426  struct sched_param params;
427  params.sched_priority=RTPRIO;
428  int rv=pthread_setschedparam(pthread_self(), SCHED_FIFO, &params);
429  if (rv != 0)
430  {
431  fprintf(logfile, "%s %i some problem setting priority %i for tid %li error %i\n", __FILE__, __LINE__, RTPRIO, pthread_self(), rv);
432  }
433 }

Here is the caller graph for this function:

bool setreadlock ( char *  c)

set read lock on row

Parameters
crowdata_s flags
Returns
success or failure

Definition at line 188 of file main.cc.

References LOCKEDFLAG, and LOCKTYPEFLAG.

Referenced by Table::commitRollbackUnlock(), Table::getrows(), and Table::selectrows().

189 {
190  if (*c & 1 << LOCKEDFLAG) // already locked
191  {
192  return false;
193  }
194 
195  *c |= 1 << LOCKEDFLAG;
196  *c &= ~(1 << LOCKTYPEFLAG);
197  return true;
198 }

Here is the caller graph for this function:

char setreplacedeleteflag ( char *  c)

set delete as part of replace row flag

Parameters
crowdata_s flags
Returns
rowdata_s flags

Definition at line 232 of file main.cc.

References REPLACEDELETEFLAG.

Referenced by Table::deleterow().

233 {
234  return *c |= 1 << REPLACEDELETEFLAG;
235 }

Here is the caller graph for this function:

bool setwritelock ( char *  c)

set write lock on row

Parameters
crowdata_s flags
Returns
success or failure

Definition at line 176 of file main.cc.

References LOCKEDFLAG, and LOCKTYPEFLAG.

Referenced by Table::getrows(), Table::newrow(), and Table::selectrows().

177 {
178  if (*c & 1 << LOCKEDFLAG) // already locked
179  {
180  return false;
181  }
182 
183  *c |= 1 << LOCKEDFLAG;
184  *c |= 1 << LOCKTYPEFLAG;
185  return true;
186 }

Here is the caller graph for this function:

void stagedRow2ReturnRow ( const stagedRow_s stagedRow,
returnRow_s returnRow 
)

convert stagedRow_s to returnRow_s

Parameters
stagedRowinput stagedRow_s
returnRowoutput returnRow_s

Definition at line 396 of file main.cc.

References stagedRow_s::cmd, INSERT, returnRow_s::locktype, stagedRow_s::locktype, stagedRow_s::newRow, stagedRow_s::newrowid, NOCOMMAND, stagedRow_s::originalRow, stagedRow_s::originalrowid, returnRow_s::previoussubtransactionid, stagedRow_s::previoussubtransactionid, returnRow_s::row, returnRow_s::rowid, and UPDATE.

Referenced by Statement::branchtotype(), and Statement::stagedPredicate().

397 {
399  returnRow.locktype=stagedRow.locktype;
400 
401  switch (stagedRow.cmd)
402  {
403  case NOCOMMAND:
404  returnRow.rowid=stagedRow.originalrowid;
405  returnRow.row=stagedRow.originalRow;
406  break;
407 
408  case INSERT:
409  returnRow.rowid=stagedRow.newrowid;
410  returnRow.row=stagedRow.newRow;
411  break;
412 
413  case UPDATE:
414  returnRow.rowid=stagedRow.newrowid;
415  returnRow.row=stagedRow.newRow;
416  break;
417 
418  default:
419  printf("%s %i anomaly %i\n", __FILE__, __LINE__, stagedRow.cmd);
420  returnRow=returnRow_s();
421  }
422 }

Here is the caller graph for this function:

void trimspace ( string &  )

Definition at line 382 of file main.cc.

Referenced by Index::between(), Index::comparison(), Transaction::continueCommitTransaction(), Index::deleteNonuniqueEntry(), Index::deleteUniqueEntry(), Transaction::getengine(), Transaction::getEngineid(), Index::getequal_f(), Index::getnotequal(), Index::getnotin(), Index::insertNonuniqueEntry(), Index::like(), Index::notlike(), Index::replaceNonunique(), Index::replaceUnique(), and SubTransaction::uniqueIndex().

383 {
384  size_t last=input.find_last_not_of(' ');
385 
386  if (last != string::npos)
387  {
388  input.erase(last+1);
389  }
390  else
391  {
392  input.clear();
393  }
394 }

Here is the caller graph for this function:

Variable Documentation

pthread_mutex_t connectionsMutex

Definition at line 41 of file main.cc.

Referenced by Listener::Listener(), main(), and Pg::pgclosesocket().

std::vector<listenertype_e> listenerTypes

Definition at line 45 of file main.cc.

Referenced by Listener::Listener(), and Pg::pgclosesocket().

FILE* logfile

Definition at line 36 of file main.cc.

Referenced by UserSchemaMgr::addcolumn(), TransactionAgent::addcolumn(), Table::addfield(), Statement::andPredicate(), TransactionAgent::badMessageHandler(), Index::between(), TransactionAgent::changepassword(), Index::checkAndLock(), Transaction::checkLock(), Transaction::checkSqlLock(), Index::commitRollback(), SubTransaction::commitRollbackUnlock(), Table::commitRollbackUnlock(), Index::comparison(), Transaction::continueCommitTransaction(), Transaction::continueFetchRows(), Transaction::continueInsertRow(), Pg::continuePgCommitexplicit(), Pg::continuePgCommitimplicit(), Pg::continuePgFunc(), Pg::continuePgRollbackexplicit(), Pg::continuePgRollbackimplicit(), Transaction::continueReplaceRow(), Transaction::continueRollbackTransaction(), Transaction::continueSelectRows(), Transaction::continueSqlInsert(), Transaction::continueSqlPredicate(), Transaction::continueUnlockRow(), Transaction::continueUpdateRow(), TransactionAgent::createdomain(), UserSchemaMgr::createschema(), TransactionAgent::createschema(), UserSchemaMgr::createtable(), TransactionAgent::createtable(), TransactionAgent::createuser(), DeadlockMgr::DeadlockMgr(), debug(), TransactionAgent::deletedomain(), UserSchemaMgr::deleteindex(), TransactionAgent::deleteindex(), Table::deleterow(), UserSchemaMgr::deleteschema(), TransactionAgent::deleteschema(), UserSchemaMgr::deletetable(), TransactionAgent::deletetable(), Index::deleteUniqueEntry(), TransactionAgent::deleteuser(), SubTransaction::drainIndexLockQueue(), Engine::Engine(), Transaction::getengine(), Transaction::getEngineid(), Index::getequal_f(), Index::getnotequal(), Index::getnotin(), Index::getnotnulls(), Table::getrows(), IbGateway::IbGateway(), SubTransaction::indexSearch(), Pg::initcmd(), Listener::Listener(), TransactionAgent::login(), main(), Index::makeindex(), Table::makerow(), Topology::newActor(), Pg::pgclosesocket(), SubTransaction::processTransactionMessage(), Transaction::processTransactionMessage(), Index::regex(), IbGateway::removefds(), Index::replaceUnique(), TransactionAgent::schemaBoilerplate(), Transaction::select(), Table::selectrows(), Message::ser(), MessageSocket::ser(), MessageUserSchema::ser(), MessageDeadlock::ser(), MessageTransaction::ser(), MessageSubtransactionCmd::ser(), MessageCommitRollback::ser(), MessageDispatch::ser(), MessageAckDispatch::ser(), MessageApply::ser(), MessageAckApply::ser(), setprio(), Listener::startsocket(), TopologyMgr::TopologyMgr(), TransactionAgent::TransactionAgent(), Table::unmakerow(), ObGateway::updateRemoteGateways(), Table::updaterow(), and UserSchemaMgr::UserSchemaMgr().

pthread_mutex_t nodeTopologyMutex
std::vector<class MboxProducer *> socketAffinity

Definition at line 44 of file main.cc.

Referenced by Listener::Listener(), and Pg::pgclosesocket().

std::string storedprocprefix

Definition at line 43 of file main.cc.

Referenced by Pg::continueLogin(), and TransactionAgent::newprocedure().

void* zmqcontext

Definition at line 42 of file main.cc.

Referenced by main(), and TopologyMgr::TopologyMgr().

std::string zmqsocket

Definition at line 38 of file main.cc.

Referenced by main(), and TopologyMgr::TopologyMgr().