Commit 8771ff74 authored by Dave Wells's avatar Dave Wells Committed by Yoni Fogel

fix maxlsn initialization if an empty logfile is encountered [t:1995]

git-svn-id: file:///svn/toku/tokudb@14611 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1fa17cab
......@@ -72,6 +72,7 @@ int toku_logfilemgr_init(TOKULOGFILEMGR lfm, const char *log_dir) {
TOKULOGFILEINFO lf_info;
long long index = -1;
char *basename;
LSN tmp_lsn = {0};
for(int i=0;i<n_logfiles;i++){
lf_info = toku_malloc(sizeof(struct toku_logfile_info));
if ( lf_info == NULL ) {
......@@ -89,9 +90,10 @@ int toku_logfilemgr_init(TOKULOGFILEMGR lfm, const char *log_dir) {
r = toku_logcursor_last(cursor, &entry);
if ( r == 0 ) {
lf_info->maxlsn = toku_log_entry_get_lsn(entry);
tmp_lsn = lf_info->maxlsn;
}
else {
lf_info->maxlsn.lsn = 0;
lf_info->maxlsn = tmp_lsn; // handle empty logfile (no LSN in file) case
}
// add to logfilemgr
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment