From 7b85c1e900a1e0f47c78ff1ddfa8ddd924715eaf Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Fri, 4 Jul 2014 00:02:12 -0700 Subject: [PATCH] Improve SimpleWriteTimeoutTest to avoid false alarm. Summary: SimpleWriteTimeoutTest has two parts: 1) insert two large key/values to make memtable full and expect both of them are successful; 2) insert another key / value and expect it to be timed-out. Previously we also set a timeout in the first step, but this might sometimes cause false alarm. This diff makes the first two writes run without timeout setting. Test Plan: export ROCKSDB_TESTS=Time make db_test Reviewers: sdong, ljin Reviewed By: ljin Subscribers: leveldb Differential Revision: https://reviews.facebook.net/D19461 --- db/db_test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/db_test.cc b/db/db_test.cc index 575768db1..025e04f24 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -7012,13 +7012,14 @@ TEST(DBTest, SimpleWriteTimeoutTest) { options.min_write_buffer_number_to_merge = 3; options.max_total_wal_size = std::numeric_limits::max(); WriteOptions write_opt = WriteOptions(); - write_opt.timeout_hint_us = 500; + write_opt.timeout_hint_us = 0; DestroyAndReopen(&options); // fill the two write buffer ASSERT_OK(Put(Key(1), Key(1) + std::string(100000, 'v'), write_opt)); ASSERT_OK(Put(Key(2), Key(2) + std::string(100000, 'v'), write_opt)); // As the only two write buffers are full in this moment, the third // Put is expected to be timed-out. + write_opt.timeout_hint_us = 300; ASSERT_TRUE( Put(Key(3), Key(3) + std::string(100000, 'v'), write_opt).IsTimedOut()); }