Skip to content

Commit 7733964

Browse files
committed
Fixup: Use correct timestamps
1 parent 212b439 commit 7733964

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

go/storage/mkvs/db/badger/badger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ func New(cfg *api.Config) (api.NodeDB, error) {
108108
// but not yet compacted. Then the NodeDB is restarted, only this time with pruning disabled.
109109
// Unless setting discard timestamp to the earliest version manually, the data stored for the
110110
// already pruned versions may never be compacted, resulting in redundant disk usage.
111-
if earliest := db.GetEarliestVersion(); earliest > tsMetadata {
112-
db.db.SetDiscardTs(earliest - 1)
111+
if discardTs := versionToTs(db.GetEarliestVersion()) - 1; discardTs > tsMetadata {
112+
db.db.SetDiscardTs(discardTs)
113113
}
114114

115115
return db, nil

go/storage/mkvs/db/pathbadger/pathbadger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ func New(cfg *api.Config) (api.NodeDB, error) {
6565
// but not yet compacted. Then the NodeDB is restarted, only this time with pruning disabled.
6666
// Unless setting discard timestamp to the earliest version manually, the data stored for the
6767
// already pruned versions may never be compacted, resulting in redundant disk usage.
68-
if earliest := db.GetEarliestVersion(); earliest > tsMetadata {
69-
db.db.SetDiscardTs(earliest - 1)
68+
if discardTs := versionToTs(db.GetEarliestVersion()) - 1; discardTs > tsMetadata {
69+
db.db.SetDiscardTs(discardTs)
7070
}
7171

7272
return db, nil

0 commit comments

Comments
 (0)