From 15e4c1d59450ca1539d41438bf9a53a8929ab350 Mon Sep 17 00:00:00 2001 From: 0xbundler <124862913+0xbundler@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:45:09 +0800 Subject: [PATCH] freezer: compatible with pruneancient when restart; --- core/rawdb/freezer.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/rawdb/freezer.go b/core/rawdb/freezer.go index 7fea36c60a..f3e0e739d5 100644 --- a/core/rawdb/freezer.go +++ b/core/rawdb/freezer.go @@ -124,6 +124,13 @@ func NewFreezer(datadir string, namespace string, readonly bool, offset uint64, // Create the tables. for name, disableSnappy := range tables { + // try to recreate idx files when enable prune ancient before + if offset > 0 && readonly { + table, err := newTable(datadir, name, readMeter, writeMeter, sizeGauge, maxTableSize, disableSnappy, false) + if err == nil { + table.Close() + } + } table, err := newTable(datadir, name, readMeter, writeMeter, sizeGauge, maxTableSize, disableSnappy, readonly) if err != nil { for _, table := range freezer.tables {