Fix data race #2
Summary: We should not be calling InternalStats methods outside of the mutex. Test Plan: COMPILE_WITH_TSAN=1 m db_test && ROCKSDB_TESTS=CompactionTrigger ./db_test failing before the diff, works now Reviewers: yhchiang, rven, sdong Reviewed By: sdong Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D32127
This commit is contained in:
parent
f5a8398352
commit
42189612c3
@ -2908,11 +2908,15 @@ Status DBImpl::Write(const WriteOptions& write_options, WriteBatch* my_batch) {
|
|||||||
|
|
||||||
if (!write_options.disableWAL) {
|
if (!write_options.disableWAL) {
|
||||||
RecordTick(stats_, WRITE_WITH_WAL);
|
RecordTick(stats_, WRITE_WITH_WAL);
|
||||||
default_cf_internal_stats_->AddDBStats(InternalStats::WRITE_WITH_WAL, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteContext context;
|
WriteContext context;
|
||||||
mutex_.Lock();
|
mutex_.Lock();
|
||||||
|
|
||||||
|
if (!write_options.disableWAL) {
|
||||||
|
default_cf_internal_stats_->AddDBStats(InternalStats::WRITE_WITH_WAL, 1);
|
||||||
|
}
|
||||||
|
|
||||||
Status status = write_thread_.EnterWriteThread(&w, expiration_time);
|
Status status = write_thread_.EnterWriteThread(&w, expiration_time);
|
||||||
assert(status.ok() || status.IsTimedOut());
|
assert(status.ok() || status.IsTimedOut());
|
||||||
if (status.IsTimedOut()) {
|
if (status.IsTimedOut()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user