From 288af723e3dcb91d53f173ac28befe2e0166c7ea Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Fri, 12 Jun 2020 09:56:30 +0200 Subject: [PATCH 1/2] Add --no-extensio-on-workers to citus_dev --- citus_dev/citus_dev | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/citus_dev/citus_dev b/citus_dev/citus_dev index 73ca444b..ee153ede 100755 --- a/citus_dev/citus_dev +++ b/citus_dev/citus_dev @@ -2,19 +2,20 @@ """citus_dev Usage: - citus_dev make [--size=] [--port=] [--use-ssl] [--no-extension] [--mx] [--destroy] [--init-with=] + citus_dev make [--size=] [--port=] [--use-ssl] [--no-extension] [--no-extension-on-workers] [--mx] [--destroy] [--init-with=] citus_dev restart [--watch] [--port=] citus_dev (start|stop) [--port=] Options: - --size= Number of workers to create when 0 the coordinator will be added as a worker [default: 2] - --port= Port number to use for the coordinator. All workers take subsequent numbers [default: 9700] - --watch Watch for changes to the citus plugin and restart the cluster when the plugin updates - --use-ssl Create the cluster with ssl enabled - --no-extension Do not create the extension while creating the nodes - --mx Enable metadata sync for all workers - --destroy Destroy any old cluster with the same name - --init-with= A SQL script to run after creation of the cluster to set up any necessary tables and data + --size= Number of workers to create when 0 the coordinator will be added as a worker [default: 2] + --port= Port number to use for the coordinator. All workers take subsequent numbers [default: 9700] + --watch Watch for changes to the citus plugin and restart the cluster when the plugin updates + --use-ssl Create the cluster with ssl enabled + --no-extension Do not create the extension while creating the nodes + --no-extension-on-workers Do not create the extension on the workers while creating the nodes + --mx Enable metadata sync for all workers + --destroy Destroy any old cluster with the same name + --init-with= A SQL script to run after creation of the cluster to set up any necessary tables and data """ from docopt import docopt @@ -115,8 +116,11 @@ def main(arguments): run('createdb -p %d' % (port + i)) if not arguments["--no-extension"]: - for i in range(size + 1): - run('psql -p %d -c "CREATE EXTENSION citus;"' % (port + i)) + if arguments["--no-extension-on-workers"]: + run('psql -p %d -c "CREATE EXTENSION citus;"' % (port)) + else: + for i in range(size + 1): + run('psql -p %d -c "CREATE EXTENSION citus;"' % (port + i)) # If the cluster size is 0 we add the coordinator as the only node, otherwise we will add all other nodes if size == 0: From 4b28a983ba0e56ed15be6740b26034ee259e4251 Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Fri, 12 Jun 2020 10:07:36 +0200 Subject: [PATCH 2/2] Do not fail on --destroy if not exists --- citus_dev/citus_dev | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/citus_dev/citus_dev b/citus_dev/citus_dev index ee153ede..83159da8 100755 --- a/citus_dev/citus_dev +++ b/citus_dev/citus_dev @@ -68,9 +68,14 @@ def main(arguments): if arguments["make"]: if arguments['--destroy']: name = arguments[""] - for role in getRoles(name): - run("pg_ctl stop -D %s/%s || true" % (name, role)) - run('rm -rf %s' % (name)) + try: + roles = getRoles(name) + except Exception: + pass + else: + for role in roles: + run("pg_ctl stop -D %s/%s || true" % (name, role)) + run('rm -rf %s' % (name)) createNodeCommands( arguments[""],