@@ -50,10 +50,25 @@ var chainFreezerNoSnappy = map[string]bool{
50
50
ChainFreezerDifficultyTable : true ,
51
51
}
52
52
53
- const (
54
- // stateHistoryTableSize defines the maximum size of freezer data files.
55
- stateHistoryTableSize = 2 * 1000 * 1000 * 1000
53
+ // chainFreezerSize configures the maximum size for each freezer table data files.
54
+ var chainFreezerSize = map [string ]uint32 {
55
+ // The size of each item's value is roughly 650 bytes, about 2 millions
56
+ // items per data file.
57
+ ChainFreezerHeaderTable : 2 * 1000 * 1000 * 1000 ,
58
+
59
+ // The size of each item’s value is fixed at 32 bytes, 2 millions items
60
+ // per data file.
61
+ ChainFreezerHashTable : 64 * 1000 * 1000 ,
62
+
63
+ // The size of each item’s value is less than 10 bytes, 2 millions items
64
+ // per data file.
65
+ ChainFreezerDifficultyTable : 20 * 1000 * 1000 ,
66
+
67
+ ChainFreezerBodiesTable : 2 * 1000 * 1000 * 1000 ,
68
+ ChainFreezerReceiptTable : 2 * 1000 * 1000 * 1000 ,
69
+ }
56
70
71
+ const (
57
72
// stateHistoryAccountIndex indicates the name of the freezer state history table.
58
73
stateHistoryMeta = "history.meta"
59
74
stateHistoryAccountIndex = "account.index"
@@ -62,6 +77,7 @@ const (
62
77
stateHistoryStorageData = "storage.data"
63
78
)
64
79
80
+ // stateFreezerNoSnappy configures whether compression is disabled for the state freezer.
65
81
var stateFreezerNoSnappy = map [string ]bool {
66
82
stateHistoryMeta : true ,
67
83
stateHistoryAccountIndex : false ,
@@ -70,6 +86,17 @@ var stateFreezerNoSnappy = map[string]bool{
70
86
stateHistoryStorageData : false ,
71
87
}
72
88
89
+ // stateFreezerSize configures the maximum size for each freezer table data files.
90
+ var stateFreezerSize = map [string ]uint32 {
91
+ // The size of each item's value is fixed at 73 bytes, about 2 millions
92
+ // items per data file.
93
+ stateHistoryMeta : 128 * 1000 * 1000 ,
94
+ stateHistoryAccountIndex : 2 * 1000 * 1000 * 1000 ,
95
+ stateHistoryStorageIndex : 2 * 1000 * 1000 * 1000 ,
96
+ stateHistoryAccountData : 2 * 1000 * 1000 * 1000 ,
97
+ stateHistoryStorageData : 2 * 1000 * 1000 * 1000 ,
98
+ }
99
+
73
100
// The list of identifiers of ancient stores.
74
101
var (
75
102
ChainFreezerName = "chain" // the folder name of chain segment ancient store.
@@ -96,5 +123,5 @@ func NewStateFreezer(ancientDir string, verkle bool, readOnly bool) (ethdb.Reset
96
123
} else {
97
124
name = filepath .Join (ancientDir , MerkleStateFreezerName )
98
125
}
99
- return newResettableFreezer (name , "eth/db/state" , readOnly , stateHistoryTableSize , stateFreezerNoSnappy )
126
+ return newResettableFreezer (name , "eth/db/state" , readOnly , stateFreezerSize , stateFreezerNoSnappy )
100
127
}
0 commit comments