Fixed a compile warning in db_stress in NDEBUG mode.

Summary: Fixed a compile warning in db_stress in NDEBUG mode.

Test Plan: make OPT=-DNDEBUG db_stress

Reviewers: sdong, anthony

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D39213
main
Yueh-Hsuan Chiang 10 years ago
parent dc9d70de65
commit 832271f6b1
  1. 6
      tools/db_stress.cc

@ -845,6 +845,7 @@ class DbStressListener : public EventListener {
} }
void VerifyFileDir(const std::string& file_dir) { void VerifyFileDir(const std::string& file_dir) {
#ifndef NDEBUG
if (db_name_ == file_dir) { if (db_name_ == file_dir) {
return; return;
} }
@ -854,17 +855,21 @@ class DbStressListener : public EventListener {
} }
} }
assert(false); assert(false);
#endif // !NDEBUG
} }
void VerifyFileName(const std::string& file_name) { void VerifyFileName(const std::string& file_name) {
#ifndef NDEBUG
uint64_t file_number; uint64_t file_number;
FileType file_type; FileType file_type;
bool result = ParseFileName(file_name, &file_number, &file_type); bool result = ParseFileName(file_name, &file_number, &file_type);
assert(result); assert(result);
assert(file_type == kTableFile); assert(file_type == kTableFile);
#endif // !NDEBUG
} }
void VerifyFilePath(const std::string& file_path) { void VerifyFilePath(const std::string& file_path) {
#ifndef NDEBUG
size_t pos = file_path.find_last_of("/"); size_t pos = file_path.find_last_of("/");
if (pos == std::string::npos) { if (pos == std::string::npos) {
VerifyFileName(file_path); VerifyFileName(file_path);
@ -874,6 +879,7 @@ class DbStressListener : public EventListener {
} }
VerifyFileName(file_path.substr(pos)); VerifyFileName(file_path.substr(pos));
} }
#endif // !NDEBUG
} }
#endif // !ROCKSDB_LITE #endif // !ROCKSDB_LITE

Loading…
Cancel
Save