Added support for computing size of internal log entries.
This commit is contained in:
parent
fd7f4074af
commit
4bd93ee66a
5 changed files with 25 additions and 1 deletions
|
@ -91,6 +91,9 @@ extern int loggerType;
|
|||
int LogInit(int logType);
|
||||
int LogDeinit();
|
||||
void LogForce(lsn_t lsn);
|
||||
/**
|
||||
@param lsn The first lsn that will be available after truncation.
|
||||
*/
|
||||
void LogTruncate(lsn_t lsn);
|
||||
|
||||
/** This function is guaranteed to return the LSN of the most recent
|
||||
|
@ -161,6 +164,11 @@ lsn_t LogCLR(int xid, lsn_t LSN, recordid rid, lsn_t prevLSN);
|
|||
*/
|
||||
void LogEnd (TransactionLog * l);
|
||||
|
||||
/**
|
||||
Needed by sizeofLogEntry
|
||||
*/
|
||||
long LoggerSizeOfInternalLogEntry(const LogEntry * e);
|
||||
|
||||
/**
|
||||
For internal use only... This would be static, but it is called by the test cases.
|
||||
*/
|
||||
|
|
|
@ -123,3 +123,6 @@ LogEntry * readLSNEntry_InMemoryLog(lsn_t lsn) {
|
|||
//printf("lsn: %ld prevlsn: %ld\n", ptr->LSN, ptr->prevLSN);
|
||||
return ret;
|
||||
}
|
||||
long sizeofInternalLogEntry_InMemoryLog(const LogEntry * e) {
|
||||
abort();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ void syncLog_InMemoryLog();
|
|||
int truncateLog_InMemoryLog(lsn_t lsn);
|
||||
lsn_t firstLogEntry_InMemoryLog();
|
||||
void close_InMemoryLog();
|
||||
long sizeofInternalLogEntry_InMemoryLog(const LogEntry * e);
|
||||
LogEntry * readLSNEntry_InMemoryLog(lsn_t lsn);
|
||||
lsn_t nextEntry_InMemoryLog(const LogEntry * e);
|
||||
#endif
|
||||
|
|
|
@ -48,7 +48,7 @@ terms specified in this license.
|
|||
|
||||
#include <assert.h>
|
||||
#include <lladd/operations.h>
|
||||
|
||||
#include <lladd/logger/logger2.h>
|
||||
LogEntry * allocCommonLogEntry(lsn_t prevLSN, int xid, unsigned int type) {
|
||||
LogEntry * ret = malloc(sizeof(struct __raw_log_entry));
|
||||
ret->LSN = -1;
|
||||
|
@ -132,6 +132,8 @@ long sizeofLogEntry(const LogEntry * log) {
|
|||
return sizeof(struct __raw_log_entry) + sizeof(UpdateLogEntry) + log->contents.update.argSize +
|
||||
((operationsTable[log->contents.update.funcID].undo == NO_INVERSE) ? physical_slot_length(log->contents.update.rid.size) : 0) +
|
||||
((operationsTable[log->contents.update.funcID].undo == NO_INVERSE_WHOLE_PAGE) ? PAGE_SIZE : 0) ;
|
||||
case INTERNALLOG:
|
||||
return LoggerSizeOfInternalLogEntry(log);
|
||||
default:
|
||||
return sizeof(struct __raw_log_entry);
|
||||
}
|
||||
|
|
|
@ -61,6 +61,16 @@ terms specified in this license.
|
|||
|
||||
int loggerType = LOG_TO_FILE;
|
||||
|
||||
long LoggerSizeOfInternalLogEntry(const LogEntry * e) {
|
||||
if(loggerType == LOG_TO_FILE) {
|
||||
return sizeofInternalLogEntry_LogWriter(e);
|
||||
} else if (loggerType == LOG_TO_MEMORY) {
|
||||
return sizeofInternalLogEntry_InMemoryLog(e);
|
||||
} else {
|
||||
abort(); // we dont have an appropriate implementation, or weren't initialized...
|
||||
}
|
||||
}
|
||||
|
||||
void LogWrite(LogEntry * e) {
|
||||
if(loggerType == LOG_TO_FILE) {
|
||||
writeLogEntry(e);
|
||||
|
|
Loading…
Reference in a new issue