Fixed db_stress

Summary:
Fixed db_stress by correcting the verification of column family
names in the Listener of db_stress

Test Plan: db_stress

Reviewers: igor, sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D39255
main
Yueh-Hsuan Chiang 10 years ago
parent 4c181f08bc
commit 16c197627a
  1. 24
      tools/db_stress.cc

@ -784,11 +784,9 @@ class DbStressListener : public EventListener {
public: public:
DbStressListener( DbStressListener(
const std::string& db_name, const std::string& db_name,
const std::vector<DbPath>& db_paths, const std::vector<DbPath>& db_paths) :
const std::vector<ColumnFamilyDescriptor>& cf_descs) :
db_name_(db_name), db_name_(db_name),
db_paths_(db_paths), db_paths_(db_paths),
cf_descs_(cf_descs),
rand_(301) {} rand_(301) {}
virtual ~DbStressListener() {} virtual ~DbStressListener() {}
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
@ -828,20 +826,13 @@ class DbStressListener : public EventListener {
if (cf_name == kDefaultColumnFamilyName) { if (cf_name == kDefaultColumnFamilyName) {
return true; return true;
} }
for (const auto& cf_desc : cf_descs_) { // The column family names in the stress tests are numbers.
if (cf_desc.name == cf_name) { for (size_t i = 0; i < cf_name.size(); ++i) {
return true; if (cf_name[i] < '0' || cf_name[i] > '9') {
return false;
} }
} }
fprintf(stderr, return true;
"Unable to find the matched column family name "
"for CF: %s. Existing CF names are:\n",
cf_name.c_str());
for (const auto& cf_desc : cf_descs_) {
fprintf(stderr, " %s\n", cf_desc.name.c_str());
}
fflush(stderr);
return false;
} }
void VerifyFileDir(const std::string& file_dir) { void VerifyFileDir(const std::string& file_dir) {
@ -886,7 +877,6 @@ class DbStressListener : public EventListener {
private: private:
std::string db_name_; std::string db_name_;
std::vector<DbPath> db_paths_; std::vector<DbPath> db_paths_;
std::vector<ColumnFamilyDescriptor> cf_descs_;
Random rand_; Random rand_;
}; };
@ -2028,7 +2018,7 @@ class StressTest {
} }
options_.listeners.clear(); options_.listeners.clear();
options_.listeners.emplace_back( options_.listeners.emplace_back(
new DbStressListener(FLAGS_db, options_.db_paths, cf_descriptors)); new DbStressListener(FLAGS_db, options_.db_paths));
options_.create_missing_column_families = true; options_.create_missing_column_families = true;
s = DB::Open(DBOptions(options_), FLAGS_db, cf_descriptors, s = DB::Open(DBOptions(options_), FLAGS_db, cf_descriptors,
&column_families_, &db_); &column_families_, &db_);

Loading…
Cancel
Save