aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/launcher.c
diff options
context:
space:
mode:
authorNathan Bossart <nathan@postgresql.org>2023-09-25 14:12:43 -0700
committerNathan Bossart <nathan@postgresql.org>2023-09-25 14:12:43 -0700
commit13aeaf0797e75a0c53abb66ac907ba14b4e47f6b (patch)
treebfcbbcbcae98f6428545c492ae5be6206f25bdc3 /src/backend/replication/logical/launcher.c
parent849d367ff9a2875d4906fa110472462c4c95fad0 (diff)
downloadpostgresql-13aeaf0797e75a0c53abb66ac907ba14b4e47f6b.tar.gz
postgresql-13aeaf0797e75a0c53abb66ac907ba14b4e47f6b.zip
Add worker type to pg_stat_subscription.
Thanks to commit 2a8b40e368, the logical replication worker type is easily determined. The worker type could already be deduced via other columns such as leader_pid and relid, but that is unnecessary complexity for users. Bumps catversion. Author: Peter Smith Reviewed-by: Michael Paquier, Maxim Orlov, Amit Kapila Discussion: https://postgr.es/m/CAHut%2BPtmbSMfErSk0S7xxVdZJ9XVE3xVLhqBTmT91kf57BeKDQ%40mail.gmail.com
Diffstat (limited to 'src/backend/replication/logical/launcher.c')
-rw-r--r--src/backend/replication/logical/launcher.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index 7882fc91ce6..501910b4454 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -1278,7 +1278,7 @@ GetLeaderApplyWorkerPid(pid_t pid)
Datum
pg_stat_get_subscription(PG_FUNCTION_ARGS)
{
-#define PG_STAT_GET_SUBSCRIPTION_COLS 9
+#define PG_STAT_GET_SUBSCRIPTION_COLS 10
Oid subid = PG_ARGISNULL(0) ? InvalidOid : PG_GETARG_OID(0);
int i;
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
@@ -1339,6 +1339,22 @@ pg_stat_get_subscription(PG_FUNCTION_ARGS)
else
values[8] = TimestampTzGetDatum(worker.reply_time);
+ switch (worker.type)
+ {
+ case WORKERTYPE_APPLY:
+ values[9] = CStringGetTextDatum("apply");
+ break;
+ case WORKERTYPE_PARALLEL_APPLY:
+ values[9] = CStringGetTextDatum("parallel apply");
+ break;
+ case WORKERTYPE_TABLESYNC:
+ values[9] = CStringGetTextDatum("table synchronization");
+ break;
+ case WORKERTYPE_UNKNOWN:
+ /* Should never happen. */
+ elog(ERROR, "unknown worker type");
+ }
+
tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc,
values, nulls);