freezer: disable compression on hashes and difficulties (#14)
* freezer: disable compression on hashes and difficulties * core/rawdb: address review concerns * core/rawdb: address review concerns
This commit is contained in:
parent
331de17e4d
commit
42c746d6f4
|
@ -89,8 +89,8 @@ func newFreezer(datadir string, namespace string) (*freezer, error) {
|
||||||
tables: make(map[string]*freezerTable),
|
tables: make(map[string]*freezerTable),
|
||||||
instanceLock: lock,
|
instanceLock: lock,
|
||||||
}
|
}
|
||||||
for _, name := range []string{freezerHashTable, freezerHeaderTable, freezerBodiesTable, freezerReceiptTable, freezerDifficultyTable} {
|
for name, disableSnappy := range freezerNoSnappy {
|
||||||
table, err := newTable(datadir, name, readMeter, writeMeter)
|
table, err := newTable(datadir, name, readMeter, writeMeter, disableSnappy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
for _, table := range freezer.tables {
|
for _, table := range freezer.tables {
|
||||||
table.Close()
|
table.Close()
|
||||||
|
|
|
@ -97,9 +97,9 @@ type freezerTable struct {
|
||||||
lock sync.RWMutex // Mutex protecting the data file descriptors
|
lock sync.RWMutex // Mutex protecting the data file descriptors
|
||||||
}
|
}
|
||||||
|
|
||||||
// newTable opens a freezer table with default settings - 2G files and snappy compression
|
// newTable opens a freezer table with default settings - 2G files
|
||||||
func newTable(path string, name string, readMeter metrics.Meter, writeMeter metrics.Meter) (*freezerTable, error) {
|
func newTable(path string, name string, readMeter metrics.Meter, writeMeter metrics.Meter, disableSnappy bool) (*freezerTable, error) {
|
||||||
return newCustomTable(path, name, readMeter, writeMeter, 2*1000*1000*1000, false)
|
return newCustomTable(path, name, readMeter, writeMeter, 2*1000*1000*1000, disableSnappy)
|
||||||
}
|
}
|
||||||
|
|
||||||
// newCustomTable opens a freezer table, creating the data and index files if they are
|
// newCustomTable opens a freezer table, creating the data and index files if they are
|
||||||
|
|
|
@ -80,6 +80,16 @@ const (
|
||||||
freezerDifficultyTable = "diffs"
|
freezerDifficultyTable = "diffs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// freezerNoSnappy configures whether compression is disabled for the ancient-tables.
|
||||||
|
// Hashes and difficulties don't compress well.
|
||||||
|
var freezerNoSnappy = map[string]bool{
|
||||||
|
freezerHeaderTable: false,
|
||||||
|
freezerHashTable: true,
|
||||||
|
freezerBodiesTable: false,
|
||||||
|
freezerReceiptTable: false,
|
||||||
|
freezerDifficultyTable: true,
|
||||||
|
}
|
||||||
|
|
||||||
// LegacyTxLookupEntry is the legacy TxLookupEntry definition with some unnecessary
|
// LegacyTxLookupEntry is the legacy TxLookupEntry definition with some unnecessary
|
||||||
// fields.
|
// fields.
|
||||||
type LegacyTxLookupEntry struct {
|
type LegacyTxLookupEntry struct {
|
||||||
|
|
Loading…
Reference in New Issue