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,
|
||||
* sets their elements to null, and resets the ConnParamsSize to zero before
|
||||
* adding back any hardcoded global connection settings (at present, only the
|
||||
* fallback_application_name of 'citus').
|
||||
* adding back any hardcoded global connection settings (at present, there
|
||||
* are no).
|
||||
*/
|
||||
void
|
||||
ResetConnParams()
|
||||
|
@ -89,8 +89,6 @@ ResetConnParams()
|
|||
ConnParams.size = 0;
|
||||
|
||||
InvalidateConnParamsHashEntries();
|
||||
|
||||
AddConnParam("fallback_application_name", CITUS_APPLICATION_NAME);
|
||||
}
|
||||
|
||||
|
||||
|
@ -253,14 +251,16 @@ GetConnParams(ConnectionHashKey *key, char ***keywords, char ***values,
|
|||
"port",
|
||||
"dbname",
|
||||
"user",
|
||||
"client_encoding"
|
||||
"client_encoding",
|
||||
"application_name"
|
||||
};
|
||||
const char *runtimeValues[] = {
|
||||
key->hostname,
|
||||
nodePortString,
|
||||
key->database,
|
||||
key->user,
|
||||
GetDatabaseEncodingName()
|
||||
GetDatabaseEncodingName(),
|
||||
CITUS_APPLICATION_NAME
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -66,7 +66,7 @@ def coordinator_should_haveshards(pg_path, port):
|
|||
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():
|
||||
abs_data_path = os.path.abspath(os.path.join(rel_data_path, 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",
|
||||
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)
|
||||
|
||||
atexit.register(
|
||||
stop_databases,
|
||||
pg_path,
|
||||
|
@ -127,6 +133,7 @@ def run_pg_regress_without_exit(
|
|||
extra_tests,
|
||||
)
|
||||
copy_binary_path = os.path.join(input_dir, "copy_modified_wrapper")
|
||||
|
||||
exit_code |= subprocess.call(copy_binary_path)
|
||||
return exit_code
|
||||
|
||||
|
@ -241,7 +248,7 @@ def initialize_citus_cluster(bindir, datadir, settings, config):
|
|||
initialize_db_for_cluster(
|
||||
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())
|
||||
add_workers(bindir, config.worker_ports, config.coordinator_port())
|
||||
if config.is_mx:
|
||||
|
|
|
@ -110,6 +110,7 @@ class CitusBaseClusterConfig(object, metaclass=NewInitCaller):
|
|||
}
|
||||
self.new_settings = {}
|
||||
self.add_coordinator_to_metadata = False
|
||||
self.env_variables = {}
|
||||
|
||||
def post_init(self):
|
||||
self._init_node_name_ports()
|
||||
|
@ -271,6 +272,10 @@ class CitusUnusualExecutorConfig(CitusMXBaseClusterConfig):
|
|||
"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):
|
||||
def __init__(self, arguments):
|
||||
|
|
|
@ -112,7 +112,7 @@ def main(config):
|
|||
config.node_name_to_ports.keys(),
|
||||
)
|
||||
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())
|
||||
|
||||
|
|
Loading…
Reference in New Issue