Skip to content

Commit 2dce250

Browse files
bug fix: core/rawdb: apply ancient db offset to the freezer (#1915)
1 parent e936a54 commit 2dce250

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/rawdb/freezer.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ func NewFreezer(datadir string, namespace string, readonly bool, offset uint64,
125125
instanceLock: lock,
126126
}
127127

128+
freezer.offset.Store(offset)
129+
128130
// Create the tables.
129131
for name, config := range tables {
130132
table, err := newTable(datadir, name, readMeter, writeMeter, sizeGauge, maxTableSize, config, readonly)
@@ -154,6 +156,10 @@ func NewFreezer(datadir string, namespace string, readonly bool, offset uint64,
154156
return nil, err
155157
}
156158

159+
// Some blocks in ancientDB may have already been frozen and been pruned, so adding the offset to
160+
// represent the absolute number of blocks already frozen.
161+
freezer.frozen.Add(offset)
162+
157163
// Create the write batch.
158164
freezer.writeBatch = newFreezerBatch(freezer)
159165

0 commit comments

Comments
 (0)