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.
assign_explicit_citus_user_name_fail
Onder Kalaci 2022-01-26 16:57:08 +01:00
parent 9bc0fd9479
commit cb37730bfb
2 changed files with 7 additions and 7 deletions

View File

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

View File

@ -293,6 +293,7 @@ class CitusUnusualQuerySettingsConfig(CitusMXBaseClusterConfig):
"citus.recover_2pc_interval": "1s",
"citus.remote_task_check_interval": "1ms",
"citus.values_materialization_threshold": "0",
"application_name": "non_citus_app_name"
}
@ -317,7 +318,6 @@ class CitusSingleShardClusterConfig(CitusMXBaseClusterConfig):
super().__init__(arguments)
self.new_settings = {"citus.shard_count": 1}
class CitusNonMxClusterConfig(CitusMXBaseClusterConfig):
def __init__(self, arguments):
super().__init__(arguments)