From f548a2a03cacdf1463bb4c63340569f846c73128 Mon Sep 17 00:00:00 2001 From: Jay Zhuang Date: Mon, 12 Oct 2020 11:20:45 -0700 Subject: [PATCH] Fix a flaky tsan test for DBTest2 (#7526) Summary: ThreadSanitizer: data race for `DummyOldStats.num_rt`. Failed build: https://app.circleci.com/pipelines/github/facebook/rocksdb/3991/workflows/b47c3ae1-5531-4489-ac51-11854abdfd0f/jobs/42305 Pull Request resolved: https://github.com/facebook/rocksdb/pull/7526 Reviewed By: akankshamahajan15 Differential Revision: D24226736 Pulled By: jay-zhuang fbshipit-source-id: e05ce354d0c0db0eba242d59d4b0e89ce7c25acf --- db/db_test2.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/db_test2.cc b/db/db_test2.cc index ed0f469d0..1f08e1794 100644 --- a/db/db_test2.cc +++ b/db/db_test2.cc @@ -4376,8 +4376,8 @@ class DummyOldStats : public Statistics { } bool HistEnabledForType(uint32_t /*type*/) const override { return false; } std::string ToString() const override { return ""; } - int num_rt = 0; - int num_mt = 0; + std::atomic num_rt{0}; + std::atomic num_mt{0}; }; } // namespace