mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Catch rethinkdb exceptions when configuring shards and replicas
This commit is contained in:
parent
cc6129103f
commit
8d204a50eb
@ -211,7 +211,10 @@ def run_set_shards(args):
|
|||||||
# See https://www.rethinkdb.com/api/python/config/
|
# See https://www.rethinkdb.com/api/python/config/
|
||||||
table_config = r.table(table).config().run(b.conn)
|
table_config = r.table(table).config().run(b.conn)
|
||||||
num_replicas = len(table_config['shards'][0]['replicas'])
|
num_replicas = len(table_config['shards'][0]['replicas'])
|
||||||
|
try:
|
||||||
r.table(table).reconfigure(shards=args.num_shards, replicas=num_replicas).run(b.conn)
|
r.table(table).reconfigure(shards=args.num_shards, replicas=num_replicas).run(b.conn)
|
||||||
|
except r.ReqlOpFailedError as e:
|
||||||
|
logger.warn(e)
|
||||||
|
|
||||||
|
|
||||||
def run_set_replicas(args):
|
def run_set_replicas(args):
|
||||||
@ -220,7 +223,10 @@ def run_set_replicas(args):
|
|||||||
# See https://www.rethinkdb.com/api/python/config/
|
# See https://www.rethinkdb.com/api/python/config/
|
||||||
table_config = r.table(table).config().run(b.conn)
|
table_config = r.table(table).config().run(b.conn)
|
||||||
num_shards = len(table_config['shards'])
|
num_shards = len(table_config['shards'])
|
||||||
|
try:
|
||||||
r.table(table).reconfigure(shards=num_shards, replicas=args.num_replicas).run(b.conn)
|
r.table(table).reconfigure(shards=num_shards, replicas=args.num_replicas).run(b.conn)
|
||||||
|
except r.ReqlOpFailedError as e:
|
||||||
|
logger.warn(e)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -248,7 +248,7 @@ def test_set_shards(b):
|
|||||||
|
|
||||||
|
|
||||||
def test_set_replicas(b):
|
def test_set_replicas(b):
|
||||||
import rethindb as r
|
import rethinkdb as r
|
||||||
from bigchaindb.commands.bigchain import run_set_replicas
|
from bigchaindb.commands.bigchain import run_set_replicas
|
||||||
|
|
||||||
# set the number of replicas
|
# set the number of replicas
|
||||||
|
Loading…
x
Reference in New Issue
Block a user