Add auth for subscription.
This commit is contained in:
@ -1812,8 +1812,8 @@ void PostgresInitializer::InitWAL()
|
||||
|
||||
CheckAuthentication();
|
||||
|
||||
/* Don't set superuser when connection is from gs_basebackup */
|
||||
if (u_sess->proc_cxt.clientIsGsBasebackup) {
|
||||
/* Don't set superuser when connection is from gs_basebackup or subscription */
|
||||
if (u_sess->proc_cxt.clientIsGsBasebackup || u_sess->proc_cxt.clientIsSubscription) {
|
||||
InitUser();
|
||||
} else {
|
||||
SetSuperUserStandalone();
|
||||
|
||||
@ -3750,6 +3750,9 @@ int ProcessStartupPacket(Port* port, bool SSLdone)
|
||||
} else if (strcmp(valptr, "autonomoustransaction") == 0) {
|
||||
clientIsAutonomousTransaction = true;
|
||||
ereport(DEBUG5, (errmsg("autonomoustransaction connected")));
|
||||
} else if (strcmp(valptr, "subscription") == 0) {
|
||||
u_sess->proc_cxt.clientIsSubscription = true;
|
||||
ereport(DEBUG5, (errmsg("subscription connected")));
|
||||
} else {
|
||||
ereport(DEBUG5, (errmsg("application %s connected", valptr)));
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ bool sub_connect(char *conninfo, XLogRecPtr *startpoint, char *appname, int chan
|
||||
/*
|
||||
* We use the expand_dbname parameter to process the connection string (or
|
||||
* URI), and pass some extra options. The deliberately undocumented
|
||||
* parameter "replication=true" makes it a replication connection. The
|
||||
* parameter "replication=database" makes it a replication connection. The
|
||||
* database name is ignored by the server in replication mode.
|
||||
*/
|
||||
keys[i] = "dbname";
|
||||
@ -36,7 +36,7 @@ bool sub_connect(char *conninfo, XLogRecPtr *startpoint, char *appname, int chan
|
||||
keys[++i] = "replication";
|
||||
vals[i] = "database";
|
||||
keys[++i] = "fallback_application_name";
|
||||
vals[i] = appname;
|
||||
vals[i] = "subscription";
|
||||
keys[++i] = "client_encoding";
|
||||
vals[i] = GetDatabaseEncodingName();
|
||||
keys[++i] = NULL;
|
||||
|
||||
@ -1134,6 +1134,7 @@ typedef struct knl_u_proc_context {
|
||||
bool clientIsGsBasebackup; /* gs_basebackup tool check flag */
|
||||
bool clientIsGsroach; /* gs_roach tool check flag */
|
||||
bool clientIsGsRestore; /* gs_restore tool check flag */
|
||||
bool clientIsSubscription; /* subscription client check flag */
|
||||
bool IsBinaryUpgrade;
|
||||
bool IsWLMWhiteList; /* this proc will not be controled by WLM */
|
||||
bool gsRewindAddCount;
|
||||
|
||||
Reference in New Issue
Block a user