lotus/chain/store
Hector Sanjuan fa93c23813 Chain ranged export: rework and address current shortcomings
This commit moderately refactors the ranged export code. It addresses several
problems:
  * Code does not finish cleanly and things hang on ctrl-c
  * Same block is read multiple times in a row (artificially increasing cached
    blockstore metrics to 50%)
  * It is unclear whether there are additional races (a single worker quits
    when reaching height 0)
  * CARs produced have duplicated blocks (~400k for an 80M-blocks CAR or
    so). Some blocks appear up to 5 times.
  * Using pointers for tasks where it is not necessary.

The changes:

  * Use a FIFO instead of stack: simpler implementation as its own type. This
has not proven to be much more memory-friendly, but it has not made things
worse either.
  * We avoid a probably not small amount of allocations by not using
    unnecessary pointers.
  * Fix duplicated blocks by atomically checking+adding to CID set.
  * Context-termination now works correctly. Worker lifetime is correctly tracked and all channels
  are closed, avoiding any memory leaks and deadlocks.
  * We ensure all work is finished before finishing, something that might have
  been broken in some edge cases previously. In practice, we would not have
  seen this except perhaps in very early snapshots close to genesis.

Initial testing shows the code is currently about 5% faster. Resulting
snapshots do not have duplicates so they are a bit smaller. We have manually
verified that no CID is lost versus previous results, with both old and recent
snapshots.
2023-02-14 21:08:10 +01:00
..
basefee_test.go feat: support typed errors over RPC 2022-09-27 15:34:01 +00:00
basefee.go chore: fix imports 2022-06-14 17:00:51 +02:00
cache.go First efficient ranged-export implementation by @frisst 2023-02-14 15:41:10 +01:00
checkpoint_test.go fix make gen 2022-08-29 16:25:30 +02:00
coalescer_test.go fix make gen 2022-08-29 16:25:30 +02:00
coalescer.go fix make gen 2022-08-29 16:25:30 +02:00
fts.go chore: fix imports 2022-06-14 17:00:51 +02:00
index_test.go fix make gen 2022-08-29 16:25:30 +02:00
index.go chore: fix imports 2022-06-14 17:00:51 +02:00
messages.go Merge branch 'release/v1.20.0' into asr/merge-release-into-master 2023-02-10 18:39:51 -05:00
snapshot.go Chain ranged export: rework and address current shortcomings 2023-02-14 21:08:10 +01:00
store_test.go Merge branch 'release/v1.20.0' into asr/merge-release-into-master 2023-01-20 17:32:29 -05:00
store.go Merge branch 'release/v1.20.0' into asr/merge-release-into-master 2023-02-03 09:27:04 -05:00