Skip to content

Commit

Permalink
Revert "Base implementation of RocksDB support (ethereum#1416)"
Browse files Browse the repository at this point in the history
This reverts commit 61a9a37.
  • Loading branch information
cburgdorf committed Oct 25, 2018
1 parent be73676 commit 88bbed3
Show file tree
Hide file tree
Showing 22 changed files with 192 additions and 563 deletions.
32 changes: 7 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,48 +23,29 @@ common: &common
when: on_fail
- restore_cache:
keys:
- cache-v1-python-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- restore_cache:
keys:
- cache-v1-rocksdb-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".circleci/install_rocksdb.sh" }}
- run:
name: install rocksdb
command: sudo sh ./.circleci/install_rocksdb.sh
- save_cache:
paths:
- ~/rocksdb/
key: cache-v1-rocksdb-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".circleci/install_rocksdb.sh" }}
- cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- run:
name: install dependencies
command: pip install --user tox
- run:
name: run tox
command: ~/.local/bin/tox -r
command: ~/.local/bin/tox
- save_cache:
paths:
- .hypothesis
- .tox
- ~/.cache/pip
- ~/.local
- ./eggs
key: cache-v1-python-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
key: cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}

geth_steps: &geth_steps
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- cache-v1-python-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- restore_cache:
keys:
- cache-v2-rocksdb-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".circleci/install_rocksdb.sh" }}
- run:
name: install rocksdb
command: sudo sh ./.circleci/install_rocksdb.sh
- save_cache:
paths:
- ~/rocksdb/
key: cache-v2-rocksdb-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".circleci/install_rocksdb.sh" }}
- cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- run:
name: install dependencies
command: pip install --user tox
Expand Down Expand Up @@ -98,7 +79,7 @@ geth_steps: &geth_steps
- ./eggs
- ~/.ethash
- ~/.py-geth
key: cache-v1-python-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
key: cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}

jobs:
py35-lint:
Expand Down Expand Up @@ -285,6 +266,7 @@ jobs:
environment:
TOXENV: py36-trinity-integration
py36-trinity-lightchain_integration:
<<: *common
<<: *geth_steps
docker:
- image: circleci/python:3.6
Expand Down
23 changes: 0 additions & 23 deletions .circleci/install_rocksdb.sh

This file was deleted.

3 changes: 0 additions & 3 deletions .circleci/merge_pr.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset

if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER
PR_BASE_BRANCH=$(curl -L "$PR_INFO_URL" | python -c 'import json, sys; obj = json.load(sys.stdin); sys.stdout.write(obj["base"]["ref"])')
Expand Down
8 changes: 1 addition & 7 deletions docs/guides/trinity/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ we need to install the ``python3-pip`` package through the following command.
apt-get install python3-pip
Trinity also requires RocksDB which can be installed with the following command:

.. code:: sh
apt-get install liblz4-dev lib-rocksdb5.8
.. note::
.. include:: /fragments/virtualenv_explainer.rst

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

.. code:: sh
brew install python3 leveldb rocksdb
brew install python3 leveldb
.. note::
.. include:: /fragments/virtualenv_explainer.rst
Expand Down
10 changes: 4 additions & 6 deletions eth/db/backends/level.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
from pathlib import Path
from typing import (
Iterator,
Generator,
TYPE_CHECKING,
)

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

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

def __delitem__(self, key: bytes) -> None:
v = self.db.get(key)
if v is None:
raise KeyError(key)
self.db.delete(key)

@contextmanager
def atomic_batch(self) -> Iterator['LevelDBWriteBatch']:
def atomic_batch(self) -> Generator['LevelDBWriteBatch', None, None]:
with self.db.write_batch(transaction=True) as atomic_batch:
readable_batch = LevelDBWriteBatch(self, atomic_batch)
try:
Expand Down
139 changes: 0 additions & 139 deletions eth/db/backends/rocks.py

This file was deleted.

12 changes: 6 additions & 6 deletions scripts/benchmark/utils/chain_plumbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
from eth.chains.base import (
MiningChain,
)
from eth.db.backends.rocks import (
RocksDB,
from eth.db.backends.level import (
LevelDB,
)
from eth.vm.base import (
BaseVM,
Expand Down Expand Up @@ -91,14 +91,14 @@
def get_chain(vm: Type[BaseVM], genesis_state: GenesisState) -> Iterable[MiningChain]:

with tempfile.TemporaryDirectory() as temp_dir:
base_db = RocksDB(Path(temp_dir))
chain = build(
level_db_obj = LevelDB(Path(temp_dir))
level_db_chain = build(
MiningChain,
fork_at(vm, constants.GENESIS_BLOCK_NUMBER),
disable_pow_check(),
genesis(db=base_db, params=GENESIS_PARAMS, state=genesis_state)
genesis(db=level_db_obj, params=GENESIS_PARAMS, state=genesis_state)
)
yield chain
yield level_db_chain


def get_all_chains(genesis_state: GenesisState=DEFAULT_GENESIS_STATE) -> Iterable[MiningChain]:
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"eth-hash[pysha3];implementation_name=='cpython'",
"eth-hash[pycryptodome];implementation_name=='pypy'",
"plyvel==1.0.5",
"python-rocksdb==0.6.9",
],
'p2p': [
"asyncio-cancel-token==0.1.0a2",
Expand All @@ -44,7 +43,6 @@
"coincurve>=8.0.0,<9.0.0",
"ipython>=6.2.1,<7.0.0",
"plyvel==1.0.5",
"python-rocksdb==0.6.9",
"web3==4.4.1",
"lahja==0.9.0",
"termcolor>=1.1.0,<2.0.0",
Expand All @@ -59,7 +57,7 @@
"pytest-asyncio==0.9.0",
"pytest-cov==2.5.1",
"pytest-watch>=4.1.0,<5",
"pytest-xdist==1.23.2",
"pytest-xdist==1.18.1",
# only needed for p2p
"pytest-asyncio-network-simulator==0.1.0a2;python_version>='3.6'",
],
Expand Down
5 changes: 1 addition & 4 deletions tests/database/test_base_atomic_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@

from eth.db.atomic import AtomicDB
from eth.db.backends.level import LevelDB
from eth.db.backends.rocks import RocksDB


@pytest.fixture(params=['atomic', 'level', 'rocks'])
@pytest.fixture(params=['atomic', 'level'])
def atomic_db(request, tmpdir):
if request.param == 'atomic':
return AtomicDB()
elif request.param == 'level':
return LevelDB(db_path=tmpdir.mkdir("level_db_path"))
elif request.param == 'rocks':
return RocksDB(db_path=tmpdir.mkdir("rocks_db_path"))
else:
raise ValueError("Unexpected database type: {}".format(request.param))

Expand Down
Loading

0 comments on commit 88bbed3

Please sign in to comment.