Skip to content

Commit

Permalink
Merge pull request #1345 from andrewjstone/optimistic-transaction-db
Browse files Browse the repository at this point in the history
RocksDB: Use OptimisticTransactionDB
  • Loading branch information
andrewjstone authored Apr 2, 2021
2 parents 1ce42ee + def859a commit d2cd577
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions storage/include/rocksdb/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifdef USE_ROCKSDB
#include "Logger.hpp"
#include <rocksdb/db.h>
#include <rocksdb/utilities/transaction_db.h>
#include <rocksdb/utilities/optimistic_transaction_db.h>
#include <rocksdb/sst_file_manager.h>
#include "storage/db_interface.h"
#include "storage/storage_metrics.h"
Expand Down Expand Up @@ -158,7 +158,7 @@ class Client : public concord::storage::IDBClient {

// Database object (created on connection).
std::unique_ptr<::rocksdb::DB> dbInstance_;
::rocksdb::TransactionDB* txn_db_ = nullptr;
::rocksdb::OptimisticTransactionDB* txn_db_ = nullptr;
std::unique_ptr<const ::rocksdb::Comparator> comparator_;
std::map<std::string, CfUniquePtr> cf_handles_;

Expand Down
5 changes: 3 additions & 2 deletions storage/src/rocksdb_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@ void Client::openRocksDB(bool readOnly,
s.ToString());
dbInstance_.reset(db);
} else {
::rocksdb::TransactionDBOptions txn_options;
s = ::rocksdb::TransactionDB::Open(db_options, txn_options, m_dbPath, cf_descs, &raw_cf_handles, &txn_db_);
::rocksdb::OptimisticTransactionDBOptions txn_options;
s = ::rocksdb::OptimisticTransactionDB::Open(
db_options, txn_options, m_dbPath, cf_descs, &raw_cf_handles, &txn_db_);
unique_cf_handles = raw_to_unique_cf_handles(raw_cf_handles);
if (!s.ok())
throw std::runtime_error("Failed to open rocksdb database at " + m_dbPath + std::string(" reason: ") +
Expand Down

0 comments on commit d2cd577

Please sign in to comment.