mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
core/rawdb: skip setting flushOffset in read-only mode
This commit is contained in:
parent
8ec4a06b3f
commit
6aba9ceca7
1 changed files with 7 additions and 0 deletions
|
|
@ -405,6 +405,13 @@ func (t *freezerTable) repairIndex() error {
|
||||||
// If legacy metadata is detected, attempt to recover the offset from the
|
// If legacy metadata is detected, attempt to recover the offset from the
|
||||||
// index file to avoid clearing the entire table.
|
// index file to avoid clearing the entire table.
|
||||||
if t.metadata.version == freezerTableV1 {
|
if t.metadata.version == freezerTableV1 {
|
||||||
|
// Skip truncation if the legacy metadata is opened in read-only mode.
|
||||||
|
// Since all items in the legacy index file were forcibly synchronized,
|
||||||
|
// data integrity is guaranteed. Therefore, it's safe to leave any extra
|
||||||
|
// items untruncated in this special scenario.
|
||||||
|
if t.readonly {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
t.logger.Info("Recovering freezer flushOffset for legacy table", "offset", size)
|
t.logger.Info("Recovering freezer flushOffset for legacy table", "offset", size)
|
||||||
return t.metadata.setFlushOffset(size, true)
|
return t.metadata.setFlushOffset(size, true)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue