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
pull/19244/head
Martin Holst Swende 6 years ago committed by Péter Szilágyi
parent 331de17e4d
commit 42c746d6f4
No known key found for this signature in database
GPG Key ID: E9AE538CEDF8293D
  1. 4
      core/rawdb/freezer.go
  2. 6
      core/rawdb/freezer_table.go
  3. 10
      core/rawdb/schema.go

@ -89,8 +89,8 @@ func newFreezer(datadir string, namespace string) (*freezer, error) {
tables: make(map[string]*freezerTable),
instanceLock: lock,
}
for _, name := range []string{freezerHashTable, freezerHeaderTable, freezerBodiesTable, freezerReceiptTable, freezerDifficultyTable} {
table, err := newTable(datadir, name, readMeter, writeMeter)
for name, disableSnappy := range freezerNoSnappy {
table, err := newTable(datadir, name, readMeter, writeMeter, disableSnappy)
if err != nil {
for _, table := range freezer.tables {
table.Close()

@ -97,9 +97,9 @@ type freezerTable struct {
lock sync.RWMutex // Mutex protecting the data file descriptors
}
// newTable opens a freezer table with default settings - 2G files and snappy compression
func newTable(path string, name string, readMeter metrics.Meter, writeMeter metrics.Meter) (*freezerTable, error) {
return newCustomTable(path, name, readMeter, writeMeter, 2*1000*1000*1000, false)
// newTable opens a freezer table with default settings - 2G files
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, disableSnappy)
}
// newCustomTable opens a freezer table, creating the data and index files if they are

@ -80,6 +80,16 @@ const (
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
// fields.
type LegacyTxLookupEntry struct {

Loading…
Cancel
Save