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).
Change the blockstore options to enable NoSync mode.
Expand the lotus/lib/blockstore.Blockstore interface to introduce a Sync() method.
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.
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
NoSync
mode.lotus/lib/blockstore.Blockstore
interface to introduce aSync()
method.Sync()
fromChainStore#takeHeaviestTipSet
, which is when we commit a new head and thus want all previously unflushed chain and state objects to become durable.