1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 ***************************************************************************/
40 InsertHashIndexOperation
= 3,
41 UpdateHashIndexOperation
= 4,
42 DeleteHashIndexOperation
= 5
48 OperationType opType_
;
52 printf("<UndoLogInfo>\n");
53 printf(" <Size> %d </Size>\n", size_
);
54 printf(" <OperationType> %d </OperationType>\n", opType_
);
55 printf(" <TuplePtr> %x </TuplePtr>\n", ptrToTuple_
);
56 printf("</UndoLogInfo>\n");
66 IsolationLevel isoLevel_
;
68 TransHasNode
*hasLockList_
;
70 UndoLogInfo
*firstUndoLog_
;
72 LockHashNode
*waitLock_
;
74 DbRetVal
releaseAllLocks(LockManager
*lockManager_
);
76 void updateWaitLock(LockHashNode
*node
) { waitLock_
= node
; }
77 void removeWaitLock() { waitLock_
= NULL
; }
78 DbRetVal
insertIntoHasList(Database
*sysdb
, LockHashNode
*node
);
79 DbRetVal
removeFromHasList(Database
*sysdb
, void *tuple
);
80 bool findInHasList(Database
*sysdb
, LockHashNode
*node
);
82 DbRetVal
appendUndoLog(Database
*sysdb
, OperationType type
, void *data
, size_t size
);
83 DbRetVal
appendLogicalUndoLog(Database
*sysdb
, OperationType type
, void *data
,
84 size_t size
, void* indexPtr
);
85 UndoLogInfo
* createUndoLog(Database
*sysdb
, OperationType type
, void *data
,
87 void addAtBegin(UndoLogInfo
* logInfo
);
89 UndoLogInfo
* popUndoLog();
90 DbRetVal
removeUndoLogs(Database
*sysdb
);
91 DbRetVal
applyUndoLogs(Database
*sysdb
);
93 void printDebugInfo(Database
*sysdb
);
96 class TransactionManager
99 TransactionManager() { }
100 ~TransactionManager() {}
101 //Transaction *trans;
103 Transaction
*firstTrans
;
105 void setFirstTrans(Transaction
*trans
);
106 void printUsageStatistics();
107 void printDebugInfo(Database
*sysdb
);
109 DbRetVal
startTransaction(LockManager
*lManager
, IsolationLevel level
);
110 DbRetVal
commit(LockManager
*lManager
);
111 DbRetVal
rollback(LockManager
*lManager
, Transaction
*t
=NULL
);