File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -695,7 +695,8 @@ func (db *DB) loadIndexFromWAL() error {
695695
696696 // if we get the end of a batch,
697697 // all records in this batch are ready to be indexed.
698- if record .Type == LogRecordBatchFinished {
698+ switch record .Type {
699+ case LogRecordBatchFinished :
699700 batchId , err := snowflake .ParseBytes (record .Key )
700701 if err != nil {
701702 return err
@@ -710,12 +711,18 @@ func (db *DB) loadIndexFromWAL() error {
710711 }
711712 // delete indexRecords according to batchId after indexing
712713 delete (indexRecords , uint64 (batchId ))
713- } else if record .Type == LogRecordNormal && record .BatchId == mergeFinishedBatchID {
714+
715+ case LogRecordNormal :
714716 // if the record is a normal record and the batch id is 0,
715717 // it means that the record is involved in the merge operation.
716718 // so put the record into index directly.
717- db .index .Put (record .Key , position )
718- } else {
719+ if record .BatchId == mergeFinishedBatchID {
720+ db .index .Put (record .Key , position )
721+ break
722+ }
723+ fallthrough
724+
725+ default :
719726 // expired records should not be indexed
720727 if record .IsExpired (now ) {
721728 db .index .Delete (record .Key )
You can’t perform that action at this time.
0 commit comments