From 241db4ee4895825c40bdf23f02d2d214078d81e3 Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Mon, 4 Jun 2018 12:19:24 +0200 Subject: [PATCH] Problem: backlog_reassign_delay is defunct but still listed (#2332) * Fixed 2 PEP257 compliance errors * Upgrade Tendermint to 0.19.7 except for Docker image, which is still at 0.19.2 * Problem: backlog_reassign_delay is defunct but still listed Solution: remove all mentions of & calls for backlog_reassign_delay --- bigchaindb/__init__.py | 1 - bigchaindb/commands/bigchaindb.py | 4 ---- bigchaindb/core.py | 8 ++------ .../source/server-reference/configuration.md | 16 ---------------- k8s/bigchaindb/bigchaindb-ss.yaml | 5 ----- k8s/configuration/config-map.yaml | 4 ---- k8s/dev-setup/bigchaindb.yaml | 2 -- k8s/scripts/functions | 4 ---- tests/commands/conftest.py | 1 - tests/db/test_bigchain_api.py | 4 ++-- tests/test_config_utils.py | 2 -- tests/test_core.py | 1 - 12 files changed, 4 insertions(+), 48 deletions(-) diff --git a/bigchaindb/__init__.py b/bigchaindb/__init__.py index 7f4e74eb..02bb6f10 100644 --- a/bigchaindb/__init__.py +++ b/bigchaindb/__init__.py @@ -106,7 +106,6 @@ config = { 'private': None, }, 'keyring': [], - 'backlog_reassign_delay': 120, 'log': { 'file': log_config['handlers']['file']['filename'], 'error_file': log_config['handlers']['errors']['filename'], diff --git a/bigchaindb/commands/bigchaindb.py b/bigchaindb/commands/bigchaindb.py index 5cb7f350..c0ebdd93 100644 --- a/bigchaindb/commands/bigchaindb.py +++ b/bigchaindb/commands/bigchaindb.py @@ -83,10 +83,6 @@ def run_configure(args): val = conf['database'][key] conf['database'][key] = input_on_stderr('Database {}? (default `{}`): '.format(key, val), val) - val = conf['backlog_reassign_delay'] - conf['backlog_reassign_delay'] = input_on_stderr( - 'Stale transaction reassignment delay (in seconds)? (default `{}`): '.format(val), val) - if config_path != '-': bigchaindb.config_utils.write_config(conf, config_path) else: diff --git a/bigchaindb/core.py b/bigchaindb/core.py index 55993449..f100165c 100644 --- a/bigchaindb/core.py +++ b/bigchaindb/core.py @@ -30,7 +30,7 @@ class Bigchain(object): TX_IN_BACKLOG = 'backlog' """return if transaction is in backlog""" - def __init__(self, public_key=None, private_key=None, keyring=[], connection=None, backlog_reassign_delay=None): + def __init__(self, public_key=None, private_key=None, keyring=[], connection=None): """Initialize the Bigchain instance A Bigchain instance has several configuration parameters (e.g. host). @@ -56,10 +56,6 @@ class Bigchain(object): self.me_private = private_key or bigchaindb.config['keypair']['private'] self.nodes_except_me = keyring or bigchaindb.config['keyring'] - if backlog_reassign_delay is None: - backlog_reassign_delay = bigchaindb.config['backlog_reassign_delay'] - self.backlog_reassign_delay = backlog_reassign_delay - consensusPlugin = bigchaindb.config.get('consensus_plugin') if consensusPlugin: @@ -140,7 +136,7 @@ class Bigchain(object): backlog after some amount of time specified in the configuration """ - return backend.query.get_stale_transactions(self.connection, self.backlog_reassign_delay) + return backend.query.get_stale_transactions(self.connection) def validate_transaction(self, transaction): """Validate a transaction. diff --git a/docs/server/source/server-reference/configuration.md b/docs/server/source/server-reference/configuration.md index ba0cca8e..e07fa0d6 100644 --- a/docs/server/source/server-reference/configuration.md +++ b/docs/server/source/server-reference/configuration.md @@ -24,7 +24,6 @@ For convenience, here's a list of all the relevant environment variables (docume `BIGCHAINDB_WSSERVER_ADVERTISED_HOST`
`BIGCHAINDB_WSSERVER_ADVERTISED_PORT`
`BIGCHAINDB_CONFIG_PATH`
-`BIGCHAINDB_BACKLOG_REASSIGN_DELAY`
`BIGCHAINDB_LOG`
`BIGCHAINDB_LOG_FILE`
`BIGCHAINDB_LOG_ERROR_FILE`
@@ -201,21 +200,6 @@ export BIGCHAINDB_WSSERVER_ADVERTISED_PORT=443 } ``` -## backlog_reassign_delay - -Specifies how long, in seconds, transactions can remain in the backlog before being reassigned. Long-waiting transactions must be reassigned because the assigned node may no longer be responsive. The default duration is 120 seconds. - -**Example using environment variables** -```text -export BIGCHAINDB_BACKLOG_REASSIGN_DELAY=30 -``` - -**Default value (from a config file)** -```js -"backlog_reassign_delay": 120 -``` - - ## log The `log` key is expected to point to a mapping (set of key/value pairs) diff --git a/k8s/bigchaindb/bigchaindb-ss.yaml b/k8s/bigchaindb/bigchaindb-ss.yaml index f1abd887..04dbe86c 100644 --- a/k8s/bigchaindb/bigchaindb-ss.yaml +++ b/k8s/bigchaindb/bigchaindb-ss.yaml @@ -206,11 +206,6 @@ spec: configMapKeyRef: name: vars key: bigchaindb-wsserver-advertised-scheme - - name: BIGCHAINDB_BACKLOG_REASSIGN_DELAY - valueFrom: - configMapKeyRef: - name: bdb-config - key: bigchaindb-backlog-reassign-delay - name: BIGCHAINDB_DATABASE_MAXTRIES valueFrom: configMapKeyRef: diff --git a/k8s/configuration/config-map.yaml b/k8s/configuration/config-map.yaml index d84b12a2..d93074b6 100644 --- a/k8s/configuration/config-map.yaml +++ b/k8s/configuration/config-map.yaml @@ -106,10 +106,6 @@ data: # BigchainDB instance authentication user name bdb-user: "" - # bigchaindb-backlog-reassign-delay is the number of seconds a transaction - # can remain in the backlog before being reassigned. - bigchaindb-backlog-reassign-delay: "120" - # bigchaindb-database-maxtries is the maximum number of times that BigchainDB # will try to establish a connection with the database backend. # If it is set to 0, then it will try forever. diff --git a/k8s/dev-setup/bigchaindb.yaml b/k8s/dev-setup/bigchaindb.yaml index 1ccd5af1..c9e6442c 100644 --- a/k8s/dev-setup/bigchaindb.yaml +++ b/k8s/dev-setup/bigchaindb.yaml @@ -59,8 +59,6 @@ spec: value: "EEWUAhsk94ZUHhVw7qx9oZiXYDAWc9cRz93eMrsTG4kZ" - name: BIGCHAINDB_KEYPAIR_PRIVATE value: "3CjmRhu718gT1Wkba3LfdqX5pfYuBdaMPLd7ENUga5dm" - - name: BIGCHAINDB_BACKLOG_REASSIGN_DELAY - value: "120" - name: BIGCHAINDB_DATABASE_MAXTRIES value: "3" - name: BIGCHAINDB_DATABASE_CONNECTION_TIMEOUT diff --git a/k8s/scripts/functions b/k8s/scripts/functions index e110a202..c8d02f0e 100755 --- a/k8s/scripts/functions +++ b/k8s/scripts/functions @@ -339,10 +339,6 @@ data: # BigchainDB instance authentication user name bdb-user: "${bdb_user}" - # bigchaindb-backlog-reassign-delay is the number of seconds a transaction - # can remain in the backlog before being reassigned. - bigchaindb-backlog-reassign-delay: "120" - # bigchaindb-database-maxtries is the maximum number of times that BigchainDB # will try to establish a connection with the database backend. # If it is set to 0, then it will try forever. diff --git a/tests/commands/conftest.py b/tests/commands/conftest.py index d073eb78..8940ce19 100644 --- a/tests/commands/conftest.py +++ b/tests/commands/conftest.py @@ -37,7 +37,6 @@ def mock_bigchaindb_backup_config(monkeypatch): config = { 'keypair': {}, 'database': {'host': 'host', 'port': 12345, 'name': 'adbname'}, - 'backlog_reassign_delay': 5 } monkeypatch.setattr('bigchaindb._config', config) diff --git a/tests/db/test_bigchain_api.py b/tests/db/test_bigchain_api.py index 19915513..6a628395 100644 --- a/tests/db/test_bigchain_api.py +++ b/tests/db/test_bigchain_api.py @@ -543,7 +543,7 @@ class TestBigchainApi(object): b.write_transaction(tx) # retrieve the transaction - response = list(query.get_stale_transactions(b.connection, 0))[0] + response = list(query.get_stale_transactions(b.connection))[0] # check if the assignee is the current node assert response['assignee'] == b.me @@ -570,7 +570,7 @@ class TestBigchainApi(object): b.write_transaction(tx) # retrieve the transaction - response = query.get_stale_transactions(b.connection, 0) + response = query.get_stale_transactions(b.connection) # check if the assignee is one of the _other_ federation nodes for tx in response: diff --git a/tests/test_config_utils.py b/tests/test_config_utils.py index f156c871..264c7afa 100644 --- a/tests/test_config_utils.py +++ b/tests/test_config_utils.py @@ -170,7 +170,6 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch, request, ssl_con 'database': { 'host': DATABASE_HOST }, - 'backlog_reassign_delay': 5, 'log': { 'level_console': 'debug', }, @@ -290,7 +289,6 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch, request, ssl_con 'private': None, }, 'keyring': KEYRING.split(':'), - 'backlog_reassign_delay': 5, 'log': { 'file': LOG_FILE, 'error_file': log_config['handlers']['errors']['filename'], diff --git a/tests/test_core.py b/tests/test_core.py index b18c56d3..3447316e 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -23,7 +23,6 @@ def config(request, monkeypatch): }, 'keyring': [], 'CONFIGURED': True, - 'backlog_reassign_delay': 30, } monkeypatch.setattr('bigchaindb.config', config)