Skip to content

Commit

Permalink
Tolerate invalid seqnum in LogMgr::getLastSyncedSeqNum (#164)
Browse files Browse the repository at this point in the history
* It can return `INVALID`, if the DB is empty.
  • Loading branch information
greensky00 committed Jan 30, 2024
1 parent 05836d2 commit 31c8daa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/log_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1841,6 +1841,10 @@ Status LogMgr::getLastSyncedSeqNum(uint64_t& seq_num_out) {
LogFileInfoGuard li(mani->getLogFileInfoP(ln_sync, true));
if (li.empty() || li.ptr->isRemoved()) continue;
sync_seq = li->file->getSyncedSeqNum();

// NOTE: `sync_seq` can be INVALID, if the DB does not contain any data.
// It is not a bug.
#if 0
if (!valid_number(sync_seq)) {
// This should be a bug.
_log_err( myLog, "log file %zu returned invalid seq number, "
Expand All @@ -1851,6 +1855,7 @@ Status LogMgr::getLastSyncedSeqNum(uint64_t& seq_num_out) {
li->file->isMemTablePurged() );
assert(0);
}
#endif
break;
}

Expand Down

0 comments on commit 31c8daa

Please sign in to comment.