minor log fixes. add stasis_log_chunk_name flag.
This commit is contained in:
parent
aca4365108
commit
1b71865b7d
4 changed files with 16 additions and 8 deletions
|
@ -174,12 +174,18 @@ int stasis_log_softcommit = STASIS_LOG_SOFTCOMMIT;
|
|||
int stasis_log_softcommit = 0;
|
||||
#endif
|
||||
|
||||
#ifdef STASIS_LOG_DIR
|
||||
const char* stasis_log_dir_name = STASIS_LOG_DIR;
|
||||
#ifdef STASIS_LOG_DIR_NAME
|
||||
const char* stasis_log_dir_name = STASIS_LOG_DIR_NAME;
|
||||
#else
|
||||
const char* stasis_log_dir_name = "stasis_log";
|
||||
#endif
|
||||
|
||||
#ifdef STASIS_LOG_CHUNK_NAME
|
||||
const char* stasis_log_chunk_name = STASIS_LOG_CHUNK_NAME;
|
||||
#else
|
||||
const char* stasis_log_chunk_name = "log-chunk-";
|
||||
#endif
|
||||
|
||||
#ifdef STASIS_LOG_FILE_POOL_LSN_CHARS
|
||||
#error 2 ^ 64 is 20 chars in base ten, so there is no reason to redefine STASIS_LOG_FILE_POOL_LSN_CHARS
|
||||
#endif //STASIS_LOG_DIR_LSN_CHARS
|
||||
|
|
|
@ -92,8 +92,8 @@ enum file_type stasis_log_file_pool_file_type(const struct dirent* file, lsn_t *
|
|||
||DT_UNKNOWN == file->d_type)) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
off_t base_len = strlen(stasis_log_dir_name);
|
||||
if(strncmp(name, stasis_log_dir_name, base_len)) {
|
||||
off_t base_len = strlen(stasis_log_chunk_name);
|
||||
if(strncmp(name, stasis_log_chunk_name, base_len)) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
name+=base_len;
|
||||
|
@ -127,13 +127,11 @@ int stasis_log_file_pool_file_filter(const struct dirent* file) {
|
|||
*/
|
||||
char * stasis_log_file_pool_build_filename(stasis_log_file_pool_state * fp,
|
||||
lsn_t start_lsn) {
|
||||
int name_len = strlen(stasis_log_dir_name);
|
||||
int name_len = strlen(stasis_log_chunk_name);
|
||||
char * first = malloc(name_len + stasis_log_file_pool_lsn_chars + 1);
|
||||
strcpy(first, stasis_log_dir_name);
|
||||
strcpy(first, stasis_log_chunk_name);
|
||||
sprintf(first+name_len, "%020lld", start_lsn);
|
||||
printf("Name is %s\n", first);
|
||||
char * full_name = malloc(strlen(fp->dirname) + 1 + strlen(first) + 1);
|
||||
full_name[0] = 0;
|
||||
return first;
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,7 @@ extern char * stasis_store_file_2_name;
|
|||
extern int stasis_buffer_manager_hash_prefetch_count;
|
||||
|
||||
extern const char * stasis_log_dir_name;
|
||||
extern const char * stasis_log_chunk_name;
|
||||
/**
|
||||
Maximum number of log chunks that will be created by file pool.
|
||||
This number is treated as a hint.
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
#include <stasis/common.h>
|
||||
#include <stasis/logger/logger2.h>
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
stasis_log_t* stasis_log_file_pool_open(const char* dirname, int filemode, int fileperm);
|
||||
|
||||
END_C_DECLS
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue