Fix msvc debug test failures (#6579)

Summary:
1. stats_history_test: one slice of stats history is 12526 Bytes, which is greater than original assumption.
![image](https://user-images.githubusercontent.com/17753898/77381970-5a611a80-6d3c-11ea-9d64-59d2e3c04f79.png)
2. table_test: in VerifyBlockAccessTrace function, release trace reader before delete trace file.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6579

Reviewed By: siying

Differential Revision: D20767373

Pulled By: pdillinger

fbshipit-source-id: e8647d665cbe83a3f5429639c6219b50c0912124
main
Burton Li 5 years ago committed by Facebook GitHub Bot
parent ef088f0e93
commit df62cd5b35
  1. 10
      monitoring/stats_history_test.cc
  2. 2
      table/table_test.cc

@ -270,10 +270,10 @@ TEST_F(StatsHistoryTest, InMemoryStatsHistoryPurging) {
} }
size_t stats_history_size = dbfull()->TEST_EstimateInMemoryStatsHistorySize(); size_t stats_history_size = dbfull()->TEST_EstimateInMemoryStatsHistorySize();
ASSERT_GE(slice_count, 9); ASSERT_GE(slice_count, 9);
ASSERT_GE(stats_history_size, 12000); ASSERT_GE(stats_history_size, 13000);
// capping memory cost at 12000 bytes since one slice is around 10000~12000 // capping memory cost at 13000 bytes since one slice is around 10000~13000
ASSERT_OK(dbfull()->SetDBOptions({{"stats_history_buffer_size", "12000"}})); ASSERT_OK(dbfull()->SetDBOptions({{"stats_history_buffer_size", "13000"}}));
ASSERT_EQ(12000, dbfull()->GetDBOptions().stats_history_buffer_size); ASSERT_EQ(13000, dbfull()->GetDBOptions().stats_history_buffer_size);
// Wait for stats persist to finish // Wait for stats persist to finish
for (; mock_time < 20; ++mock_time) { for (; mock_time < 20; ++mock_time) {
dbfull()->TEST_WaitForPersistStatsRun( dbfull()->TEST_WaitForPersistStatsRun(
@ -292,7 +292,7 @@ TEST_F(StatsHistoryTest, InMemoryStatsHistoryPurging) {
dbfull()->TEST_EstimateInMemoryStatsHistorySize(); dbfull()->TEST_EstimateInMemoryStatsHistorySize();
// only one slice can fit under the new stats_history_buffer_size // only one slice can fit under the new stats_history_buffer_size
ASSERT_LT(slice_count, 2); ASSERT_LT(slice_count, 2);
ASSERT_TRUE(stats_history_size_reopen < 12000 && ASSERT_TRUE(stats_history_size_reopen < 13000 &&
stats_history_size_reopen > 0); stats_history_size_reopen > 0);
ASSERT_TRUE(stats_count_reopen < stats_count && stats_count_reopen > 0); ASSERT_TRUE(stats_count_reopen < stats_count && stats_count_reopen > 0);
Close(); Close();

@ -1120,6 +1120,7 @@ class BlockBasedTableTest
const std::vector<BlockCacheTraceRecord>& expected_records) { const std::vector<BlockCacheTraceRecord>& expected_records) {
c->block_cache_tracer_.EndTrace(); c->block_cache_tracer_.EndTrace();
{
std::unique_ptr<TraceReader> trace_reader; std::unique_ptr<TraceReader> trace_reader;
Status s = Status s =
NewFileTraceReader(env_, EnvOptions(), trace_file_path_, &trace_reader); NewFileTraceReader(env_, EnvOptions(), trace_file_path_, &trace_reader);
@ -1165,6 +1166,7 @@ class BlockBasedTableTest
index++; index++;
} }
EXPECT_EQ(index, expected_records.size()); EXPECT_EQ(index, expected_records.size());
}
EXPECT_OK(env_->DeleteFile(trace_file_path_)); EXPECT_OK(env_->DeleteFile(trace_file_path_));
EXPECT_OK(env_->DeleteDir(test_path_)); EXPECT_OK(env_->DeleteDir(test_path_));
} }

Loading…
Cancel
Save