mirror of
https://github.com/taigrr/bitcask
synced 2025-01-18 04:03:17 -08:00
Fixed a bug with incorrect offsets populating the trie (#82)
This commit is contained in:
parent
0338755f8c
commit
50d3971e86
@ -356,6 +356,7 @@ func (b *Bitcask) reopen() error {
|
||||
}
|
||||
} else {
|
||||
for i, df := range datafiles {
|
||||
var offset int64
|
||||
for {
|
||||
e, n, err := df.Read()
|
||||
if err != nil {
|
||||
@ -368,11 +369,13 @@ func (b *Bitcask) reopen() error {
|
||||
// Tombstone value (deleted key)
|
||||
if len(e.Value) == 0 {
|
||||
t.Delete(e.Key)
|
||||
offset += n
|
||||
continue
|
||||
}
|
||||
|
||||
item := internal.Item{FileID: ids[i], Offset: e.Offset, Size: n}
|
||||
item := internal.Item{FileID: ids[i], Offset: offset, Size: n}
|
||||
t.Insert(e.Key, item)
|
||||
offset += n
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user