Skip to content

Commit 88bbed3

Browse files
committed
Revert "Base implementation of RocksDB support (#1416)"
This reverts commit 61a9a37.
1 parent be73676 commit 88bbed3

22 files changed

+192
-563
lines changed

.circleci/config.yml

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,48 +23,29 @@ common: &common
2323
when: on_fail
2424
- restore_cache:
2525
keys:
26-
- cache-v1-python-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
27-
- restore_cache:
28-
keys:
29-
- cache-v1-rocksdb-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".circleci/install_rocksdb.sh" }}
30-
- run:
31-
name: install rocksdb
32-
command: sudo sh ./.circleci/install_rocksdb.sh
33-
- save_cache:
34-
paths:
35-
- ~/rocksdb/
36-
key: cache-v1-rocksdb-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".circleci/install_rocksdb.sh" }}
26+
- cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
3727
- run:
3828
name: install dependencies
3929
command: pip install --user tox
4030
- run:
4131
name: run tox
42-
command: ~/.local/bin/tox -r
32+
command: ~/.local/bin/tox
4333
- save_cache:
4434
paths:
4535
- .hypothesis
36+
- .tox
4637
- ~/.cache/pip
4738
- ~/.local
4839
- ./eggs
49-
key: cache-v1-python-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
40+
key: cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
5041

5142
geth_steps: &geth_steps
5243
working_directory: ~/repo
5344
steps:
5445
- checkout
5546
- restore_cache:
5647
keys:
57-
- cache-v1-python-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
58-
- restore_cache:
59-
keys:
60-
- cache-v2-rocksdb-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".circleci/install_rocksdb.sh" }}
61-
- run:
62-
name: install rocksdb
63-
command: sudo sh ./.circleci/install_rocksdb.sh
64-
- save_cache:
65-
paths:
66-
- ~/rocksdb/
67-
key: cache-v2-rocksdb-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".circleci/install_rocksdb.sh" }}
48+
- cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
6849
- run:
6950
name: install dependencies
7051
command: pip install --user tox
@@ -98,7 +79,7 @@ geth_steps: &geth_steps
9879
- ./eggs
9980
- ~/.ethash
10081
- ~/.py-geth
101-
key: cache-v1-python-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
82+
key: cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
10283

10384
jobs:
10485
py35-lint:
@@ -285,6 +266,7 @@ jobs:
285266
environment:
286267
TOXENV: py36-trinity-integration
287268
py36-trinity-lightchain_integration:
269+
<<: *common
288270
<<: *geth_steps
289271
docker:
290272
- image: circleci/python:3.6

.circleci/install_rocksdb.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

.circleci/merge_pr.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#!/usr/bin/env bash
22

3-
set -o errexit
4-
set -o nounset
5-
63
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
74
PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER
85
PR_BASE_BRANCH=$(curl -L "$PR_INFO_URL" | python -c 'import json, sys; obj = json.load(sys.stdin); sys.stdout.write(obj["base"]["ref"])')

docs/guides/trinity/quickstart.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ we need to install the ``python3-pip`` package through the following command.
2626
2727
apt-get install python3-pip
2828
29-
Trinity also requires RocksDB which can be installed with the following command:
30-
31-
.. code:: sh
32-
33-
apt-get install liblz4-dev lib-rocksdb5.8
34-
3529
.. note::
3630
.. include:: /fragments/virtualenv_explainer.rst
3731

@@ -48,7 +42,7 @@ First, install LevelDB and the latest Python 3 with brew:
4842

4943
.. code:: sh
5044
51-
brew install python3 leveldb rocksdb
45+
brew install python3 leveldb
5246
5347
.. note::
5448
.. include:: /fragments/virtualenv_explainer.rst

eth/db/backends/level.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33
from pathlib import Path
44
from typing import (
5-
Iterator,
5+
Generator,
66
TYPE_CHECKING,
77
)
88

@@ -27,9 +27,10 @@
2727
class LevelDB(BaseAtomicDB):
2828
logger = logging.getLogger("eth.db.backends.LevelDB")
2929

30+
# Creates db as a class variable to avoid level db lock error
3031
def __init__(self, db_path: Path = None) -> None:
3132
if not db_path:
32-
raise TypeError("The LevelDB backend requires a database path")
33+
raise TypeError("Please specifiy a valid path for your database.")
3334
try:
3435
with catch_and_ignore_import_warning():
3536
import plyvel # noqa: F811
@@ -53,13 +54,10 @@ def _exists(self, key: bytes) -> bool:
5354
return self.db.get(key) is not None
5455

5556
def __delitem__(self, key: bytes) -> None:
56-
v = self.db.get(key)
57-
if v is None:
58-
raise KeyError(key)
5957
self.db.delete(key)
6058

6159
@contextmanager
62-
def atomic_batch(self) -> Iterator['LevelDBWriteBatch']:
60+
def atomic_batch(self) -> Generator['LevelDBWriteBatch', None, None]:
6361
with self.db.write_batch(transaction=True) as atomic_batch:
6462
readable_batch = LevelDBWriteBatch(self, atomic_batch)
6563
try:

eth/db/backends/rocks.py

Lines changed: 0 additions & 139 deletions
This file was deleted.

scripts/benchmark/utils/chain_plumbing.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
from eth.chains.base import (
3030
MiningChain,
3131
)
32-
from eth.db.backends.rocks import (
33-
RocksDB,
32+
from eth.db.backends.level import (
33+
LevelDB,
3434
)
3535
from eth.vm.base import (
3636
BaseVM,
@@ -91,14 +91,14 @@
9191
def get_chain(vm: Type[BaseVM], genesis_state: GenesisState) -> Iterable[MiningChain]:
9292

9393
with tempfile.TemporaryDirectory() as temp_dir:
94-
base_db = RocksDB(Path(temp_dir))
95-
chain = build(
94+
level_db_obj = LevelDB(Path(temp_dir))
95+
level_db_chain = build(
9696
MiningChain,
9797
fork_at(vm, constants.GENESIS_BLOCK_NUMBER),
9898
disable_pow_check(),
99-
genesis(db=base_db, params=GENESIS_PARAMS, state=genesis_state)
99+
genesis(db=level_db_obj, params=GENESIS_PARAMS, state=genesis_state)
100100
)
101-
yield chain
101+
yield level_db_chain
102102

103103

104104
def get_all_chains(genesis_state: GenesisState=DEFAULT_GENESIS_STATE) -> Iterable[MiningChain]:

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"eth-hash[pysha3];implementation_name=='cpython'",
2828
"eth-hash[pycryptodome];implementation_name=='pypy'",
2929
"plyvel==1.0.5",
30-
"python-rocksdb==0.6.9",
3130
],
3231
'p2p': [
3332
"asyncio-cancel-token==0.1.0a2",
@@ -44,7 +43,6 @@
4443
"coincurve>=8.0.0,<9.0.0",
4544
"ipython>=6.2.1,<7.0.0",
4645
"plyvel==1.0.5",
47-
"python-rocksdb==0.6.9",
4846
"web3==4.4.1",
4947
"lahja==0.9.0",
5048
"termcolor>=1.1.0,<2.0.0",
@@ -59,7 +57,7 @@
5957
"pytest-asyncio==0.9.0",
6058
"pytest-cov==2.5.1",
6159
"pytest-watch>=4.1.0,<5",
62-
"pytest-xdist==1.23.2",
60+
"pytest-xdist==1.18.1",
6361
# only needed for p2p
6462
"pytest-asyncio-network-simulator==0.1.0a2;python_version>='3.6'",
6563
],

tests/database/test_base_atomic_db.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44

55
from eth.db.atomic import AtomicDB
66
from eth.db.backends.level import LevelDB
7-
from eth.db.backends.rocks import RocksDB
87

98

10-
@pytest.fixture(params=['atomic', 'level', 'rocks'])
9+
@pytest.fixture(params=['atomic', 'level'])
1110
def atomic_db(request, tmpdir):
1211
if request.param == 'atomic':
1312
return AtomicDB()
1413
elif request.param == 'level':
1514
return LevelDB(db_path=tmpdir.mkdir("level_db_path"))
16-
elif request.param == 'rocks':
17-
return RocksDB(db_path=tmpdir.mkdir("rocks_db_path"))
1815
else:
1916
raise ValueError("Unexpected database type: {}".format(request.param))
2017

0 commit comments

Comments
 (0)