filecoin-project / lotus

Reference implementation of the Filecoin protocol, written in Go
https://lotus.filecoin.io/
Other
2.83k stars 1.26k forks source link

introduce Sync() method on blockstores #5057

Open raulk opened 3 years ago

raulk commented 3 years ago

Goal

To reduce the amount of fsyncing by opening the blockstores (lmdb and badger) in "no sync" mode, and introducing explicit fsyncs only when we're effectively committing new state (i.e. writing a new head).

See discussion in https://github.com/filecoin-project/lotus/pull/5050.

Design

  1. Change the blockstore options to enable NoSync mode.
  2. Expand the lotus/lib/blockstore.Blockstore interface to introduce a Sync() method.
  3. Call Sync() from ChainStore#takeHeaviestTipSet, which is when we commit a new head and thus want all previously unflushed chain and state objects to become durable.
jennijuju commented 3 years ago

We should consider revert #6817 if this is implemented