diff --git a/core/rawdb/ancient_scheme.go b/core/rawdb/ancient_scheme.go index f042ffeefe..1ffebed3e7 100644 --- a/core/rawdb/ancient_scheme.go +++ b/core/rawdb/ancient_scheme.go @@ -37,8 +37,10 @@ const ( ChainFreezerReceiptTable = "receipts" ) -// chainFreezerTableConfigs configures whether compression is disabled for the ancient-tables. -// Hashes and difficulties don't compress well. +// chainFreezerTableConfigs configures the settings for tables in the chain freezer. +// Compression is disabled for hashes as they don't compress well. Additionally, +// tail truncation is disabled for the header and hash tables, as these are intended +// to be retained long-term. var chainFreezerTableConfigs = map[string]freezerTableConfig{ ChainFreezerHeaderTable: {noSnappy: false, prunable: false}, ChainFreezerHashTable: {noSnappy: true, prunable: false}, @@ -46,6 +48,7 @@ var chainFreezerTableConfigs = map[string]freezerTableConfig{ ChainFreezerReceiptTable: {noSnappy: false, prunable: true}, } +// freezerTableConfig contains the settings for a freezer table. type freezerTableConfig struct { noSnappy bool // disables item compression prunable bool // true for tables that can be pruned by TruncateTail @@ -63,7 +66,7 @@ const ( stateHistoryStorageData = "storage.data" ) -// stateFreezerTableConfigs configures whether compression is disabled for the state freezer. +// stateFreezerTableConfigs configures the settings for tables in the state freezer. var stateFreezerTableConfigs = map[string]freezerTableConfig{ stateHistoryMeta: {noSnappy: true, prunable: true}, stateHistoryAccountIndex: {noSnappy: false, prunable: true}, diff --git a/core/rawdb/freezer.go b/core/rawdb/freezer.go index b0d046b1f7..105d3af934 100644 --- a/core/rawdb/freezer.go +++ b/core/rawdb/freezer.go @@ -301,9 +301,8 @@ func (f *Freezer) TruncateHead(items uint64) (uint64, error) { return oitems, nil } -// TruncateTail discards all data below the provided threshold number -// Note this will only truncate 'prunable' tables. Block headers and canonical -// hashes cannot be truncated at this time. +// TruncateTail discards all data below the specified threshold. Note that only +// 'prunable' tables will be truncated. func (f *Freezer) TruncateTail(tail uint64) (uint64, error) { if f.readonly { return 0, errReadOnly diff --git a/ethdb/database.go b/ethdb/database.go index 2b0fe9c307..b1577512f3 100644 --- a/ethdb/database.go +++ b/ethdb/database.go @@ -129,8 +129,7 @@ type AncientWriter interface { // immediately, but only when the accumulated deleted data reach the threshold then // will be removed all together. // - // Note this will only truncate 'prunable' tables. Block headers and canonical - // hashes cannot be truncated at this time. + // Note that data marked as non-prunable will still be retained and remain accessible. TruncateTail(n uint64) (uint64, error) // Sync flushes all in-memory ancient store data to disk.