From 3c3252a06a77c5f6877392b882014dc8c8b2bd8f Mon Sep 17 00:00:00 2001 From: Maysam Yabandeh Date: Wed, 15 May 2019 11:18:34 -0700 Subject: [PATCH] Fix tsan complaint in ConcurrentMergeWrite test (#5308) Summary: The test was not using separate MemTablePostProcessInfo per memetable insert thread and thus tsan was complaining about data race. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5308 Differential Revision: D15356420 Pulled By: maysamyabandeh fbshipit-source-id: 46c2f2d19fb02c3c775b587aa09ca9c0dae6ed04 --- db/db_memtable_test.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/db/db_memtable_test.cc b/db/db_memtable_test.cc index a212c9812..184c6f53b 100644 --- a/db/db_memtable_test.cc +++ b/db/db_memtable_test.cc @@ -222,7 +222,6 @@ TEST_F(DBMemTableTest, ConcurrentMergeWrite) { options.allow_concurrent_memtable_write = true; ImmutableCFOptions ioptions(options); WriteBufferManager wb(options.db_write_buffer_size); - MemTablePostProcessInfo post_process_info; MemTable* mem = new MemTable(cmp, ioptions, MutableCFOptions(options), &wb, kMaxSequenceNumber, 0 /* column_family_id */); @@ -234,21 +233,23 @@ TEST_F(DBMemTableTest, ConcurrentMergeWrite) { // Write Merge concurrently rocksdb::port::Thread write_thread1([&]() { + MemTablePostProcessInfo post_process_info1; std::string v1; for (int seq = 1; seq < num_ops / 2; seq++) { PutFixed64(&v1, seq); bool res1 = - mem->Add(seq, kTypeMerge, "key", v1, true, &post_process_info); + mem->Add(seq, kTypeMerge, "key", v1, true, &post_process_info1); ASSERT_TRUE(res1); v1.clear(); } }); rocksdb::port::Thread write_thread2([&]() { + MemTablePostProcessInfo post_process_info2; std::string v2; for (int seq = num_ops / 2; seq < num_ops; seq++) { PutFixed64(&v2, seq); bool res2 = - mem->Add(seq, kTypeMerge, "key", v2, true, &post_process_info); + mem->Add(seq, kTypeMerge, "key", v2, true, &post_process_info2); ASSERT_TRUE(res2); v2.clear(); }