Skip to content

Commit

Permalink
fix build c++ test issue
Browse files Browse the repository at this point in the history
  • Loading branch information
eharry committed Mar 21, 2021
1 parent 1c7e78a commit 3144a31
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ env.Library(
'src/rocks_begin_transaction_block.cpp',
'src/rocks_prepare_conflict.cpp',
'src/mongo_rate_limiter_checker.cpp',
'src/rocks_parameters.cpp',
],
LIBDEPS= [
'$BUILD_DIR/mongo/base',
Expand Down Expand Up @@ -60,7 +61,6 @@ env.Library(
source= [
'src/rocks_init.cpp',
'src/rocks_options_init.cpp',
'src/rocks_parameters.cpp',
'src/rocks_record_store_mongod.cpp',
'src/rocks_server_status.cpp',
],
Expand Down
2 changes: 2 additions & 0 deletions src/rocks_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,8 @@ namespace mongo {
_counterManager->sync();
_counterManager.reset();
_compactionScheduler.reset();
_defaultCf.reset();
_oplogCf.reset();
_db.reset();
}

Expand Down
5 changes: 5 additions & 0 deletions src/rocks_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ namespace mongo {
bool canRecoverToStableTimestamp() const;
std::uint64_t getStableTimestamp() const;
std::uint64_t getInitialDataTimestamp() const;
rocksdb::ColumnFamilyHandle* getDefaultCf_ForTest() const { return _defaultCf.get(); }
rocksdb::ColumnFamilyHandle* getOplogCf_ForTest() const { return _oplogCf.get(); }
rocksdb::ColumnFamilyHandle* getCf_ForTest(const std::string& ns) const {
return NamespaceString::oplog(ns)? getOplogCf_ForTest() : getDefaultCf_ForTest();
}

private:
Status _createIdent(StringData ident, BSONObjBuilder* configBuilder);
Expand Down
10 changes: 6 additions & 4 deletions src/rocks_index_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ namespace mongo {
RocksIndexBase::generateConfig(&configBuilder, 3,
IndexDescriptor::IndexVersion::kV2);
if (unique) {
return stdx::make_unique<RocksUniqueIndex>(_engine.getDB(), "prefix", "ident",
return stdx::make_unique<RocksUniqueIndex>(_engine.getDB(), _engine.getDefaultCf_ForTest(),
"prefix", "ident",
_order, configBuilder.obj(),
"test.rocks", "testIndex");
} else {
return stdx::make_unique<RocksStandardIndex>(_engine.getDB(), "prefix", "ident",
return stdx::make_unique<RocksStandardIndex>(_engine.getDB(), _engine.getDefaultCf_ForTest(),
"prefix", "ident",
_order, configBuilder.obj());
}
}
Expand All @@ -81,8 +83,8 @@ namespace mongo {
return stdx::make_unique<RocksRecoveryUnit>(
_engine.getDB(), _engine.getOplogManager(),
checked_cast<RocksSnapshotManager*>(_engine.getSnapshotManager()),
_engine.getCounterManager(), _engine.getCompactionScheduler(),
_engine.getDurabilityManager(), true /* durale */, _engine);
_engine.getCompactionScheduler(),
_engine.getDurabilityManager(), true /* durale */, &_engine);
}

private:
Expand Down
4 changes: 2 additions & 2 deletions src/rocks_record_store_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace mongo {
std::unique_ptr<RecordStore> newNonCappedRecordStore(const std::string& ns) {
RocksRecoveryUnit* ru = dynamic_cast<RocksRecoveryUnit*>(_engine.newRecoveryUnit());
OperationContextNoop opCtx(ru);
return stdx::make_unique<RocksRecordStore>(&_engine, &opCtx, ns, "1", "prefix");
return stdx::make_unique<RocksRecordStore>(&_engine, _engine.getCf_ForTest(ns), &opCtx, ns, "1", "prefix");
}

std::unique_ptr<RecordStore> newCappedRecordStore(int64_t cappedMaxSize,
Expand All @@ -102,7 +102,7 @@ namespace mongo {
int64_t cappedMaxDocs) {
RocksRecoveryUnit* ru = dynamic_cast<RocksRecoveryUnit*>(_engine.newRecoveryUnit());
OperationContextNoop opCtx(ru);
return stdx::make_unique<RocksRecordStore>(&_engine, &opCtx, ns, "1", "prefix",
return stdx::make_unique<RocksRecordStore>(&_engine, _engine.getCf_ForTest(ns), &opCtx, ns, "1", "prefix",
true /* isCapped */, cappedMaxSize,
cappedMaxDocs);
}
Expand Down
2 changes: 1 addition & 1 deletion src/rocks_recovery_unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace mongo {

virtual std::unique_ptr<RecordStore> createRecordStore(OperationContext* opCtx,
const std::string& ns) final {
return stdx::make_unique<RocksRecordStore>(&_engine, opCtx, ns, "1", "prefix");
return stdx::make_unique<RocksRecordStore>(&_engine, _engine.getCf_ForTest(ns), opCtx, ns, "1", "prefix");
}

private:
Expand Down

0 comments on commit 3144a31

Please sign in to comment.