removed deferred operation stubs

This commit is contained in:
Sears Russell 2008-09-12 23:08:41 +00:00
parent 75419290c4
commit fb4e91debe
8 changed files with 16 additions and 94 deletions

View file

@ -59,8 +59,7 @@ LogEntry * allocCommonLogEntry(lsn_t prevLSN, int xid, unsigned int type) {
}
const byte * getUpdateArgs(const LogEntry * ret) {
assert(ret->type == UPDATELOG ||
ret->type == DEFERLOG ||
assert(ret->type == UPDATELOG ||
ret->type == CLRLOG);
if(ret->update.argSize == 0) {
return NULL;
@ -72,8 +71,7 @@ const byte * getUpdateArgs(const LogEntry * ret) {
}
const byte * getUpdatePreImage(const LogEntry * ret) {
assert(ret->type == UPDATELOG ||
ret->type == DEFERLOG ||
assert(ret->type == UPDATELOG ||
ret->type == CLRLOG);
if(operationsTable[ret->update.funcID].undo != NO_INVERSE &&
operationsTable[ret->update.funcID].undo != NO_INVERSE_WHOLE_PAGE) {
@ -129,15 +127,6 @@ LogEntry * allocUpdateLogEntry(lsn_t prevLSN, int xid,
return ret;
}
LogEntry * allocDeferredLogEntry(lsn_t prevLSN, int xid,
unsigned int funcID, recordid rid,
const byte * args, unsigned int argSize,
const byte * preImage) {
LogEntry * ret = allocUpdateLogEntry(prevLSN, xid, funcID, rid,
args, argSize, preImage);
ret->type = DEFERLOG;
return ret;
}
LogEntry * allocCLRLogEntry(const LogEntry * old_e) {
// Could handle other types, but we should never encounter them here.
@ -160,7 +149,7 @@ long sizeofLogEntry(const LogEntry * log) {
switch (log->type) {
case CLRLOG:
case UPDATELOG:
case DEFERLOG: {
{
int undoType = operationsTable[log->update.funcID].undo;
return sizeof(struct __raw_log_entry) +
sizeof(UpdateLogEntry) + log->update.argSize +

View file

@ -298,8 +298,8 @@ lsn_t LogTransAbort(TransactionLog * l) {
here? Shouldn't it be in logEntry.c, or perhaps with other code
that reasons about the various operation types?
*/
static LogEntry * LogAction(TransactionLog * l, Page * p, recordid rid, int operation,
const byte * args, int deferred) {
LogEntry * LogUpdate(TransactionLog * l, Page * p, recordid rid, int operation,
const byte * args) {
void * preImage = NULL;
long argSize = 0;
LogEntry * e;
@ -326,14 +326,9 @@ static LogEntry * LogAction(TransactionLog * l, Page * p, recordid rid, int oper
DEBUG("No pre-image");
}
if(!deferred) {
e = allocUpdateLogEntry(l->prevLSN, l->xid, operation, rid, args, argSize,
preImage);
} else {
e = allocDeferredLogEntry(l->prevLSN, l->xid, operation, rid, args, argSize,
preImage);
}
e = allocUpdateLogEntry(l->prevLSN, l->xid, operation, rid, args, argSize,
preImage);
LogWrite(e);
DEBUG("Log Update %d, LSN: %ld type: %ld (prevLSN %ld) (argSize %ld)\n", e->xid,
(long int)e->LSN, (long int)e->type, (long int)e->prevLSN, (long int) argSize);
@ -346,15 +341,6 @@ static LogEntry * LogAction(TransactionLog * l, Page * p, recordid rid, int oper
return e;
}
LogEntry * LogUpdate(TransactionLog * l, Page * p, recordid rid, int operation,
const byte * args) {
return LogAction(l, p, rid, operation, args, 0); // 0 -> not deferred
}
LogEntry * LogDeferred(TransactionLog * l, Page * p, recordid rid, int operation,
const byte * args) {
return LogAction(l, p, rid, operation, args, 1); // 1 -> deferred
}
lsn_t LogCLR(const LogEntry * old_e) {
LogEntry * e = allocCLRLogEntry(old_e);
LogWrite(e);

View file

@ -171,10 +171,6 @@ static void Redo() {
redoUpdate(e);
FreeLogEntry(e);
} break;
case DEFERLOG:
{
// XXX deferred_push(e);
} break;
case XCOMMIT:
{
if(globalLockManager.commit)
@ -249,11 +245,6 @@ static void Undo(int recovery) {
break;
}
case DEFERLOG:
// The transaction is aborting, so it never committed. Therefore
// actions deferred to commit have never been applied; ignore this
// log entry.
break;
case CLRLOG:
// Don't undo CLRs; they were undone during Redo
break;

View file

@ -263,7 +263,7 @@ int Tbegin() {
static compensated_function void TactionHelper(int xid, recordid rid,
const void * dat, int op,
Page * p, int deferred) {
Page * p) {
LogEntry * e;
assert(xid >= 0);
try {
@ -271,20 +271,12 @@ static compensated_function void TactionHelper(int xid, recordid rid,
globalLockManager.writeLockPage(xid, rid.page);
}
} end;
if(! deferred) {
e = LogUpdate(&XactionTable[xid % MAX_TRANSACTIONS], p, rid, op, dat);
assert(XactionTable[xid % MAX_TRANSACTIONS].prevLSN == e->LSN);
DEBUG("Tupdate() e->LSN: %ld\n", e->LSN);
doUpdate(e, p);
FreeLogEntry(e);
} else {
e = LogDeferred(&XactionTable[xid % MAX_TRANSACTIONS], p, rid, op, dat);
assert(XactionTable[xid % MAX_TRANSACTIONS].prevLSN == e->LSN);
DEBUG("Deferring e->LSN: %ld\n", e->LSN);
// XXX update XactionTable...
//XXX deferred_push(e);
}
e = LogUpdate(&XactionTable[xid % MAX_TRANSACTIONS], p, rid, op, dat);
assert(XactionTable[xid % MAX_TRANSACTIONS].prevLSN == e->LSN);
DEBUG("Tupdate() e->LSN: %ld\n", e->LSN);
doUpdate(e, p);
FreeLogEntry(e);
}
@ -292,7 +284,7 @@ compensated_function void TupdateRaw(int xid, recordid rid,
const void * dat, int op) {
assert(xid >= 0);
Page * p = loadPage(xid, rid.page);
TactionHelper(xid, rid, dat, op, p, 0); // 0 -> not deferred
TactionHelper(xid, rid, dat, op, p);
releasePage(p);
}
@ -311,20 +303,7 @@ compensated_function void Tupdate(int xid, recordid rid,
p = loadPage(xid, rid.page);
}
TactionHelper(xid, rid, dat, op, p, 0); // 0 -> not deferred
releasePage(p);
}
compensated_function void Tdefer(int xid, recordid rid,
const void * dat, int op) {
Page * p = loadPage(xid, rid.page);
recordid newrid = stasis_record_dereference(xid, p, rid);
// Caller cannot rely on late or early binding of rid.
assert(rid.page == newrid.page &&
rid.slot == newrid.slot &&
rid.size == newrid.size);
TactionHelper(xid, rid, dat, op, p, 1); // 1 -> deferred.
TactionHelper(xid, rid, dat, op, p);
releasePage(p);
}

View file

@ -212,7 +212,6 @@ extern const short SLOT_TYPE_LENGTHS[];
#define XCOMMIT 2
#define XABORT 3
#define UPDATELOG 4
#define DEFERLOG 5
/**
XEND is used for after the pages touched by a transaction have
been flushed to stable storage.

View file

@ -101,18 +101,6 @@ LogEntry * allocUpdateLogEntry(lsn_t prevLSN, int xid,
unsigned int operation, recordid rid,
const byte * args, unsigned int argSize,
const byte * preImage);
/**
Alloc a deferred log entry. This is just like allocUpdateLogEntry(), except
the log entry's type will be DEFERLOG instead UPDATELOG. This is usually
called inside of Tdefer().
@return a LogEntry that should be freed with free().
*/
LogEntry * allocDeferredLogEntry(lsn_t prevLSN, int xid,
unsigned int operation, recordid rid,
const byte * args, unsigned int argSize,
const byte * preImage);
/**
Allocate a CLR entry. These are written during recovery as log
entries are undone. This moves undo operations into the redo

View file

@ -152,14 +152,6 @@ lsn_t LogTransAbort(TransactionLog * l);
*/
LogEntry * LogUpdate(TransactionLog * l, Page * p, recordid rid, int operation,
const byte * args);
/**
LogDeferred writes a DEFERLOG log record to the log tail
@see LogUpdate is analagous to this function, but wrutes UPDATELOG entries
instead.
*/
LogEntry * LogDeferred(TransactionLog * l, Page * p, recordid rid,
int operation, const byte * args);
/**
Any LogEntry that is returned by a function in logger2.h or

View file

@ -628,8 +628,6 @@ compensated_function void TupdateStr(int xid, recordid rid,
const char *dat, int op);
compensated_function void TupdateRaw(int xid, recordid rid,
const void *dat, int op);
compensated_function void TupdateDeferred(int xid, recordid rid,
const void *dat, int op);
/**
* Read the value of a record.
*