Skip to content

Commit

Permalink
fix: fix the bug of ttl when restart (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigboss2063 committed Sep 15, 2023
1 parent 51c9f27 commit a1a81e6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,14 +659,15 @@ func (db *DB) getRecordCount() (int64, error) {
func (db *DB) buildBTreeIdx(r *Record) {
db.resetRecordByMode(r)

bucket, key, meta := r.Bucket, r.H.Key, r.H.Meta
b := db.Index.bTree.getWithDefault(bucket)

if r.IsExpired() {
db.tm.del(bucket, string(key))
b.Delete(key)
return
}

bucket, key, meta := r.Bucket, r.H.Key, r.H.Meta

b := db.Index.bTree.getWithDefault(bucket)

if meta.Flag == DataDeleteFlag {
db.tm.del(bucket, string(key))
b.Delete(key)
Expand Down

0 comments on commit a1a81e6

Please sign in to comment.