Skip to content

Commit

Permalink
Add option for custom shared libs
Browse files Browse the repository at this point in the history
  • Loading branch information
gledis69 committed Oct 3, 2022
1 parent 8dadd96 commit 29c99c9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions citus_dev/citus_dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""citus_dev
Usage:
citus_dev make <name> [--size=<count>] [--port=<port>] [--use-ssl] [--no-extension] [--mx] [--destroy] [--init-with=<sql_file>] [--init-worker-with=<sql_file>] [--with-pgbouncer]
citus_dev make <name> [--size=<count>] [--port=<port>] [--use-ssl] [--no-extension] [--mx] [--destroy] [--init-with=<sql_file>] [--init-worker-with=<sql_file>] [--with-pgbouncer] [--with-shared-preloaded-libs=<lib1,lib2...>]
citus_dev restart <name> [--watch] [--port=<port>]
citus_dev (start|stop) <name> [--port=<port>] [--force]
Expand All @@ -18,6 +18,7 @@ Options:
--init-worker-with=<sql_file> A SQL script to run after creation of the cluster on the workers
--with-pgbouncer Setup pgbouncers between worker and coordinator (requires citus enterprise)
--force Forceful shutdown
--with-shared-preloaded-libs=<lib1,lib2...> Comma separated list of extra shared preload libraries to be added to postgresql.conf of each node
"""
from docopt import docopt
Expand Down Expand Up @@ -45,14 +46,17 @@ def run(command, *args, **kwargs):
return result


def createNodeCommands(clustername, role, index=None, usessl=False, mx=False):
def createNodeCommands(clustername, role, index=None, usessl=False, mx=False, extra_preloaded_libraries=None):
nodename = role
if index != None:
nodename += "%d" % index

run(f"initdb -D {clustername}/{nodename}")

shared_preload_libraries = ['citus', 'pg_stat_statements']

if extra_preloaded_libraries:
shared_preload_libraries.extend(extra_preloaded_libraries)

shared_preload_libraries = ','.join(shared_preload_libraries)

Expand Down Expand Up @@ -110,13 +114,17 @@ def main(arguments):
if arguments['--destroy']:
stopCluster(clustername, True)
run(f'rm -rf {clustername}')


extra_preloaded_libraries = []
if arguments["--with-shared-preloaded-libs"]:
extra_preloaded_libraries = arguments["--with-shared-preloaded-libs"]

createNodeCommands(
clustername,
"coordinator",
usessl=arguments["--use-ssl"],
mx=arguments["--mx"],
extra_preloaded_libraries=extra_preloaded_libraries
)

port = int(arguments["--port"])
Expand All @@ -133,6 +141,7 @@ def main(arguments):
i,
usessl=arguments["--use-ssl"],
mx=arguments["--mx"],
extra_preloaded_libraries=extra_preloaded_libraries
)
if pgbouncer:
createPgBouncerConfig(clustername, port, i)
Expand Down

0 comments on commit 29c99c9

Please sign in to comment.