renamed open/deleteLogWriter
This commit is contained in:
parent
97ab7670db
commit
6f809b00e2
5 changed files with 24 additions and 25 deletions
|
@ -185,7 +185,7 @@ static inline lsn_t nextEntry_LogWriter(stasis_log_t* log,
|
||||||
return nextEntry(e);
|
return nextEntry(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
stasis_log_t* openLogWriter(const char * filename,
|
stasis_log_t* stasis_log_safe_writes_open(const char * filename,
|
||||||
int filemode, int fileperm) {
|
int filemode, int fileperm) {
|
||||||
|
|
||||||
log_filename = strdup(filename);
|
log_filename = strdup(filename);
|
||||||
|
@ -556,7 +556,7 @@ static int close_LogWriter(stasis_log_t* log) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteLogWriter() {
|
void stasis_log_safe_writes_delete(const char* log_filename) {
|
||||||
remove(log_filename);
|
remove(log_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ int Tinit() {
|
||||||
setupOperationsTable();
|
setupOperationsTable();
|
||||||
dirtyPagesInit();
|
dirtyPagesInit();
|
||||||
if(LOG_TO_FILE == loggerType) {
|
if(LOG_TO_FILE == loggerType) {
|
||||||
stasis_log_file = openLogWriter(stasis_log_file_name,
|
stasis_log_file = stasis_log_safe_writes_open(stasis_log_file_name,
|
||||||
stasis_log_file_mode,
|
stasis_log_file_mode,
|
||||||
stasis_log_file_permissions);
|
stasis_log_file_permissions);
|
||||||
} else if(LOG_TO_MEMORY == loggerType) {
|
} else if(LOG_TO_MEMORY == loggerType) {
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#ifndef __LOGWRITER_H__
|
||||||
|
#define __LOGWRITER_H__
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
This software is copyrighted by the Regents of the University of
|
This software is copyrighted by the Regents of the University of
|
||||||
California, and other parties. The following terms apply to all files
|
California, and other parties. The following terms apply to all files
|
||||||
|
@ -67,12 +70,8 @@ terms specified in this license.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LOGWRITER_H__
|
|
||||||
#define __LOGWRITER_H__
|
|
||||||
|
|
||||||
#include <stasis/common.h>
|
#include <stasis/common.h>
|
||||||
#include <stasis/logger/logger2.h>
|
#include <stasis/logger/logger2.h>
|
||||||
#include <stasis/logger/logEntry.h>
|
|
||||||
|
|
||||||
BEGIN_C_DECLS
|
BEGIN_C_DECLS
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +81,7 @@ BEGIN_C_DECLS
|
||||||
|
|
||||||
@return NULL on error
|
@return NULL on error
|
||||||
*/
|
*/
|
||||||
stasis_log_t* openLogWriter(const char * filename,
|
stasis_log_t* stasis_log_safe_writes_open(const char * filename,
|
||||||
int filemode,
|
int filemode,
|
||||||
int fileperm);
|
int fileperm);
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ stasis_log_t* openLogWriter(const char * filename,
|
||||||
@todo This only exists because the tests use it...once the logfile
|
@todo This only exists because the tests use it...once the logfile
|
||||||
name isn't hardcoded, remove this function.
|
name isn't hardcoded, remove this function.
|
||||||
*/
|
*/
|
||||||
void deleteLogWriter();
|
void stasis_log_safe_writes_delete(const char * filename);
|
||||||
|
|
||||||
END_C_DECLS
|
END_C_DECLS
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ static void setup_log() {
|
||||||
int i;
|
int i;
|
||||||
lsn_t prevLSN = -1;
|
lsn_t prevLSN = -1;
|
||||||
int xid = 42;
|
int xid = 42;
|
||||||
deleteLogWriter();
|
stasis_log_safe_writes_delete(stasis_log_file_name);
|
||||||
stasis_truncation_automatic = 0;
|
stasis_truncation_automatic = 0;
|
||||||
Tinit();
|
Tinit();
|
||||||
lsn_t firstLSN = -1;
|
lsn_t firstLSN = -1;
|
||||||
|
@ -154,7 +154,7 @@ START_TEST(loggerTest)
|
||||||
|
|
||||||
assert(i == 3000);
|
assert(i == 3000);
|
||||||
|
|
||||||
deleteLogWriter();
|
stasis_log_safe_writes_delete(stasis_log_file_name);
|
||||||
Tdeinit();
|
Tdeinit();
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
@ -394,7 +394,7 @@ void reopenLogWorkload(int truncating) {
|
||||||
stasis_transaction_table_active_transaction_count_set(0);
|
stasis_transaction_table_active_transaction_count_set(0);
|
||||||
|
|
||||||
if(LOG_TO_FILE == loggerType) {
|
if(LOG_TO_FILE == loggerType) {
|
||||||
stasis_log_file = openLogWriter(stasis_log_file_name,
|
stasis_log_file = stasis_log_safe_writes_open(stasis_log_file_name,
|
||||||
stasis_log_file_mode,
|
stasis_log_file_mode,
|
||||||
stasis_log_file_permissions);
|
stasis_log_file_permissions);
|
||||||
} else if(LOG_TO_MEMORY == loggerType) {
|
} else if(LOG_TO_MEMORY == loggerType) {
|
||||||
|
@ -425,7 +425,7 @@ void reopenLogWorkload(int truncating) {
|
||||||
stasis_log_file->deinit(stasis_log_file);
|
stasis_log_file->deinit(stasis_log_file);
|
||||||
|
|
||||||
if(LOG_TO_FILE == loggerType) {
|
if(LOG_TO_FILE == loggerType) {
|
||||||
stasis_log_file = openLogWriter(stasis_log_file_name,
|
stasis_log_file = stasis_log_safe_writes_open(stasis_log_file_name,
|
||||||
stasis_log_file_mode,
|
stasis_log_file_mode,
|
||||||
stasis_log_file_permissions);
|
stasis_log_file_permissions);
|
||||||
} else if(LOG_TO_MEMORY == loggerType) {
|
} else if(LOG_TO_MEMORY == loggerType) {
|
||||||
|
@ -498,13 +498,13 @@ void reopenLogWorkload(int truncating) {
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(loggerReopenTest) {
|
START_TEST(loggerReopenTest) {
|
||||||
deleteLogWriter();
|
stasis_log_safe_writes_delete(stasis_log_file_name);
|
||||||
reopenLogWorkload(0);
|
reopenLogWorkload(0);
|
||||||
|
|
||||||
} END_TEST
|
} END_TEST
|
||||||
|
|
||||||
START_TEST(loggerTruncateReopenTest) {
|
START_TEST(loggerTruncateReopenTest) {
|
||||||
deleteLogWriter();
|
stasis_log_safe_writes_delete(stasis_log_file_name);
|
||||||
reopenLogWorkload(1);
|
reopenLogWorkload(1);
|
||||||
} END_TEST
|
} END_TEST
|
||||||
|
|
||||||
|
|
|
@ -63,9 +63,9 @@ int main() {
|
||||||
|
|
||||||
setupOperationsTable();
|
setupOperationsTable();
|
||||||
stasis_log_t* log;
|
stasis_log_t* log;
|
||||||
if(NULL == (log = openLogWriter(stasis_log_file_name,
|
if(NULL == (log = stasis_log_safe_writes_open(stasis_log_file_name,
|
||||||
stasis_log_file_mode,
|
stasis_log_file_mode,
|
||||||
stasis_log_file_permissions))) {
|
stasis_log_file_permissions))){
|
||||||
printf("Couldn't open log.\n");
|
printf("Couldn't open log.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue