fail fast if Tbegin() called before Tinit()
This commit is contained in:
parent
6f717c351a
commit
0940c59d96
1 changed files with 9 additions and 0 deletions
|
@ -26,6 +26,8 @@ TransactionLog XactionTable[MAX_TRANSACTIONS];
|
||||||
int numActiveXactions = 0;
|
int numActiveXactions = 0;
|
||||||
int xidCount = 0;
|
int xidCount = 0;
|
||||||
|
|
||||||
|
static int initted = 0;
|
||||||
|
|
||||||
const recordid ROOT_RECORD = {1, 0, -1};
|
const recordid ROOT_RECORD = {1, 0, -1};
|
||||||
const recordid NULLRID = {0,0,-1};
|
const recordid NULLRID = {0,0,-1};
|
||||||
const short SLOT_TYPE_LENGTHS[] = { 0, 0, sizeof(blob_record_t), -1};
|
const short SLOT_TYPE_LENGTHS[] = { 0, 0, sizeof(blob_record_t), -1};
|
||||||
|
@ -222,6 +224,7 @@ int Tinit() {
|
||||||
if(stasis_truncation_automatic) {
|
if(stasis_truncation_automatic) {
|
||||||
autoTruncate(); // should this be before InitiateRecovery?
|
autoTruncate(); // should this be before InitiateRecovery?
|
||||||
}
|
}
|
||||||
|
initted = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,6 +234,8 @@ int Tbegin() {
|
||||||
int i, index = 0;
|
int i, index = 0;
|
||||||
int xidCount_tmp;
|
int xidCount_tmp;
|
||||||
|
|
||||||
|
assert(initted);
|
||||||
|
|
||||||
pthread_mutex_lock(&transactional_2_mutex);
|
pthread_mutex_lock(&transactional_2_mutex);
|
||||||
|
|
||||||
if( numActiveXactions == MAX_TRANSACTIONS ) {
|
if( numActiveXactions == MAX_TRANSACTIONS ) {
|
||||||
|
@ -300,6 +305,7 @@ compensated_function void TupdateStr(int xid, pageid_t page,
|
||||||
compensated_function void Tupdate(int xid, pageid_t page,
|
compensated_function void Tupdate(int xid, pageid_t page,
|
||||||
const void *dat, size_t datlen, int op) {
|
const void *dat, size_t datlen, int op) {
|
||||||
Page * p = loadPage(xid, page);
|
Page * p = loadPage(xid, page);
|
||||||
|
assert(initted);
|
||||||
TactionHelper(xid, dat, datlen, op, p);
|
TactionHelper(xid, dat, datlen, op, p);
|
||||||
releasePage(p);
|
releasePage(p);
|
||||||
}
|
}
|
||||||
|
@ -428,6 +434,9 @@ int Tdeinit() {
|
||||||
stasis_page_deinit();
|
stasis_page_deinit();
|
||||||
LogDeinit();
|
LogDeinit();
|
||||||
dirtyPagesDeinit();
|
dirtyPagesDeinit();
|
||||||
|
|
||||||
|
initted = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue