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 b26eeaecd3)
onder_10_1_comm
Onder Kalaci 2022-01-26 16:57:08 +01:00
parent 854eec7380
commit c9e01e816d
1 changed files with 6 additions and 6 deletions

View File

@ -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
}; };
/* /*