An asynchronous commit splits SaveVersion into steps:
(1) mutating the staged tree in memory with a sequence of sets/deletes then calculates the root hash
(2) flushes leaf nodes and (in the case of a checkpoint) branch nodes to disk
(1) is performed synchronously with state machine execution, then (2) is performed in a background thread after returning control to the state machine. The next SaveVersion call to (2) blocks on the completion of the prior (2).
This logic was implemented in earlier version of iavl/v2
|
func (w *sqlWriter) saveTree(tree *Tree) error { |
But removed from nightly builds during the pruning refactor. Implementing this feature should save quite a bit of wall clock time, particularly during checkpoints, but the effects should be benchmarked.
An asynchronous commit splits
SaveVersioninto steps:(1) mutating the staged tree in memory with a sequence of sets/deletes then calculates the root hash
(2) flushes leaf nodes and (in the case of a checkpoint) branch nodes to disk
(1) is performed synchronously with state machine execution, then (2) is performed in a background thread after returning control to the state machine. The next
SaveVersioncall to (2) blocks on the completion of the prior (2).This logic was implemented in earlier version of iavl/v2
iavl/sqlite_writer.go
Line 485 in 9185b04
But removed from nightly builds during the pruning refactor. Implementing this feature should save quite a bit of wall clock time, particularly during checkpoints, but the effects should be benchmarked.