From e788452b3fc228a63196d71e0371aac601b5f8a1 Mon Sep 17 00:00:00 2001 From: Jung-Sang Ahn Date: Tue, 30 Jan 2024 17:05:58 -0500 Subject: [PATCH] Tolerate invalid seqnum in `LogMgr::getLastSyncedSeqNum` * It can return `INVALID`, if the DB is empty. --- src/log_mgr.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/log_mgr.cc b/src/log_mgr.cc index c785b6d..75c4281 100644 --- a/src/log_mgr.cc +++ b/src/log_mgr.cc @@ -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, " @@ -1851,6 +1855,7 @@ Status LogMgr::getLastSyncedSeqNum(uint64_t& seq_num_out) { li->file->isMemTablePurged() ); assert(0); } +#endif break; }