Skip to content

Commit

Permalink
Fix race condition for accessing file size in TestFSWritableFile (#12312
Browse files Browse the repository at this point in the history
)

Summary:
Fix a race condition reported by thread sanitizer for accessing an underlying file's size from `TestFSWritableFile`.

Pull Request resolved: #12312

Test Plan:
COMPILE_WITH_TSAN=1 make -j10 transaction_test
./transaction_test --gtest_filter="DBAsBaseDB/TransactionTest.UnlockWALStallCleared/4" --gtest_repeat=100

Reviewed By: pdillinger

Differential Revision: D53235231

Pulled By: jowlyzhang

fbshipit-source-id: 35133cd97f8cbb48746ca3b42baeedecb36beb7b
  • Loading branch information
jowlyzhang authored and pull[bot] committed Feb 15, 2024
1 parent e0d72a8 commit 1321792
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions utilities/fault_injection_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class TestFSWritableFile : public FSWritableFile {

virtual uint64_t GetFileSize(const IOOptions& options,
IODebugContext* dbg) override {
MutexLock l(&mutex_);
return target_->GetFileSize(options, dbg);
}

Expand Down

0 comments on commit 1321792

Please sign in to comment.