mirror of https://github.com/citusdata/citus.git
Merge pull request #5657 from citusdata/assign_explicit_citus_user_name
Use a fixed application_name while connecting to remote nodespull/5654/head^2
commit
dcb9c71f19
|
@ -72,8 +72,8 @@ InitConnParams()
|
||||||
/*
|
/*
|
||||||
* ResetConnParams frees all strings in the keywords and parameters arrays,
|
* ResetConnParams frees all strings in the keywords and parameters arrays,
|
||||||
* sets their elements to null, and resets the ConnParamsSize to zero before
|
* sets their elements to null, and resets the ConnParamsSize to zero before
|
||||||
* adding back any hardcoded global connection settings (at present, only the
|
* adding back any hardcoded global connection settings (at present, there
|
||||||
* fallback_application_name of 'citus').
|
* are no).
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ResetConnParams()
|
ResetConnParams()
|
||||||
|
@ -89,8 +89,6 @@ ResetConnParams()
|
||||||
ConnParams.size = 0;
|
ConnParams.size = 0;
|
||||||
|
|
||||||
InvalidateConnParamsHashEntries();
|
InvalidateConnParamsHashEntries();
|
||||||
|
|
||||||
AddConnParam("fallback_application_name", CITUS_APPLICATION_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -253,14 +251,16 @@ GetConnParams(ConnectionHashKey *key, char ***keywords, char ***values,
|
||||||
"port",
|
"port",
|
||||||
"dbname",
|
"dbname",
|
||||||
"user",
|
"user",
|
||||||
"client_encoding"
|
"client_encoding",
|
||||||
|
"application_name"
|
||||||
};
|
};
|
||||||
const char *runtimeValues[] = {
|
const char *runtimeValues[] = {
|
||||||
key->hostname,
|
key->hostname,
|
||||||
nodePortString,
|
nodePortString,
|
||||||
key->database,
|
key->database,
|
||||||
key->user,
|
key->user,
|
||||||
GetDatabaseEncodingName()
|
GetDatabaseEncodingName(),
|
||||||
|
CITUS_APPLICATION_NAME
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -66,7 +66,7 @@ def coordinator_should_haveshards(pg_path, port):
|
||||||
utils.psql(pg_path, port, command)
|
utils.psql(pg_path, port, command)
|
||||||
|
|
||||||
|
|
||||||
def start_databases(pg_path, rel_data_path, node_name_to_ports, logfile_prefix):
|
def start_databases(pg_path, rel_data_path, node_name_to_ports, logfile_prefix, env_variables):
|
||||||
for node_name in node_name_to_ports.keys():
|
for node_name in node_name_to_ports.keys():
|
||||||
abs_data_path = os.path.abspath(os.path.join(rel_data_path, node_name))
|
abs_data_path = os.path.abspath(os.path.join(rel_data_path, node_name))
|
||||||
node_port = node_name_to_ports[node_name]
|
node_port = node_name_to_ports[node_name]
|
||||||
|
@ -82,7 +82,13 @@ def start_databases(pg_path, rel_data_path, node_name_to_ports, logfile_prefix):
|
||||||
"--log",
|
"--log",
|
||||||
os.path.join(abs_data_path, logfile_name(logfile_prefix, node_name)),
|
os.path.join(abs_data_path, logfile_name(logfile_prefix, node_name)),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# set the application name if requires
|
||||||
|
if env_variables != {}:
|
||||||
|
os.environ.update(env_variables)
|
||||||
|
|
||||||
subprocess.run(command, check=True)
|
subprocess.run(command, check=True)
|
||||||
|
|
||||||
atexit.register(
|
atexit.register(
|
||||||
stop_databases,
|
stop_databases,
|
||||||
pg_path,
|
pg_path,
|
||||||
|
@ -127,6 +133,7 @@ def run_pg_regress_without_exit(
|
||||||
extra_tests,
|
extra_tests,
|
||||||
)
|
)
|
||||||
copy_binary_path = os.path.join(input_dir, "copy_modified_wrapper")
|
copy_binary_path = os.path.join(input_dir, "copy_modified_wrapper")
|
||||||
|
|
||||||
exit_code |= subprocess.call(copy_binary_path)
|
exit_code |= subprocess.call(copy_binary_path)
|
||||||
return exit_code
|
return exit_code
|
||||||
|
|
||||||
|
@ -241,7 +248,7 @@ def initialize_citus_cluster(bindir, datadir, settings, config):
|
||||||
initialize_db_for_cluster(
|
initialize_db_for_cluster(
|
||||||
bindir, datadir, settings, config.node_name_to_ports.keys()
|
bindir, datadir, settings, config.node_name_to_ports.keys()
|
||||||
)
|
)
|
||||||
start_databases(bindir, datadir, config.node_name_to_ports, config.name)
|
start_databases(bindir, datadir, config.node_name_to_ports, config.name, config.env_variables)
|
||||||
create_citus_extension(bindir, config.node_name_to_ports.values())
|
create_citus_extension(bindir, config.node_name_to_ports.values())
|
||||||
add_workers(bindir, config.worker_ports, config.coordinator_port())
|
add_workers(bindir, config.worker_ports, config.coordinator_port())
|
||||||
if config.is_mx:
|
if config.is_mx:
|
||||||
|
|
|
@ -110,6 +110,7 @@ class CitusBaseClusterConfig(object, metaclass=NewInitCaller):
|
||||||
}
|
}
|
||||||
self.new_settings = {}
|
self.new_settings = {}
|
||||||
self.add_coordinator_to_metadata = False
|
self.add_coordinator_to_metadata = False
|
||||||
|
self.env_variables = {}
|
||||||
|
|
||||||
def post_init(self):
|
def post_init(self):
|
||||||
self._init_node_name_ports()
|
self._init_node_name_ports()
|
||||||
|
@ -271,6 +272,10 @@ class CitusUnusualExecutorConfig(CitusMXBaseClusterConfig):
|
||||||
"citus.local_table_join_policy": "prefer-distributed",
|
"citus.local_table_join_policy": "prefer-distributed",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# this setting does not necessarily need to be here
|
||||||
|
# could go any other test
|
||||||
|
self.env_variables = {'PGAPPNAME' : 'test_app'}
|
||||||
|
|
||||||
|
|
||||||
class CitusSmallCopyBuffersConfig(CitusMXBaseClusterConfig):
|
class CitusSmallCopyBuffersConfig(CitusMXBaseClusterConfig):
|
||||||
def __init__(self, arguments):
|
def __init__(self, arguments):
|
||||||
|
|
|
@ -112,7 +112,7 @@ def main(config):
|
||||||
config.node_name_to_ports.keys(),
|
config.node_name_to_ports.keys(),
|
||||||
)
|
)
|
||||||
common.start_databases(
|
common.start_databases(
|
||||||
config.new_bindir, config.new_datadir, config.node_name_to_ports, config.name
|
config.new_bindir, config.new_datadir, config.node_name_to_ports, config.name, {}
|
||||||
)
|
)
|
||||||
citus_finish_pg_upgrade(config.new_bindir, config.node_name_to_ports.values())
|
citus_finish_pg_upgrade(config.new_bindir, config.node_name_to_ports.values())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue