From ed3f298eb338827c2ba710406c4c1f517b7b6b50 Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Wed, 26 Jan 2022 16:57:08 +0100 Subject: [PATCH] Use a fixed application_name while connecting to remote nodes Citus heavily relies on application_name, see `IsCitusInitiatedRemoteBackend()`. But if the user set the application name, such as export PGAPPNAME=test_name, Citus uses that name while connecting to the remote node. With this commit, we ensure that Citus always connects with the "citus" user name to the remote nodes. (cherry picked from commit b26eeaecd30d596f3c69eb883d5d6a1760fdb073) --- .../connection/connection_configuration.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backend/distributed/connection/connection_configuration.c b/src/backend/distributed/connection/connection_configuration.c index 43ceaefd7..04212c3b2 100644 --- a/src/backend/distributed/connection/connection_configuration.c +++ b/src/backend/distributed/connection/connection_configuration.c @@ -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 }; /*