fix MSVC build failures (#6517)

Summary:
fix a few build warnings that are treated as failures with more strict MSVC warning settings
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6517

Differential Revision: D20401325

Pulled By: pdillinger

fbshipit-source-id: b44979dfaafdc7b3b8cb44a565400a99b331dd30
main
Huisheng Liu 5 years ago committed by Facebook GitHub Bot
parent 6dea7530b5
commit 07a3f7f008
  1. 2
      third-party/folly/folly/synchronization/DistributedMutex-inl.h
  2. 10
      tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc
  3. 19
      util/bloom_test.cc

@ -1527,7 +1527,7 @@ bool tryUnlockClean(Atomic& state, Proxy& proxy, Sleepers sleepers) {
template <template <typename> class Atomic, bool Publish>
void DistributedMutex<Atomic, Publish>::unlock(
DistributedMutex::DistributedMutexStateProxy proxy) {
typename DistributedMutex::DistributedMutexStateProxy proxy) {
// we always wake up ready threads and timed waiters if we saw either
assert(proxy);
assert(!proxy.combined_);

@ -327,7 +327,7 @@ TEST_F(BlockCacheTracerTest, BlockCacheAnalyzer) {
}
num_misses += ParseInt(substr);
}
ASSERT_EQ(51, num_misses);
ASSERT_EQ(51u, num_misses);
ASSERT_FALSE(getline(mt_file, line));
mt_file.close();
ASSERT_OK(env_->DeleteFile(miss_timeline_path));
@ -594,7 +594,7 @@ TEST_F(BlockCacheTracerTest, BlockCacheAnalyzer) {
sum_percent += ParseDouble(percent);
nrows++;
}
ASSERT_EQ(11, nrows);
ASSERT_EQ(11u, nrows);
ASSERT_EQ(100.0, sum_percent);
ASSERT_OK(env_->DeleteFile(filename));
}
@ -632,8 +632,10 @@ TEST_F(BlockCacheTracerTest, MixedBlocks) {
BlockCacheTraceReader reader(std::move(trace_reader));
BlockCacheTraceHeader header;
ASSERT_OK(reader.ReadHeader(&header));
ASSERT_EQ(kMajorVersion, header.rocksdb_major_version);
ASSERT_EQ(kMinorVersion, header.rocksdb_minor_version);
ASSERT_EQ(static_cast<uint32_t>(kMajorVersion),
header.rocksdb_major_version);
ASSERT_EQ(static_cast<uint32_t>(kMinorVersion),
header.rocksdb_minor_version);
// Read blocks.
BlockCacheTraceAnalyzer analyzer(
trace_file_path_,

@ -200,14 +200,14 @@ TEST_F(BlockBasedBloomTest, Schema) {
Add(Key(key, buffer));
}
Build();
ASSERT_EQ(BloomHash(FilterData()), 969445585);
ASSERT_EQ(BloomHash(FilterData()), 969445585U);
ResetPolicy(11); // num_probes = 7
for (int key = 0; key < 87; key++) {
Add(Key(key, buffer));
}
Build();
ASSERT_EQ(BloomHash(FilterData()), 1694458207);
ASSERT_EQ(BloomHash(FilterData()), 1694458207U);
ResetPolicy(10); // num_probes = 6
for (int key = 0; key < 87; key++) {
@ -221,7 +221,7 @@ TEST_F(BlockBasedBloomTest, Schema) {
Add(Key(key, buffer));
}
Build();
ASSERT_EQ(BloomHash(FilterData()), 1908442116);
ASSERT_EQ(BloomHash(FilterData()), 1908442116U);
ResetPolicy(10);
for (int key = 1; key < /*CHANGED*/ 88; key++) {
@ -623,7 +623,8 @@ TEST_P(FullBloomTest, Schema) {
Add(Key(key, buffer));
}
Build();
EXPECT_EQ(GetNumProbesFromFilterData(), SelectByImpl(9, 8));
EXPECT_EQ(static_cast<uint32_t>(GetNumProbesFromFilterData()),
SelectByImpl(9, 8));
EXPECT_EQ(
BloomHash(FilterData()),
SelectByImpl(SelectByCacheLineSize(178861123, 379087593, 2574136516U),
@ -642,7 +643,8 @@ TEST_P(FullBloomTest, Schema) {
Add(Key(key, buffer));
}
Build();
EXPECT_EQ(GetNumProbesFromFilterData(), SelectByImpl(11, 9));
EXPECT_EQ(static_cast<uint32_t>(GetNumProbesFromFilterData()),
SelectByImpl(11, 9));
EXPECT_EQ(
BloomHash(FilterData()),
SelectByImpl(SelectByCacheLineSize(1129406313, 3049154394U, 1727750964),
@ -716,7 +718,8 @@ TEST_P(FullBloomTest, Schema) {
Add(Key(key, buffer));
}
Build();
EXPECT_EQ(GetNumProbesFromFilterData(), SelectByImpl(6, 7));
EXPECT_EQ(static_cast<uint32_t>(GetNumProbesFromFilterData()),
SelectByImpl(6, 7));
EXPECT_EQ(BloomHash(FilterData()),
SelectByImpl(/*SAME*/ SelectByCacheLineSize(2885052954U, 769447944,
4175124908U),
@ -858,11 +861,11 @@ TEST_P(FullBloomTest, CorruptFilters) {
// Bad filter bits - returns false as if built from zero keys
// < 5 bytes overall means missing even metadata
OpenRaw(cft.Reset(-1, 3, 6, fill));
OpenRaw(cft.Reset(static_cast<uint32_t>(-1), 3, 6, fill));
ASSERT_FALSE(Matches("hello"));
ASSERT_FALSE(Matches("world"));
OpenRaw(cft.Reset(-5, 3, 6, fill));
OpenRaw(cft.Reset(static_cast<uint32_t>(-5), 3, 6, fill));
ASSERT_FALSE(Matches("hello"));
ASSERT_FALSE(Matches("world"));

Loading…
Cancel
Save