mit-dci / opencbdc-tx

A transaction processor for a hypothetical, general-purpose, central bank digital currency
Other
901 stars 199 forks source link

2pc locking shard and leveldb #88

Closed davebryson closed 2 years ago

davebryson commented 2 years ago

Affected Branch

trunk

Basic Diagnostics

Description

The 2pc locking shard includes leveldb as a dependency. https://github.com/mit-dci/opencbdc-tx/blob/trunk/src/uhs/twophase/locking_shard/locking_shard.hpp#L20. But it doesn't look like leveldb is actually being used.

Removing the include from locking_shard.hpp builds without errors. However removing leveldb from CMakeLists.txt: https://github.com/mit-dci/opencbdc-tx/blob/trunk/src/uhs/twophase/locking_shard/CMakeLists.txt#L23 results in build errors. This has been confirmed by @HalosGhost

Code of Conduct

metalicjames commented 2 years ago

Leveldb is used by our raft log implementation. Since the 2PC shard is a raft replicated service leveldb is a dependency.

We implement the interface nuraft::log_store using leveldb here: https://github.com/mit-dci/opencbdc-tx/blob/ef541b5ecf2c851863ec44fdcfa7f0fc0da31ba2/src/util/raft/log_store.hpp#L17

Moving upwards in the stack, cbdc::raft::log_store is used by cbdc::raft::state_manager (our implementation of the interface nuraft::state_mgr) here: https://github.com/mit-dci/opencbdc-tx/blob/ef541b5ecf2c851863ec44fdcfa7f0fc0da31ba2/src/util/raft/state_manager.hpp#L54

State manager provided to NuRaft in cbdc::raft::node: https://github.com/mit-dci/opencbdc-tx/blob/ef541b5ecf2c851863ec44fdcfa7f0fc0da31ba2/src/util/raft/node.cpp#L47

cbdc::raft::node used to provide replication in cbdc::locking_shard::controller: https://github.com/mit-dci/opencbdc-tx/blob/ef541b5ecf2c851863ec44fdcfa7f0fc0da31ba2/src/uhs/twophase/locking_shard/controller.hpp#L57

Finally the shard controller is used in the locking_shardd binary: https://github.com/mit-dci/opencbdc-tx/blob/ef541b5ecf2c851863ec44fdcfa7f0fc0da31ba2/src/uhs/twophase/locking_shard/locking_shardd.cpp#L48

HalosGhost commented 2 years ago

@davebryson do you have any follow-up or further questions on this, or is it ready to close?

davebryson commented 2 years ago

No it can be closed. Thank you