]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Fix data race on `ColumnFamilyData::flush_reason` by letting FlushRequest/Job owns...
authorHui Xiao <huixiao@fb.com>
Tue, 24 Jan 2023 17:54:04 +0000 (09:54 -0800)
committerAndrew Kryczka <andrewkr@fb.com>
Thu, 2 Feb 2023 00:59:41 +0000 (16:59 -0800)
commitfa13962e0c5e79250eec2c4a68676c10bc8bb8d5
treecb71ebb5fdacf173a47631f1ff7d6794362dca85
parente5dcebf756960989bb5a750dffb94c851f22e7e9
Fix data race on `ColumnFamilyData::flush_reason` by letting FlushRequest/Job owns flush_reason instead of CFD (#11111)

Summary:
**Context:**
Concurrent flushes on the same CF can set on `ColumnFamilyData::flush_reason` before each other flush finishes. An symptom is one CF has different flush_reason with others though all of them are in an atomic flush  `db_stress: db/db_impl/db_impl_compaction_flush.cc:423: rocksdb::Status rocksdb::DBImpl::AtomicFlushMemTablesToOutputFiles(const rocksdb::autovector<rocksdb::DBImpl::BGFlushArg>&, bool*, rocksdb::JobContext*, rocksdb::LogBuffer*, rocksdb::Env::Priority): Assertion cfd->GetFlushReason() == cfds[0]->GetFlushReason() failed. `

**Summary:**
Suggested by ltamasi, we now refactor and let FlushRequest/Job to own flush_reason as there is no good way to define `ColumnFamilyData::flush_reason` in face of concurrent flushes on the same CF (which wasn't the case a long time ago when `ColumnFamilyData::flush_reason ` first introduced`)

**Tets:**
- new unit test
- make check
- aggressive crash test rehearsal

Pull Request resolved: https://github.com/facebook/rocksdb/pull/11111

Reviewed By: ajkr

Differential Revision: D42644600

Pulled By: hx235

fbshipit-source-id: 8589c8184869d3415e5b780c887f877818a5ebaf
HISTORY.md
db/column_family.cc
db/column_family.h
db/db_flush_test.cc
db/db_impl/db_impl.cc
db/db_impl/db_impl.h
db/db_impl/db_impl_compaction_flush.cc
db/db_impl/db_impl_write.cc
db/flush_job.cc
db/flush_job.h
db/flush_job_test.cc