Use new DBWithTTL API in tests

main
Igor Canadi 11 years ago
parent f868dcbbed
commit 91ef2eae23
  1. 8
      db/merge_test.cc
  2. 9
      tools/db_stress.cc
  3. 6
      utilities/merge_operators/string_append/stringappend_test.cc

@ -17,7 +17,7 @@
#include "db/write_batch_internal.h" #include "db/write_batch_internal.h"
#include "utilities/merge_operators.h" #include "utilities/merge_operators.h"
#include "util/testharness.h" #include "util/testharness.h"
#include "utilities/utility_db.h" #include "utilities/db_ttl.h"
using namespace std; using namespace std;
using namespace rocksdb; using namespace rocksdb;
@ -80,7 +80,6 @@ std::shared_ptr<DB> OpenDb(const string& dbname, const bool ttl = false,
const size_t max_successive_merges = 0, const size_t max_successive_merges = 0,
const uint32_t min_partial_merge_operands = 2) { const uint32_t min_partial_merge_operands = 2) {
DB* db; DB* db;
StackableDB* sdb;
Options options; Options options;
options.create_if_missing = true; options.create_if_missing = true;
options.merge_operator = std::make_shared<CountMergeOperator>(); options.merge_operator = std::make_shared<CountMergeOperator>();
@ -90,8 +89,9 @@ std::shared_ptr<DB> OpenDb(const string& dbname, const bool ttl = false,
DestroyDB(dbname, Options()); DestroyDB(dbname, Options());
if (ttl) { if (ttl) {
cout << "Opening database with TTL\n"; cout << "Opening database with TTL\n";
s = UtilityDB::OpenTtlDB(options, dbname, &sdb); DBWithTTL* db_with_ttl;
db = sdb; s = DBWithTTL::Open(options, dbname, &db_with_ttl);
db = db_with_ttl;
} else { } else {
s = DB::Open(options, dbname, &db); s = DB::Open(options, dbname, &db);
} }

@ -28,7 +28,7 @@
#include "db/version_set.h" #include "db/version_set.h"
#include "rocksdb/statistics.h" #include "rocksdb/statistics.h"
#include "rocksdb/cache.h" #include "rocksdb/cache.h"
#include "utilities/utility_db.h" #include "utilities/db_ttl.h"
#include "rocksdb/env.h" #include "rocksdb/env.h"
#include "rocksdb/write_batch.h" #include "rocksdb/write_batch.h"
#include "rocksdb/slice.h" #include "rocksdb/slice.h"
@ -42,7 +42,6 @@
#include "util/random.h" #include "util/random.h"
#include "util/testutil.h" #include "util/testutil.h"
#include "util/logging.h" #include "util/logging.h"
#include "utilities/ttl/db_ttl.h"
#include "hdfs/env_hdfs.h" #include "hdfs/env_hdfs.h"
#include "utilities/merge_operators.h" #include "utilities/merge_operators.h"
@ -1620,9 +1619,9 @@ class StressTest {
assert(!s.ok() || column_families_.size() == assert(!s.ok() || column_families_.size() ==
static_cast<size_t>(FLAGS_column_families)); static_cast<size_t>(FLAGS_column_families));
} else { } else {
StackableDB* sdb; DBWithTTL* db_with_ttl;
s = UtilityDB::OpenTtlDB(options_, FLAGS_db, &sdb, FLAGS_ttl); s = DBWithTTL::Open(options_, FLAGS_db, &db_with_ttl, FLAGS_ttl);
db_ = sdb; db_ = db_with_ttl;
} }
if (!s.ok()) { if (!s.ok()) {
fprintf(stderr, "open error: %s\n", s.ToString().c_str()); fprintf(stderr, "open error: %s\n", s.ToString().c_str());

@ -14,7 +14,7 @@
#include "utilities/merge_operators.h" #include "utilities/merge_operators.h"
#include "utilities/merge_operators/string_append/stringappend.h" #include "utilities/merge_operators/string_append/stringappend.h"
#include "utilities/merge_operators/string_append/stringappend2.h" #include "utilities/merge_operators/string_append/stringappend2.h"
#include "utilities/ttl/db_ttl.h" #include "utilities/db_ttl.h"
#include "util/testharness.h" #include "util/testharness.h"
#include "util/random.h" #include "util/random.h"
@ -38,11 +38,11 @@ std::shared_ptr<DB> OpenNormalDb(char delim_char) {
// Open a TtlDB with a non-associative StringAppendTESTOperator // Open a TtlDB with a non-associative StringAppendTESTOperator
std::shared_ptr<DB> OpenTtlDb(char delim_char) { std::shared_ptr<DB> OpenTtlDb(char delim_char) {
StackableDB* db; DBWithTTL* db;
Options options; Options options;
options.create_if_missing = true; options.create_if_missing = true;
options.merge_operator.reset(new StringAppendTESTOperator(delim_char)); options.merge_operator.reset(new StringAppendTESTOperator(delim_char));
ASSERT_OK(UtilityDB::OpenTtlDB(options, kDbName, &db, 123456)); ASSERT_OK(DBWithTTL::Open(options, kDbName, &db, 123456));
return std::shared_ptr<DB>(db); return std::shared_ptr<DB>(db);
} }
} // namespace } // namespace

Loading…
Cancel
Save