diff --git a/src/stasis/logger/logEntry.c b/src/stasis/logger/logEntry.c index 4eb50f0..355c1a1 100644 --- a/src/stasis/logger/logEntry.c +++ b/src/stasis/logger/logEntry.c @@ -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 + diff --git a/src/stasis/logger/logger2.c b/src/stasis/logger/logger2.c index 714f362..324f892 100644 --- a/src/stasis/logger/logger2.c +++ b/src/stasis/logger/logger2.c @@ -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); diff --git a/src/stasis/recovery2.c b/src/stasis/recovery2.c index 28ae124..70ff6ae 100644 --- a/src/stasis/recovery2.c +++ b/src/stasis/recovery2.c @@ -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; diff --git a/src/stasis/transactional2.c b/src/stasis/transactional2.c index 00b247f..2b85f59 100644 --- a/src/stasis/transactional2.c +++ b/src/stasis/transactional2.c @@ -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); } diff --git a/stasis/constants.h b/stasis/constants.h index 4a39368..2d21db3 100644 --- a/stasis/constants.h +++ b/stasis/constants.h @@ -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. diff --git a/stasis/logger/logEntry.h b/stasis/logger/logEntry.h index 3e06f2f..b77290b 100644 --- a/stasis/logger/logEntry.h +++ b/stasis/logger/logEntry.h @@ -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 diff --git a/stasis/logger/logger2.h b/stasis/logger/logger2.h index 2616a7c..504296b 100644 --- a/stasis/logger/logger2.h +++ b/stasis/logger/logger2.h @@ -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 diff --git a/stasis/transactional.h b/stasis/transactional.h index 0c678ff..ad4bc9d 100644 --- a/stasis/transactional.h +++ b/stasis/transactional.h @@ -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. *