plugeth/ethdb
Martin Holst Swende 794c6133ef
core/rawdb: freezer batch write (#23462)
This change is a rewrite of the freezer code.

When writing ancient chain data to the freezer, the previous version first encoded each
individual item to a temporary buffer, then wrote the buffer. For small item sizes (for
example, in the block hash freezer table), this strategy causes a lot of system calls for
writing tiny chunks of data. It also allocated a lot of temporary []byte buffers.

In the new version, we instead encode multiple items into a re-useable batch buffer, which
is then written to the file all at once. This avoids performing a system call for every
inserted item.

To make the internal batching work, the ancient database API had to be changed. While
integrating this new API in BlockChain.InsertReceiptChain, additional optimizations were
also added there.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-09-07 12:31:17 +02:00
..
dbtest all: simplify and fix database iteration with prefix/start (#20808) 2020-04-15 14:08:53 +03:00
leveldb all: add go:build lines (#23468) 2021-08-25 18:46:29 +02:00
memorydb core, eth, ethdb, trie: simplify range proofs 2021-04-29 10:59:08 +03:00
batch.go core, eth, ethdb, trie: simplify range proofs 2021-04-29 10:59:08 +03:00
database.go core/rawdb: freezer batch write (#23462) 2021-09-07 12:31:17 +02:00
iterator.go all: simplify and fix database iteration with prefix/start (#20808) 2020-04-15 14:08:53 +03:00