diff --git a/src/stasis/logger/logEntry.c b/src/stasis/logger/logEntry.c index 5e1912a..316e5ba 100644 --- a/src/stasis/logger/logEntry.c +++ b/src/stasis/logger/logEntry.c @@ -131,7 +131,7 @@ lsn_t sizeofLogEntry(const LogEntry * e) { switch (e->type) { case CLRLOG: { - const LogEntry * contents = getCLRCompensated(e); + const LogEntry * contents = getCLRCompensated((const CLRLogEntry*) e); assert(contents->type != CLRLOG); return sizeof(struct __raw_log_entry) + sizeofLogEntry(contents); } diff --git a/src/stasis/logger/logger2.c b/src/stasis/logger/logger2.c index f6609f4..4b52ed9 100644 --- a/src/stasis/logger/logger2.c +++ b/src/stasis/logger/logger2.c @@ -152,16 +152,20 @@ lsn_t LogCLR(stasis_log_t* log, const LogEntry * old_e) { lsn_t LogDummyCLR(stasis_log_t* log, int xid, lsn_t prevLSN, lsn_t compensatedLSN) { - LogEntry * e; - if(compensatedLSN == -1) { - e = allocUpdateLogEntry(prevLSN, xid, OPERATION_NOOP, - INVALID_PAGE, NULL, 0); - } else { - e = log->read_entry(log, compensatedLSN); - } + const LogEntry * const_e; + LogEntry * e; + if(compensatedLSN == -1) { + const_e = allocUpdateLogEntry(prevLSN, xid, OPERATION_NOOP, + INVALID_PAGE, NULL, 0); + } else { + const_e = log->read_entry(log, compensatedLSN); + } + e = malloc(sizeofLogEntry(const_e)); + memcpy(e, const_e, sizeofLogEntry(const_e)); e->LSN = compensatedLSN; lsn_t ret = LogCLR(log, e); - freeLogEntry(e); + freeLogEntry(const_e); + free(e); return ret; } diff --git a/src/stasis/operations/alloc.c b/src/stasis/operations/alloc.c index 424147b..2a0ad3b 100644 --- a/src/stasis/operations/alloc.c +++ b/src/stasis/operations/alloc.c @@ -4,6 +4,8 @@ #include #include #include + +#include #include //try{ /** diff --git a/src/stasis/recovery2.c b/src/stasis/recovery2.c index f1848e7..4577d44 100644 --- a/src/stasis/recovery2.c +++ b/src/stasis/recovery2.c @@ -203,7 +203,7 @@ static void stasis_recovery_redo(stasis_log_t* log) { // if compensated_lsn == -1, then this clr is closing a nested top // action that was performed during undo. Therefore, we do not // want to undo it again. - const LogEntry * ce = getCLRCompensated(e); + const LogEntry * ce = getCLRCompensated((const CLRLogEntry*)e); if(-1 != ce->LSN) { if(ce->update.page == INVALID_PAGE) { // logical redo of end of NTA; no-op @@ -308,7 +308,7 @@ static void stasis_recovery_undo(stasis_log_t* log, int recovery) { } case CLRLOG: { - const LogEntry * ce = getCLRCompensated(e); + const LogEntry * ce = getCLRCompensated((const CLRLogEntry*) e); if(-1 != ce->LSN) { if(ce->update.page == INVALID_PAGE) { DEBUG("logical clr\n"); diff --git a/stasis/common.h b/stasis/common.h index ee3a90e..fea5e5c 100644 --- a/stasis/common.h +++ b/stasis/common.h @@ -53,18 +53,16 @@ terms specified in this license. * the right thing' and build, even if they do not \#include the * config.h file that all of the Stasis stuff uses. * - * @todo Figure out how to let Stasis users avoid config.h. - * * $Id$ */ //#define NDEBUG 1 -#include "config.h" - #ifndef __stasis_common_h #define __stasis_common_h +#include // for size_t + #ifdef __cplusplus # define BEGIN_C_DECLS extern "C" { # define END_C_DECLS } diff --git a/stasis/logger/logEntry.h b/stasis/logger/logEntry.h index 4bd2f05..a65b85b 100644 --- a/stasis/logger/logEntry.h +++ b/stasis/logger/logEntry.h @@ -130,7 +130,7 @@ const void * getUpdateArgs(const LogEntry * e); /** @return a copy of the log entry that this CLR compensated. */ -static inline const LogEntry * getCLRCompensated(const LogEntry * e) { +static inline const LogEntry * getCLRCompensated(const CLRLogEntry * e) { return (const LogEntry*)( ((const struct __raw_log_entry*)e)+1 );