mirror of
https://github.com/postgres/postgres.git
synced 2026-06-13 10:40:09 -04:00
Add per-subscription wal_receiver_timeout setting.
This commit allows setting wal_receiver_timeout per subscription using the CREATE SUBSCRIPTION and ALTER SUBSCRIPTION commands. The value is stored in the subwalrcvtimeout column of the pg_subscription catalog. When set, this value overrides the global wal_receiver_timeout for the subscription's apply worker. The default is -1, which means the global setting (from the server configuration, command line, role, or database) remains in effect. This feature is useful for configuring different timeout values for each subscription, especially when connecting to multiple publisher servers, to improve failure detection. Bump catalog version. Author: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Japin Li <japinli@hotmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/a1414b64-bf58-43a6-8494-9704975a41e9@oss.nttdata.com
This commit is contained in:
parent
8a6af3ad08
commit
fb80f388f4
13 changed files with 245 additions and 98 deletions
|
|
@ -8216,6 +8216,16 @@ SCRAM-SHA-256$<replaceable><iteration count></replaceable>:<replaceable>&l
|
||||||
</para></entry>
|
</para></entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
|
<row>
|
||||||
|
<entry role="catalog_table_entry"><para role="column_definition">
|
||||||
|
<structfield>subwalrcvtimeout</structfield> <type>text</type>
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
The <varname>wal_receiver_timeout</varname>
|
||||||
|
setting for the subscription's workers to use
|
||||||
|
</para></entry>
|
||||||
|
</row>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
<entry role="catalog_table_entry"><para role="column_definition">
|
<entry role="catalog_table_entry"><para role="column_definition">
|
||||||
<structfield>subpublications</structfield> <type>text[]</type>
|
<structfield>subpublications</structfield> <type>text[]</type>
|
||||||
|
|
|
||||||
|
|
@ -280,8 +280,9 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
|
||||||
<link linkend="sql-createsubscription-params-with-origin"><literal>origin</literal></link>,
|
<link linkend="sql-createsubscription-params-with-origin"><literal>origin</literal></link>,
|
||||||
<link linkend="sql-createsubscription-params-with-failover"><literal>failover</literal></link>,
|
<link linkend="sql-createsubscription-params-with-failover"><literal>failover</literal></link>,
|
||||||
<link linkend="sql-createsubscription-params-with-two-phase"><literal>two_phase</literal></link>,
|
<link linkend="sql-createsubscription-params-with-two-phase"><literal>two_phase</literal></link>,
|
||||||
<link linkend="sql-createsubscription-params-with-retain-dead-tuples"><literal>retain_dead_tuples</literal></link>, and
|
<link linkend="sql-createsubscription-params-with-retain-dead-tuples"><literal>retain_dead_tuples</literal></link>,
|
||||||
<link linkend="sql-createsubscription-params-with-max-retention-duration"><literal>max_retention_duration</literal></link>.
|
<link linkend="sql-createsubscription-params-with-max-retention-duration"><literal>max_retention_duration</literal></link>, and
|
||||||
|
<link linkend="sql-createsubscription-params-with-wal-receiver-timeout"><literal>wal_receiver_timeout</literal></link>.
|
||||||
Only a superuser can set <literal>password_required = false</literal>.
|
Only a superuser can set <literal>password_required = false</literal>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -574,8 +574,21 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
|
||||||
</warning>
|
</warning>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist></para>
|
|
||||||
|
|
||||||
|
<varlistentry id="sql-createsubscription-params-with-wal-receiver-timeout">
|
||||||
|
<term><literal>wal_receiver_timeout</literal> (<type>text</type>)</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
The value of this parameter overrides the
|
||||||
|
<xref linkend="guc-wal-receiver-timeout"/> setting within this
|
||||||
|
subscription's apply worker processes. The default value is
|
||||||
|
<literal>-1</literal>, which means it does not override the global setting,
|
||||||
|
i.e., the value from the server configuration, command line, role or
|
||||||
|
database settings will be used instead.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist></para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,12 @@ GetSubscription(Oid subid, bool missing_ok)
|
||||||
Anum_pg_subscription_subsynccommit);
|
Anum_pg_subscription_subsynccommit);
|
||||||
sub->synccommit = TextDatumGetCString(datum);
|
sub->synccommit = TextDatumGetCString(datum);
|
||||||
|
|
||||||
|
/* Get walrcvtimeout */
|
||||||
|
datum = SysCacheGetAttrNotNull(SUBSCRIPTIONOID,
|
||||||
|
tup,
|
||||||
|
Anum_pg_subscription_subwalrcvtimeout);
|
||||||
|
sub->walrcvtimeout = TextDatumGetCString(datum);
|
||||||
|
|
||||||
/* Get publications */
|
/* Get publications */
|
||||||
datum = SysCacheGetAttrNotNull(SUBSCRIPTIONOID,
|
datum = SysCacheGetAttrNotNull(SUBSCRIPTIONOID,
|
||||||
tup,
|
tup,
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,9 @@
|
||||||
#define SUBOPT_FAILOVER 0x00002000
|
#define SUBOPT_FAILOVER 0x00002000
|
||||||
#define SUBOPT_RETAIN_DEAD_TUPLES 0x00004000
|
#define SUBOPT_RETAIN_DEAD_TUPLES 0x00004000
|
||||||
#define SUBOPT_MAX_RETENTION_DURATION 0x00008000
|
#define SUBOPT_MAX_RETENTION_DURATION 0x00008000
|
||||||
#define SUBOPT_LSN 0x00010000
|
#define SUBOPT_WAL_RECEIVER_TIMEOUT 0x00010000
|
||||||
#define SUBOPT_ORIGIN 0x00020000
|
#define SUBOPT_LSN 0x00020000
|
||||||
|
#define SUBOPT_ORIGIN 0x00040000
|
||||||
|
|
||||||
/* check if the 'val' has 'bits' set */
|
/* check if the 'val' has 'bits' set */
|
||||||
#define IsSet(val, bits) (((val) & (bits)) == (bits))
|
#define IsSet(val, bits) (((val) & (bits)) == (bits))
|
||||||
|
|
@ -104,6 +105,7 @@ typedef struct SubOpts
|
||||||
int32 maxretention;
|
int32 maxretention;
|
||||||
char *origin;
|
char *origin;
|
||||||
XLogRecPtr lsn;
|
XLogRecPtr lsn;
|
||||||
|
char *wal_receiver_timeout;
|
||||||
} SubOpts;
|
} SubOpts;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -402,6 +404,30 @@ parse_subscription_options(ParseState *pstate, List *stmt_options,
|
||||||
opts->specified_opts |= SUBOPT_LSN;
|
opts->specified_opts |= SUBOPT_LSN;
|
||||||
opts->lsn = lsn;
|
opts->lsn = lsn;
|
||||||
}
|
}
|
||||||
|
else if (IsSet(supported_opts, SUBOPT_WAL_RECEIVER_TIMEOUT) &&
|
||||||
|
strcmp(defel->defname, "wal_receiver_timeout") == 0)
|
||||||
|
{
|
||||||
|
bool parsed;
|
||||||
|
int val;
|
||||||
|
|
||||||
|
if (IsSet(opts->specified_opts, SUBOPT_WAL_RECEIVER_TIMEOUT))
|
||||||
|
errorConflictingDefElem(defel, pstate);
|
||||||
|
|
||||||
|
opts->specified_opts |= SUBOPT_WAL_RECEIVER_TIMEOUT;
|
||||||
|
opts->wal_receiver_timeout = defGetString(defel);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test if the given value is valid for wal_receiver_timeout GUC.
|
||||||
|
* Skip this test if the value is -1, since -1 is allowed for the
|
||||||
|
* wal_receiver_timeout subscription option, but not for the GUC
|
||||||
|
* itself.
|
||||||
|
*/
|
||||||
|
parsed = parse_int(opts->wal_receiver_timeout, &val, 0, NULL);
|
||||||
|
if (!parsed || val != -1)
|
||||||
|
(void) set_config_option("wal_receiver_timeout", opts->wal_receiver_timeout,
|
||||||
|
PGC_BACKEND, PGC_S_TEST, GUC_ACTION_SET,
|
||||||
|
false, 0, false);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
|
|
@ -612,7 +638,8 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
|
||||||
SUBOPT_DISABLE_ON_ERR | SUBOPT_PASSWORD_REQUIRED |
|
SUBOPT_DISABLE_ON_ERR | SUBOPT_PASSWORD_REQUIRED |
|
||||||
SUBOPT_RUN_AS_OWNER | SUBOPT_FAILOVER |
|
SUBOPT_RUN_AS_OWNER | SUBOPT_FAILOVER |
|
||||||
SUBOPT_RETAIN_DEAD_TUPLES |
|
SUBOPT_RETAIN_DEAD_TUPLES |
|
||||||
SUBOPT_MAX_RETENTION_DURATION | SUBOPT_ORIGIN);
|
SUBOPT_MAX_RETENTION_DURATION |
|
||||||
|
SUBOPT_WAL_RECEIVER_TIMEOUT | SUBOPT_ORIGIN);
|
||||||
parse_subscription_options(pstate, stmt->options, supported_opts, &opts);
|
parse_subscription_options(pstate, stmt->options, supported_opts, &opts);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -695,6 +722,14 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
|
||||||
if (opts.synchronous_commit == NULL)
|
if (opts.synchronous_commit == NULL)
|
||||||
opts.synchronous_commit = "off";
|
opts.synchronous_commit = "off";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The default for wal_receiver_timeout of subscriptions is -1, which
|
||||||
|
* means the value is inherited from the server configuration, command
|
||||||
|
* line, or role/database settings.
|
||||||
|
*/
|
||||||
|
if (opts.wal_receiver_timeout == NULL)
|
||||||
|
opts.wal_receiver_timeout = "-1";
|
||||||
|
|
||||||
conninfo = stmt->conninfo;
|
conninfo = stmt->conninfo;
|
||||||
publications = stmt->publication;
|
publications = stmt->publication;
|
||||||
|
|
||||||
|
|
@ -742,6 +777,8 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
|
||||||
nulls[Anum_pg_subscription_subslotname - 1] = true;
|
nulls[Anum_pg_subscription_subslotname - 1] = true;
|
||||||
values[Anum_pg_subscription_subsynccommit - 1] =
|
values[Anum_pg_subscription_subsynccommit - 1] =
|
||||||
CStringGetTextDatum(opts.synchronous_commit);
|
CStringGetTextDatum(opts.synchronous_commit);
|
||||||
|
values[Anum_pg_subscription_subwalrcvtimeout - 1] =
|
||||||
|
CStringGetTextDatum(opts.wal_receiver_timeout);
|
||||||
values[Anum_pg_subscription_subpublications - 1] =
|
values[Anum_pg_subscription_subpublications - 1] =
|
||||||
publicationListToArray(publications);
|
publicationListToArray(publications);
|
||||||
values[Anum_pg_subscription_suborigin - 1] =
|
values[Anum_pg_subscription_suborigin - 1] =
|
||||||
|
|
@ -1410,6 +1447,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
|
||||||
SUBOPT_RUN_AS_OWNER | SUBOPT_FAILOVER |
|
SUBOPT_RUN_AS_OWNER | SUBOPT_FAILOVER |
|
||||||
SUBOPT_RETAIN_DEAD_TUPLES |
|
SUBOPT_RETAIN_DEAD_TUPLES |
|
||||||
SUBOPT_MAX_RETENTION_DURATION |
|
SUBOPT_MAX_RETENTION_DURATION |
|
||||||
|
SUBOPT_WAL_RECEIVER_TIMEOUT |
|
||||||
SUBOPT_ORIGIN);
|
SUBOPT_ORIGIN);
|
||||||
|
|
||||||
parse_subscription_options(pstate, stmt->options,
|
parse_subscription_options(pstate, stmt->options,
|
||||||
|
|
@ -1665,6 +1703,13 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
|
||||||
origin = opts.origin;
|
origin = opts.origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsSet(opts.specified_opts, SUBOPT_WAL_RECEIVER_TIMEOUT))
|
||||||
|
{
|
||||||
|
values[Anum_pg_subscription_subwalrcvtimeout - 1] =
|
||||||
|
CStringGetTextDatum(opts.wal_receiver_timeout);
|
||||||
|
replaces[Anum_pg_subscription_subwalrcvtimeout - 1] = true;
|
||||||
|
}
|
||||||
|
|
||||||
update_tuple = true;
|
update_tuple = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -627,6 +627,8 @@ static inline void reset_apply_error_context_info(void);
|
||||||
static TransApplyAction get_transaction_apply_action(TransactionId xid,
|
static TransApplyAction get_transaction_apply_action(TransactionId xid,
|
||||||
ParallelApplyWorkerInfo **winfo);
|
ParallelApplyWorkerInfo **winfo);
|
||||||
|
|
||||||
|
static void set_wal_receiver_timeout(void);
|
||||||
|
|
||||||
static void on_exit_clear_xact_state(int code, Datum arg);
|
static void on_exit_clear_xact_state(int code, Datum arg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -5154,12 +5156,48 @@ maybe_reread_subscription(void)
|
||||||
SetConfigOption("synchronous_commit", MySubscription->synccommit,
|
SetConfigOption("synchronous_commit", MySubscription->synccommit,
|
||||||
PGC_BACKEND, PGC_S_OVERRIDE);
|
PGC_BACKEND, PGC_S_OVERRIDE);
|
||||||
|
|
||||||
|
/* Change wal_receiver_timeout according to the user's wishes */
|
||||||
|
set_wal_receiver_timeout();
|
||||||
|
|
||||||
if (started_tx)
|
if (started_tx)
|
||||||
CommitTransactionCommand();
|
CommitTransactionCommand();
|
||||||
|
|
||||||
MySubscriptionValid = true;
|
MySubscriptionValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Change wal_receiver_timeout to MySubscription->walrcvtimeout.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
set_wal_receiver_timeout(void)
|
||||||
|
{
|
||||||
|
bool parsed;
|
||||||
|
int val;
|
||||||
|
int prev_timeout = wal_receiver_timeout;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the wal_receiver_timeout GUC to MySubscription->walrcvtimeout,
|
||||||
|
* which comes from the subscription's wal_receiver_timeout option. If the
|
||||||
|
* value is -1, reset the GUC to its default, meaning it will inherit from
|
||||||
|
* the server config, command line, or role/database settings.
|
||||||
|
*/
|
||||||
|
parsed = parse_int(MySubscription->walrcvtimeout, &val, 0, NULL);
|
||||||
|
if (parsed && val == -1)
|
||||||
|
SetConfigOption("wal_receiver_timeout", NULL,
|
||||||
|
PGC_BACKEND, PGC_S_SESSION);
|
||||||
|
else
|
||||||
|
SetConfigOption("wal_receiver_timeout", MySubscription->walrcvtimeout,
|
||||||
|
PGC_BACKEND, PGC_S_SESSION);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Log the wal_receiver_timeout setting (in milliseconds) as a debug
|
||||||
|
* message when it changes, to verify it was set correctly.
|
||||||
|
*/
|
||||||
|
if (prev_timeout != wal_receiver_timeout)
|
||||||
|
elog(DEBUG1, "logical replication worker for subscription \"%s\" wal_receiver_timeout: %d ms",
|
||||||
|
MySubscription->name, wal_receiver_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback from subscription syscache invalidation.
|
* Callback from subscription syscache invalidation.
|
||||||
*/
|
*/
|
||||||
|
|
@ -5822,6 +5860,9 @@ InitializeLogRepWorker(void)
|
||||||
SetConfigOption("synchronous_commit", MySubscription->synccommit,
|
SetConfigOption("synchronous_commit", MySubscription->synccommit,
|
||||||
PGC_BACKEND, PGC_S_OVERRIDE);
|
PGC_BACKEND, PGC_S_OVERRIDE);
|
||||||
|
|
||||||
|
/* Change wal_receiver_timeout according to the user's wishes */
|
||||||
|
set_wal_receiver_timeout();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keep us informed about subscription or role changes. Note that the
|
* Keep us informed about subscription or role changes. Note that the
|
||||||
* role's superuser privilege can be revoked.
|
* role's superuser privilege can be revoked.
|
||||||
|
|
|
||||||
|
|
@ -5112,6 +5112,7 @@ getSubscriptions(Archive *fout)
|
||||||
int i_subconninfo;
|
int i_subconninfo;
|
||||||
int i_subslotname;
|
int i_subslotname;
|
||||||
int i_subsynccommit;
|
int i_subsynccommit;
|
||||||
|
int i_subwalrcvtimeout;
|
||||||
int i_subpublications;
|
int i_subpublications;
|
||||||
int i_suborigin;
|
int i_suborigin;
|
||||||
int i_suboriginremotelsn;
|
int i_suboriginremotelsn;
|
||||||
|
|
@ -5205,10 +5206,17 @@ getSubscriptions(Archive *fout)
|
||||||
|
|
||||||
if (fout->remoteVersion >= 190000)
|
if (fout->remoteVersion >= 190000)
|
||||||
appendPQExpBufferStr(query,
|
appendPQExpBufferStr(query,
|
||||||
" s.submaxretention\n");
|
" s.submaxretention,\n");
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBuffer(query,
|
||||||
" 0 AS submaxretention\n");
|
" 0 AS submaxretention,\n");
|
||||||
|
|
||||||
|
if (fout->remoteVersion >= 190000)
|
||||||
|
appendPQExpBufferStr(query,
|
||||||
|
" s.subwalrcvtimeout\n");
|
||||||
|
else
|
||||||
|
appendPQExpBufferStr(query,
|
||||||
|
" '-1' AS subwalrcvtimeout\n");
|
||||||
|
|
||||||
appendPQExpBufferStr(query,
|
appendPQExpBufferStr(query,
|
||||||
"FROM pg_subscription s\n");
|
"FROM pg_subscription s\n");
|
||||||
|
|
@ -5247,6 +5255,7 @@ getSubscriptions(Archive *fout)
|
||||||
i_subconninfo = PQfnumber(res, "subconninfo");
|
i_subconninfo = PQfnumber(res, "subconninfo");
|
||||||
i_subslotname = PQfnumber(res, "subslotname");
|
i_subslotname = PQfnumber(res, "subslotname");
|
||||||
i_subsynccommit = PQfnumber(res, "subsynccommit");
|
i_subsynccommit = PQfnumber(res, "subsynccommit");
|
||||||
|
i_subwalrcvtimeout = PQfnumber(res, "subwalrcvtimeout");
|
||||||
i_subpublications = PQfnumber(res, "subpublications");
|
i_subpublications = PQfnumber(res, "subpublications");
|
||||||
i_suborigin = PQfnumber(res, "suborigin");
|
i_suborigin = PQfnumber(res, "suborigin");
|
||||||
i_suboriginremotelsn = PQfnumber(res, "suboriginremotelsn");
|
i_suboriginremotelsn = PQfnumber(res, "suboriginremotelsn");
|
||||||
|
|
@ -5290,6 +5299,8 @@ getSubscriptions(Archive *fout)
|
||||||
pg_strdup(PQgetvalue(res, i, i_subslotname));
|
pg_strdup(PQgetvalue(res, i, i_subslotname));
|
||||||
subinfo[i].subsynccommit =
|
subinfo[i].subsynccommit =
|
||||||
pg_strdup(PQgetvalue(res, i, i_subsynccommit));
|
pg_strdup(PQgetvalue(res, i, i_subsynccommit));
|
||||||
|
subinfo[i].subwalrcvtimeout =
|
||||||
|
pg_strdup(PQgetvalue(res, i, i_subwalrcvtimeout));
|
||||||
subinfo[i].subpublications =
|
subinfo[i].subpublications =
|
||||||
pg_strdup(PQgetvalue(res, i, i_subpublications));
|
pg_strdup(PQgetvalue(res, i, i_subpublications));
|
||||||
subinfo[i].suborigin = pg_strdup(PQgetvalue(res, i, i_suborigin));
|
subinfo[i].suborigin = pg_strdup(PQgetvalue(res, i, i_suborigin));
|
||||||
|
|
@ -5548,6 +5559,9 @@ dumpSubscription(Archive *fout, const SubscriptionInfo *subinfo)
|
||||||
if (strcmp(subinfo->subsynccommit, "off") != 0)
|
if (strcmp(subinfo->subsynccommit, "off") != 0)
|
||||||
appendPQExpBuffer(query, ", synchronous_commit = %s", fmtId(subinfo->subsynccommit));
|
appendPQExpBuffer(query, ", synchronous_commit = %s", fmtId(subinfo->subsynccommit));
|
||||||
|
|
||||||
|
if (strcmp(subinfo->subwalrcvtimeout, "-1") != 0)
|
||||||
|
appendPQExpBuffer(query, ", wal_receiver_timeout = %s", fmtId(subinfo->subwalrcvtimeout));
|
||||||
|
|
||||||
if (pg_strcasecmp(subinfo->suborigin, LOGICALREP_ORIGIN_ANY) != 0)
|
if (pg_strcasecmp(subinfo->suborigin, LOGICALREP_ORIGIN_ANY) != 0)
|
||||||
appendPQExpBuffer(query, ", origin = %s", subinfo->suborigin);
|
appendPQExpBuffer(query, ", origin = %s", subinfo->suborigin);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -722,6 +722,7 @@ typedef struct _SubscriptionInfo
|
||||||
char *subconninfo;
|
char *subconninfo;
|
||||||
char *subslotname;
|
char *subslotname;
|
||||||
char *subsynccommit;
|
char *subsynccommit;
|
||||||
|
char *subwalrcvtimeout;
|
||||||
char *subpublications;
|
char *subpublications;
|
||||||
char *suborigin;
|
char *suborigin;
|
||||||
char *suboriginremotelsn;
|
char *suboriginremotelsn;
|
||||||
|
|
|
||||||
|
|
@ -6806,7 +6806,7 @@ describeSubscriptions(const char *pattern, bool verbose)
|
||||||
printQueryOpt myopt = pset.popt;
|
printQueryOpt myopt = pset.popt;
|
||||||
static const bool translate_columns[] = {false, false, false, false,
|
static const bool translate_columns[] = {false, false, false, false,
|
||||||
false, false, false, false, false, false, false, false, false, false,
|
false, false, false, false, false, false, false, false, false, false,
|
||||||
false, false, false, false};
|
false, false, false, false, false};
|
||||||
|
|
||||||
if (pset.sversion < 100000)
|
if (pset.sversion < 100000)
|
||||||
{
|
{
|
||||||
|
|
@ -6895,6 +6895,11 @@ describeSubscriptions(const char *pattern, bool verbose)
|
||||||
gettext_noop("Synchronous commit"),
|
gettext_noop("Synchronous commit"),
|
||||||
gettext_noop("Conninfo"));
|
gettext_noop("Conninfo"));
|
||||||
|
|
||||||
|
if (pset.sversion >= 190000)
|
||||||
|
appendPQExpBuffer(&buf,
|
||||||
|
", subwalrcvtimeout AS \"%s\"\n",
|
||||||
|
gettext_noop("Receiver timeout"));
|
||||||
|
|
||||||
/* Skip LSN is only supported in v15 and higher */
|
/* Skip LSN is only supported in v15 and higher */
|
||||||
if (pset.sversion >= 150000)
|
if (pset.sversion >= 150000)
|
||||||
appendPQExpBuffer(&buf,
|
appendPQExpBuffer(&buf,
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* yyyymmddN */
|
/* yyyymmddN */
|
||||||
#define CATALOG_VERSION_NO 202602181
|
#define CATALOG_VERSION_NO 202602201
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,9 @@ CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROW
|
||||||
/* Synchronous commit setting for worker */
|
/* Synchronous commit setting for worker */
|
||||||
text subsynccommit BKI_FORCE_NOT_NULL;
|
text subsynccommit BKI_FORCE_NOT_NULL;
|
||||||
|
|
||||||
|
/* wal_receiver_timeout setting for worker */
|
||||||
|
text subwalrcvtimeout BKI_FORCE_NOT_NULL;
|
||||||
|
|
||||||
/* List of publications subscribed to */
|
/* List of publications subscribed to */
|
||||||
text subpublications[1] BKI_FORCE_NOT_NULL;
|
text subpublications[1] BKI_FORCE_NOT_NULL;
|
||||||
|
|
||||||
|
|
@ -155,6 +158,7 @@ typedef struct Subscription
|
||||||
char *conninfo; /* Connection string to the publisher */
|
char *conninfo; /* Connection string to the publisher */
|
||||||
char *slotname; /* Name of the replication slot */
|
char *slotname; /* Name of the replication slot */
|
||||||
char *synccommit; /* Synchronous commit setting for worker */
|
char *synccommit; /* Synchronous commit setting for worker */
|
||||||
|
char *walrcvtimeout; /* wal_receiver_timeout setting for worker */
|
||||||
List *publications; /* List of publication names to subscribe to */
|
List *publications; /* List of publication names to subscribe to */
|
||||||
char *origin; /* Only publish data originating from the
|
char *origin; /* Only publish data originating from the
|
||||||
* specified origin */
|
* specified origin */
|
||||||
|
|
|
||||||
|
|
@ -117,17 +117,17 @@ WARNING: subscription was created, but is not connected
|
||||||
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
||||||
\dRs+ regress_testsub4
|
\dRs+ regress_testsub4
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
------------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
------------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub4 | regress_subscription_user | f | {testpub} | f | parallel | d | f | none | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub4 | regress_subscription_user | f | {testpub} | f | parallel | d | f | none | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub4 SET (origin = any);
|
ALTER SUBSCRIPTION regress_testsub4 SET (origin = any);
|
||||||
\dRs+ regress_testsub4
|
\dRs+ regress_testsub4
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
------------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
------------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub4 | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub4 | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
DROP SUBSCRIPTION regress_testsub3;
|
DROP SUBSCRIPTION regress_testsub3;
|
||||||
|
|
@ -146,9 +146,9 @@ ERROR: invalid connection string syntax: missing "=" after "foobar" in connecti
|
||||||
|
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub SET PUBLICATION testpub2, testpub3 WITH (refresh = false);
|
ALTER SUBSCRIPTION regress_testsub SET PUBLICATION testpub2, testpub3 WITH (refresh = false);
|
||||||
|
|
@ -158,9 +158,9 @@ ALTER SUBSCRIPTION regress_testsub SET (password_required = false);
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (run_as_owner = true);
|
ALTER SUBSCRIPTION regress_testsub SET (run_as_owner = true);
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+------------------------------+------------
|
-----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+------------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | f | t | f | f | 0 | f | off | dbname=regress_doesnotexist2 | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | f | t | f | f | 0 | f | off | dbname=regress_doesnotexist2 | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (password_required = true);
|
ALTER SUBSCRIPTION regress_testsub SET (password_required = true);
|
||||||
|
|
@ -177,9 +177,9 @@ ERROR: unrecognized subscription parameter: "create_slot"
|
||||||
ALTER SUBSCRIPTION regress_testsub SKIP (lsn = '0/12345');
|
ALTER SUBSCRIPTION regress_testsub SKIP (lsn = '0/12345');
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+------------------------------+------------
|
-----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+------------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist2 | 0/00012345
|
regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist2 | -1 | 0/00012345
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- ok - with lsn = NONE
|
-- ok - with lsn = NONE
|
||||||
|
|
@ -189,9 +189,9 @@ ALTER SUBSCRIPTION regress_testsub SKIP (lsn = '0/0');
|
||||||
ERROR: invalid WAL location (LSN): 0/0
|
ERROR: invalid WAL location (LSN): 0/0
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+------------------------------+------------
|
-----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+------------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist2 | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist2 | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
|
|
@ -222,11 +222,15 @@ ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = local);
|
||||||
ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = foobar);
|
ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = foobar);
|
||||||
ERROR: invalid value for parameter "synchronous_commit": "foobar"
|
ERROR: invalid value for parameter "synchronous_commit": "foobar"
|
||||||
HINT: Available values: local, remote_write, remote_apply, on, off.
|
HINT: Available values: local, remote_write, remote_apply, on, off.
|
||||||
|
ALTER SUBSCRIPTION regress_testsub_foo SET (wal_receiver_timeout = '-1');
|
||||||
|
ALTER SUBSCRIPTION regress_testsub_foo SET (wal_receiver_timeout = '80s');
|
||||||
|
ALTER SUBSCRIPTION regress_testsub_foo SET (wal_receiver_timeout = 'foobar');
|
||||||
|
ERROR: invalid value for parameter "wal_receiver_timeout": "foobar"
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
---------------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+------------------------------+------------
|
---------------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+------------------------------+------------------+------------
|
||||||
regress_testsub_foo | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | f | 0 | f | local | dbname=regress_doesnotexist2 | 0/00000000
|
regress_testsub_foo | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | f | 0 | f | local | dbname=regress_doesnotexist2 | 80s | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- rename back to keep the rest simple
|
-- rename back to keep the rest simple
|
||||||
|
|
@ -256,18 +260,18 @@ WARNING: subscription was created, but is not connected
|
||||||
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | t | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | t | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (binary = false);
|
ALTER SUBSCRIPTION regress_testsub SET (binary = false);
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
DROP SUBSCRIPTION regress_testsub;
|
DROP SUBSCRIPTION regress_testsub;
|
||||||
|
|
@ -280,26 +284,26 @@ WARNING: subscription was created, but is not connected
|
||||||
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | on | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | on | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (streaming = parallel);
|
ALTER SUBSCRIPTION regress_testsub SET (streaming = parallel);
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (streaming = false);
|
ALTER SUBSCRIPTION regress_testsub SET (streaming = false);
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | off | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | off | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- fail - publication already exists
|
-- fail - publication already exists
|
||||||
|
|
@ -315,9 +319,9 @@ ALTER SUBSCRIPTION regress_testsub ADD PUBLICATION testpub1, testpub2 WITH (refr
|
||||||
ERROR: publication "testpub1" is already in subscription "regress_testsub"
|
ERROR: publication "testpub1" is already in subscription "regress_testsub"
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-----------------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-----------------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub,testpub1,testpub2} | f | off | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub,testpub1,testpub2} | f | off | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- fail - publication used more than once
|
-- fail - publication used more than once
|
||||||
|
|
@ -333,9 +337,9 @@ ERROR: publication "testpub3" is not in subscription "regress_testsub"
|
||||||
ALTER SUBSCRIPTION regress_testsub DROP PUBLICATION testpub1, testpub2 WITH (refresh = false);
|
ALTER SUBSCRIPTION regress_testsub DROP PUBLICATION testpub1, testpub2 WITH (refresh = false);
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | off | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | off | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
DROP SUBSCRIPTION regress_testsub;
|
DROP SUBSCRIPTION regress_testsub;
|
||||||
|
|
@ -372,18 +376,18 @@ WARNING: subscription was created, but is not connected
|
||||||
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | p | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | p | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- we can alter streaming when two_phase enabled
|
-- we can alter streaming when two_phase enabled
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (streaming = true);
|
ALTER SUBSCRIPTION regress_testsub SET (streaming = true);
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | on | p | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | on | p | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
||||||
|
|
@ -394,9 +398,9 @@ WARNING: subscription was created, but is not connected
|
||||||
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | on | p | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | on | p | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
||||||
|
|
@ -410,17 +414,17 @@ WARNING: subscription was created, but is not connected
|
||||||
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (disable_on_error = true);
|
ALTER SUBSCRIPTION regress_testsub SET (disable_on_error = true);
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | t | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | t | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
||||||
|
|
@ -434,9 +438,9 @@ WARNING: subscription was created, but is not connected
|
||||||
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
||||||
|
|
@ -451,18 +455,18 @@ WARNING: subscription was created, but is not connected
|
||||||
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and alter the subscription to refresh publications.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 1000 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 1000 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- ok
|
-- ok
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (max_retention_duration = 0);
|
ALTER SUBSCRIPTION regress_testsub SET (max_retention_duration = 0);
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Retain dead tuples | Max retention duration | Retention active | Synchronous commit | Conninfo | Receiver timeout | Skip LSN
|
||||||
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------
|
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------------+------------
|
||||||
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | 0/00000000
|
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | f | 0 | f | off | dbname=regress_doesnotexist | -1 | 0/00000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,9 @@ RESET ROLE;
|
||||||
ALTER SUBSCRIPTION regress_testsub RENAME TO regress_testsub_foo;
|
ALTER SUBSCRIPTION regress_testsub RENAME TO regress_testsub_foo;
|
||||||
ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = local);
|
ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = local);
|
||||||
ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = foobar);
|
ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = foobar);
|
||||||
|
ALTER SUBSCRIPTION regress_testsub_foo SET (wal_receiver_timeout = '-1');
|
||||||
|
ALTER SUBSCRIPTION regress_testsub_foo SET (wal_receiver_timeout = '80s');
|
||||||
|
ALTER SUBSCRIPTION regress_testsub_foo SET (wal_receiver_timeout = 'foobar');
|
||||||
|
|
||||||
\dRs+
|
\dRs+
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue