Skip to content

Commit

Permalink
Change concord::storage::DBMetadataStorage ptr to unique
Browse files Browse the repository at this point in the history
  • Loading branch information
tbierwiaczon authored and glevkovich committed Oct 11, 2022
1 parent 5e1027b commit c48c61b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion kvbc/include/Replica.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class Replica : public IReplica,
bftEngine::IReplica::IReplicaPtr m_replicaPtr = nullptr;
std::shared_ptr<ICommandsHandler> m_cmdHandler = nullptr;
bftEngine::IStateTransfer *m_stateTransfer = nullptr;
concord::storage::DBMetadataStorage *m_metadataStorage = nullptr;
std::unique_ptr<concord::storage::DBMetadataStorage> m_metadataStorage;
std::unique_ptr<ReplicaStateSync> replicaStateSync_;
std::shared_ptr<concordMetrics::Aggregator> aggregator_;
std::shared_ptr<concord::performance::PerformanceManager> pm_;
Expand Down
11 changes: 6 additions & 5 deletions kvbc/src/Replica.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Status Replica::initInternals() {
auto requestHandler = bftEngine::IRequestsHandler::createRequestsHandler(m_cmdHandler, cronTableRegistry_);
requestHandler->setReconfigurationHandler(std::make_shared<pruning::ReadOnlyReplicaPruningHandler>(*this));
m_replicaPtr = bftEngine::IReplica::createNewRoReplica(
replicaConfig_, requestHandler, m_stateTransfer, m_ptrComm.get(), m_metadataStorage);
replicaConfig_, requestHandler, m_stateTransfer, m_ptrComm.get(), m_metadataStorage.get());
m_stateTransfer->addOnTransferringCompleteCallback([this](std::uint64_t) {
std::vector<concord::client::reconfiguration::State> stateFromReservedPages;
uint64_t wedgePt{0};
Expand Down Expand Up @@ -308,7 +308,7 @@ void Replica::createReplicaAndSyncState() {
requestHandler,
m_stateTransfer,
m_ptrComm.get(),
m_metadataStorage,
m_metadataStorage.get(),
pm_,
secretsManager_,
std::bind(&AdaptivePruningManager::setPrimary, &AdaptivePruningManager_, std::placeholders::_1));
Expand Down Expand Up @@ -604,10 +604,11 @@ Replica::Replica(ICommunication *comm,
if (!replicaConfig.isReadOnly) {
stReconfigurationSM_ = std::make_unique<concord::kvbc::StReconfigurationHandler>(
*m_stateTransfer, *this, this->AdaptivePruningManager_, this->replicaResources_);
m_metadataStorage = new DBMetadataStorage(m_metadataDBClient.get(), storageFactory->newMetadataKeyManipulator());
m_metadataStorage.reset(
new DBMetadataStorage(m_metadataDBClient.get(), storageFactory->newMetadataKeyManipulator()));
} else {
m_metadataStorage =
new storage::DBMetadataStorageUnbounded(m_metadataDBClient.get(), storageFactory->newMetadataKeyManipulator());
m_metadataStorage.reset(
new storage::DBMetadataStorageUnbounded(m_metadataDBClient.get(), storageFactory->newMetadataKeyManipulator()));
}
// Instantiate IControlHandler.
// If an application instantiation has already taken a place this will have no effect.
Expand Down

0 comments on commit c48c61b

Please sign in to comment.