Integrate backend::hooks with consistent_index.

Every transaction committed to backend is writing most recent consistent_index.
Makes sure that even automatically trigger commits of batch-transactions
stays "really" consistent a.d. the most recent WAL log index applied.
This commit is contained in:
Piotr Tabor
2021-04-12 17:28:39 +02:00
parent d53d2db1e2
commit 50051675f9
3 changed files with 33 additions and 13 deletions

View File

@@ -76,6 +76,7 @@ func (ci *consistentIndex) SetConsistentIndex(v uint64) {
func (ci *consistentIndex) UnsafeSave(tx backend.BatchTx) {
index := atomic.LoadUint64(&ci.consistentIndex)
if index == 0 {
// Never save 0 as it means that we didn't loaded the real index yet.
return