speedb-io / speedb

A RocksDB compliant high performance scalable embedded key-value store
https://www.speedb.io/
Apache License 2.0
882 stars 65 forks source link

Rebase to 8.6.7. Fixes: Flushing memtable restarts without abort notification #766

Open udi-speedb opened 9 months ago

udi-speedb commented 9 months ago

As part of the rebase on RocksDB 8.6.7, the following commit: 8c2e91aca - Patch 8.6.6 (#11886)

Fixed a bug. Consequently, the following 2 new unit tests from db_flush_test.cc that were written to test the bug now fail:

  1. DBFlushTest.AbortNonAtomicFlushWhenBGError
  2. DBFlushTest.NonAtomicFlushRollbackPendingFlushes

The reason seems to be that, as part of the fix, a memtable starts flushing twice, causing an assertion in AllocTracker: db_flush_test: memtable/alloc_tracker.cc:62: void rocksdb::AllocTracker::FreeMemStarted(): Assertion 'state_ == State::kDoneAllocating' failed.

After adding debug prints in alloc_tracker.cc, we may see the following (the pointer on the left is the address of the AllocTracker object):

[0x555efaaaa080] - AllocTracker::FreeMemStarted, Start - state=1
[0x555efaaaa080] - AllocTracker::FreeMemStarted, End - state=2
[0x555efaaab080] - AllocTracker::FreeMemStarted, Start - state=2
[0x555efaaab080] - AllocTracker::FreeMemStarted, ERROR - state=2

This needs further investigation. Options: