Skip to content

Fix core dumps triggered by rocksdb compacting when shutdown bk#4706

Open
AnonHxy wants to merge 8 commits intoapache:masterfrom
AnonHxy:fix_rocksdb_compact_coredump
Open

Fix core dumps triggered by rocksdb compacting when shutdown bk#4706
AnonHxy wants to merge 8 commits intoapache:masterfrom
AnonHxy:fix_rocksdb_compact_coredump

Conversation

@AnonHxy
Copy link
Contributor

@AnonHxy AnonHxy commented Jan 20, 2026

Descriptions of the changes in this PR:

Fix #4705

Motivation

Fix #4705

Changes

1.Setting the compacting flag of entryLocationIndex as true when shutdown LedgerStorage to stopping the subsequent compact.
2. When LedgerStorage shutdown we will wait unit the compact end.

@AnonHxy AnonHxy force-pushed the fix_rocksdb_compact_coredump branch from 560ace4 to bc91be9 Compare January 20, 2026 16:09
@AnonHxy AnonHxy force-pushed the fix_rocksdb_compact_coredump branch from ecaea19 to 7018ea1 Compare January 22, 2026 01:18
@AnonHxy AnonHxy force-pushed the fix_rocksdb_compact_coredump branch from 1556a35 to abee9aa Compare January 22, 2026 05:01
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lhotari lhotari added this to the 4.18.0 milestone Mar 5, 2026
@lhotari lhotari requested a review from merlimat March 5, 2026 21:52
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a need to do some changes in KeyValueStorageRocksDB class too.
Usually RocksDB triggers compaction on it's own without explicit compaction and that type of compaction would continue to cause problems.

Claude suggested this type of pattern:

try {
    // Signal compactions to stop
    db.cancelAllBackgroundWork(true);
} catch (RocksDBException e) {
    // log but continue — we still want to close
} finally {
    // Always close column family handles first, then the DB
    for (ColumnFamilyHandle cfh : columnFamilyHandles) {
        cfh.close();
    }
    db.close();
}

It might be sufficient to simply have this logic in KeyValueStorageRocksDB.close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Core dumps are triggered by rocksdb compacting when shutdown the bookkeeper

4 participants