mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 23:57:23 +00:00
This PR changes the database access of the base part of filter rows that are stored in groups of 32 adjacent maps for improved database storage size and data access efficiency. Before this grouped storage was introduced, filter rows were not cached because the access pattern of either the index rendering or the search does not really benefit from caching. Also no mutex was necessary for filter row access. Storing adjacent rows in groups complicated the situation as a search typically required reading all or most of adjacent rows of a group, so in order to implement the single row read operation without having to read the entire group up to 32 times, a cache for the base row groups was added. This also introduced data race issues for concurrenct read/write in the same group which was avoided by locking the `indexLock` mutex. Unfortunately this also led to slowed down or temporarily blocked search operations when indexing was in progress. This PR returns to the original concept of uncached, no-mutex filter map access by increasing read efficiency in a better way; similiarly to write operations that already operate on groups of filter maps, now `getFilterMapRow` is also replaced by `getFilterMapRows` that accepts a single `rowIndex` and a list of `mapIndices`. It slightly complicates `singleMatcherInstance.getMatchesForLayer` which now has to collect groups of map indices accessed in the same row, but in exchange it guarantees maximum read efficiency while avoiding read/write mutex interference. Note: a follow-up refactoring is WIP that further changes the database access scheme by prodiving an immutable index view to the matcher, makes the whole indexer more straightforward with no callbacks, and entirely removes the concept of matcher syncing with `validBlocks` and the resulting multiple retry logic in `eth/filters/filter.go`. This might take a bit longer to finish though and in the meantime this change could hopefully already solve the blocked request issues. |
||
|---|---|---|
| .. | ||
| filtermaps | ||
| forkid | ||
| history | ||
| rawdb | ||
| state | ||
| stateless | ||
| tracing | ||
| txpool | ||
| types | ||
| vm | ||
| .gitignore | ||
| bench_test.go | ||
| block_validator.go | ||
| block_validator_test.go | ||
| blockchain.go | ||
| blockchain_insert.go | ||
| blockchain_reader.go | ||
| blockchain_repair_test.go | ||
| blockchain_sethead_test.go | ||
| blockchain_snapshot_test.go | ||
| blockchain_test.go | ||
| chain_makers.go | ||
| chain_makers_test.go | ||
| dao_test.go | ||
| error.go | ||
| events.go | ||
| evm.go | ||
| gaspool.go | ||
| gen_genesis.go | ||
| genesis.go | ||
| genesis_alloc.go | ||
| genesis_test.go | ||
| headerchain.go | ||
| headerchain_test.go | ||
| mkalloc.go | ||
| rlp_test.go | ||
| sender_cacher.go | ||
| state_prefetcher.go | ||
| state_processor.go | ||
| state_processor_test.go | ||
| state_transition.go | ||
| stateless.go | ||
| txindexer.go | ||
| txindexer_test.go | ||
| types.go | ||
| verkle_witness_test.go | ||