-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INDY-1205: Use RocksDB as a key-value storage #561
INDY-1205: Use RocksDB as a key-value storage #561
Conversation
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Could one of the committers please verify this patch? |
@@ -59,7 +60,7 @@ | |||
clientBootStrategy = ClientBootStrategy.PoolTxn | |||
|
|||
hashStore = { | |||
"type": HS_FILE | |||
"type": HS_LEVELDB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please use rocksdb here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, thanks)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seriously speaking, I've made temporary roll back to leveldb as rocksdb building procedure is not ready yet.
logger = getlogger() | ||
|
||
|
||
class RocksDbHashStore(HashStore): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks exactly the same as LevelDbHashStore
. Maybe use just one implementation with Dependency Injection of a proper key-value implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I propose to merge hash stores implementations after rocksdb build procedure is ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
plenum/server/node.py
Outdated
@@ -940,7 +932,7 @@ def onStopping(self): | |||
|
|||
def closeAllKVStores(self): | |||
# Clear leveldb lock files | |||
logger.debug("{} closing level dbs".format(self), extra={"cli": False}) | |||
logger.debug("{} closing level/rocks dbs".format(self), extra={"cli": False}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better comment: closing key-value storages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
|
||
@pytest.yield_fixture(scope="module") | ||
def rocksdbHashStore(tdir): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there the same tests as for LevelDbHashStore
? maybe just use the same test with parametrized fixtures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
def close(self): | ||
raise NotImplementedError | ||
del self._db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we call del
here?
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
7bfc05e
to
f45ab67
Compare
…ksdb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
f45ab67
to
a551c09
Compare
…torage. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Test this please. |
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Test this please. |
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
…deb from sovrin. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
…bIntKeys. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
opts.comparator = IntegerComparator() | ||
self._db = rocksdb.DB(self._db_path, opts) | ||
|
||
def get_equal_or_prev(self, key): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we implement it in KeyValueStorageRocksdb?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it is correct just in case of integer keys with corresponding comparator. Otherwise the order is lexicographical where '2' is greater than '100', so get_equal_or_prev() does not make sense.
* INDY-1205: Add rocksdb as a key-value backend. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add tests for rocksdb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add rocksdb support. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Use rocksdb as a backend storage. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fix initialisation of rocksdb kvstore. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fix test_kv_rocksdb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fix comparator of KeyValueStorageRocksdbIntKeys class. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fix test_state_rocksdb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add unified config-based creation of hash store. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Change default hash storage from file to rocksdb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Integrate rocksdb into state tests. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Merge kv storages tests into single module. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Temporary rollback to leveldb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Re-factor tests. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Implement the first version of installation of rocksdb and python-rocksdb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Merge leveldb and rocksdb hash storages implementations into single storage. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Use RocksDB as a key-value storage. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Tempoprary use leveldb as a default storage for the ledger. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Adopt getAllTxn() for working with rocksdb iterator. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fix db_path property for leveldb and rocksdb, fix test. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add build procedure for python-rocksdb and setuptool, use librocksdb deb from sovrin. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add missed libs to docker file. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Change rocksdb package. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Change rocksdb package for 3d parties build. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Implement get_equal_or_prev() functionality for KeyValueStorageRocksdbIntKeys. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add a helper for init of k/v storage with int keys. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add rocksdb tests for the equal-or-prev functionality. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fallback to leveldb as we do not want to migrate to rocksdb right now. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
* INDY-1205: Add rocksdb as a key-value backend. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add tests for rocksdb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add rocksdb support. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Use rocksdb as a backend storage. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fix initialisation of rocksdb kvstore. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fix test_kv_rocksdb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fix comparator of KeyValueStorageRocksdbIntKeys class. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fix test_state_rocksdb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add unified config-based creation of hash store. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Change default hash storage from file to rocksdb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Integrate rocksdb into state tests. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Merge kv storages tests into single module. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Temporary rollback to leveldb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Re-factor tests. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Implement the first version of installation of rocksdb and python-rocksdb. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Merge leveldb and rocksdb hash storages implementations into single storage. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Use RocksDB as a key-value storage. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Tempoprary use leveldb as a default storage for the ledger. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Adopt getAllTxn() for working with rocksdb iterator. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fix db_path property for leveldb and rocksdb, fix test. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add build procedure for python-rocksdb and setuptool, use librocksdb deb from sovrin. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add missed libs to docker file. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Change rocksdb package. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Change rocksdb package for 3d parties build. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Implement get_equal_or_prev() functionality for KeyValueStorageRocksdbIntKeys. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add a helper for init of k/v storage with int keys. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Add rocksdb tests for the equal-or-prev functionality. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com> * Fallback to leveldb as we do not want to migrate to rocksdb right now. Signed-off-by: Sergey Shilov <sergey.shilov@dsr-company.com>
No description provided.