22"""citus_dev
33
44Usage:
5- 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]
5+ 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...>]
66 citus_dev restart <name> [--watch] [--port=<port>]
77 citus_dev (start|stop) <name> [--port=<port>] [--force]
88
@@ -18,6 +18,7 @@ Options:
1818 --init-worker-with=<sql_file> A SQL script to run after creation of the cluster on the workers
1919 --with-pgbouncer Setup pgbouncers between worker and coordinator (requires citus enterprise)
2020 --force Forceful shutdown
21+ --with-shared-preloaded-libs=<lib1,lib2...> Comma separated list of extra shared preload libraries to be added to postgresql.conf of each node
2122
2223"""
2324from docopt import docopt
@@ -45,14 +46,17 @@ def run(command, *args, **kwargs):
4546 return result
4647
4748
48- def createNodeCommands (clustername , role , index = None , usessl = False , mx = False ):
49+ def createNodeCommands (clustername , role , index = None , usessl = False , mx = False , extra_preloaded_libraries = None ):
4950 nodename = role
5051 if index != None :
5152 nodename += "%d" % index
5253
5354 run (f"initdb -D { clustername } /{ nodename } " )
5455
5556 shared_preload_libraries = ['citus' , 'pg_stat_statements' ]
57+
58+ if extra_preloaded_libraries :
59+ shared_preload_libraries .extend (extra_preloaded_libraries )
5660
5761 shared_preload_libraries = ',' .join (shared_preload_libraries )
5862
@@ -110,13 +114,17 @@ def main(arguments):
110114 if arguments ['--destroy' ]:
111115 stopCluster (clustername , True )
112116 run (f'rm -rf { clustername } ' )
113-
117+
118+ extra_preloaded_libraries = []
119+ if arguments ["--with-shared-preloaded-libs" ]:
120+ extra_preloaded_libraries = arguments ["--with-shared-preloaded-libs" ]
114121
115122 createNodeCommands (
116123 clustername ,
117124 "coordinator" ,
118125 usessl = arguments ["--use-ssl" ],
119126 mx = arguments ["--mx" ],
127+ extra_preloaded_libraries = extra_preloaded_libraries
120128 )
121129
122130 port = int (arguments ["--port" ])
@@ -133,6 +141,7 @@ def main(arguments):
133141 i ,
134142 usessl = arguments ["--use-ssl" ],
135143 mx = arguments ["--mx" ],
144+ extra_preloaded_libraries = extra_preloaded_libraries
136145 )
137146 if pgbouncer :
138147 createPgBouncerConfig (clustername , port , i )
0 commit comments