Fix flush assertion with tsan
Summary: DBImpl's instance variables should only be accessed with mutex held. I moved an assert later to uphold this rule. DBTest.LastWriteBufferDelay test was sporadically failing TSAN because it tried to flush around the same time the db was destroyed, so the variable was accessed simultaneously by two threads. Closes https://github.com/facebook/rocksdb/pull/2471 Differential Revision: D5286857 Pulled By: ajkr fbshipit-source-id: 435abd84efa601f667c254e320b0bb5a434b971f
This commit is contained in:
parent
048446fc74
commit
9467eb6141
@ -1199,7 +1199,6 @@ Status DBImpl::BackgroundFlush(bool* made_progress, JobContext* job_context,
|
|||||||
void DBImpl::BackgroundCallFlush() {
|
void DBImpl::BackgroundCallFlush() {
|
||||||
bool made_progress = false;
|
bool made_progress = false;
|
||||||
JobContext job_context(next_job_id_.fetch_add(1), true);
|
JobContext job_context(next_job_id_.fetch_add(1), true);
|
||||||
assert(bg_flush_scheduled_);
|
|
||||||
|
|
||||||
TEST_SYNC_POINT("DBImpl::BackgroundCallFlush:start");
|
TEST_SYNC_POINT("DBImpl::BackgroundCallFlush:start");
|
||||||
|
|
||||||
@ -1207,6 +1206,7 @@ void DBImpl::BackgroundCallFlush() {
|
|||||||
immutable_db_options_.info_log.get());
|
immutable_db_options_.info_log.get());
|
||||||
{
|
{
|
||||||
InstrumentedMutexLock l(&mutex_);
|
InstrumentedMutexLock l(&mutex_);
|
||||||
|
assert(bg_flush_scheduled_);
|
||||||
num_running_flushes_++;
|
num_running_flushes_++;
|
||||||
|
|
||||||
auto pending_outputs_inserted_elem =
|
auto pending_outputs_inserted_elem =
|
||||||
|
Loading…
Reference in New Issue
Block a user