facebook / facebook/rocksdb

[BUG] Caught Assertion when CompactFiles races with DeleteFiles

Open
#12,010 1 comment 1 reaction 1 assignee Claimed by @jowlyzhang View on GitHub
user-defined timestamp
Dominant language
C++
Stars
32.1k
Forks
6.9k
Avg merge
32m
Merged PRs (30d)
1

Description

When we attempt to compact sst file 'A', if 'A' was accidentally deleted, an 'Assert Failed' will be triggered.

### Expected behavior
The compact operation will be aborted.

### Actual behavior
An 'Assert Failed' was triggered:
```
[ RUN ] CompactFilesTest.CompactFilesRace
compact_files_test: util/comparator.cc:277: int rocksdb::{anonymous}::ComparatorWithU64TsImpl::CompareWithoutTimestamp(const rocksdb::Slice&, bool, const rocksdb::Slice&, bool) const [with TComparator = rocksdb::{anonymous}::BytewiseComparatorImpl]: Assertion `!a_has_ts || a.size() >= ts_sz' failed.
Received signal 6 (Aborted)
Invoking GDB for stack trace...
```
### Steps to reproduce the behavior
1. Open db with 'ComparatorWithU64TsImpl' ;
2. Create a.sst, b.sst, c.sst, d.sst ;
3. CompactFiles(c.sst, d.sst) and hang before finished, Delete a.sst and b.sst at the meantime ;
4. then CompactFiles(a.sst, b.sst) .
[Link commit](https://github.com/Ruabit18/rocksdb/commit/c8bf924ede3427367f22f999c8554dd857b02e1d)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.