提交 503a756e 编写于 作者: S sdong 提交者: Facebook Github Bot

Fix clang analyze warning in db_stress (#5870)

Summary:
Recent changes trigger clang analyze warning. Fix it.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5870

Test Plan: "USE_CLANG=1 TEST_TMPDIR=/dev/shm/rocksdb OPT=-g make -j60 analyze" and make sure it passes.

Differential Revision: D17682533

fbshipit-source-id: 02716f2a24572550a22db4bbe9b54d4872dfae32
上级 51413e0a
......@@ -3319,7 +3319,8 @@ class NonBatchedOpsStressTest : public StressTest {
}
// TODO(ljin): update "long" to uint64_t
// Reseek when the prefix changes
if (i % (static_cast<int64_t>(1) << 8 * (8 - prefix_to_use)) == 0) {
if (prefix_to_use > 0 &&
i % (static_cast<int64_t>(1) << 8 * (8 - prefix_to_use)) == 0) {
iter->Seek(Key(i));
}
std::string from_db;
......@@ -4330,7 +4331,8 @@ class CfConsistencyStressTest : public StressTest {
iter->Next()) {
++count;
}
assert(count <= (static_cast<long>(1) << ((8 - prefix_to_use) * 8)));
assert(prefix_to_use == 0 ||
count <= (static_cast<long>(1) << ((8 - prefix_to_use) * 8)));
Status s = iter->status();
if (s.ok()) {
thread->stats.AddPrefixes(1, count);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册