diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2021-05-12 19:13:54 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2021-05-12 19:13:54 -0400 |
commit | b0e6e08b1981ebcdb2f3e7576de7ed0d004cfc16 (patch) | |
tree | 1cf155dd6689436a56148b96f83dcd0df184e688 /src/backend/replication/logical/tablesync.c | |
parent | fae98e3293de89f2fe8fc6e7c196d351378ce80e (diff) | |
download | postgresql-b0e6e08b1981ebcdb2f3e7576de7ed0d004cfc16.tar.gz postgresql-b0e6e08b1981ebcdb2f3e7576de7ed0d004cfc16.zip |
Rename the logical replication global "wrconn"
The worker.c global wrconn is only meant to be used by logical apply/
tablesync workers, but there are other variables with the same name. To
reduce future confusion rename the global from "wrconn" to
"LogRepWorkerWalRcvConn".
While this is just cosmetic, it seems better to backpatch it all the way
back to 10 where this code appeared, to avoid future backpatching
issues.
Author: Peter Smith <smithpb2250@gmail.com>
Discussion: https://postgr.es/m/CAHut+Pu7Jv9L2BOEx_Z0UtJxfDevQSAUW2mJqWU+CtmDrEZVAg@mail.gmail.com
Diffstat (limited to 'src/backend/replication/logical/tablesync.c')
-rw-r--r-- | src/backend/replication/logical/tablesync.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c index acc6498567d..14f69a6338e 100644 --- a/src/backend/replication/logical/tablesync.c +++ b/src/backend/replication/logical/tablesync.c @@ -303,7 +303,7 @@ process_syncing_tables_for_sync(XLogRecPtr current_lsn) MyLogicalRepWorker->relstate, MyLogicalRepWorker->relstate_lsn); - walrcv_endstreaming(wrconn, &tli); + walrcv_endstreaming(LogRepWorkerWalRcvConn, &tli); finish_sync_worker(); } else @@ -600,7 +600,7 @@ copy_read_data(void *outbuf, int minread, int maxread) for (;;) { /* Try read the data. */ - len = walrcv_receive(wrconn, &buf, &fd); + len = walrcv_receive(LogRepWorkerWalRcvConn, &buf, &fd); CHECK_FOR_INTERRUPTS(); @@ -678,7 +678,8 @@ fetch_remote_table_info(char *nspname, char *relname, " AND c.relkind = 'r'", quote_literal_cstr(nspname), quote_literal_cstr(relname)); - res = walrcv_exec(wrconn, cmd.data, 2, tableRow); + res = walrcv_exec(LogRepWorkerWalRcvConn, cmd.data, + lengthof(tableRow), tableRow); if (res->status != WALRCV_OK_TUPLES) ereport(ERROR, @@ -714,7 +715,8 @@ fetch_remote_table_info(char *nspname, char *relname, " AND a.attrelid = %u" " ORDER BY a.attnum", lrel->remoteid, lrel->remoteid); - res = walrcv_exec(wrconn, cmd.data, 4, attrRow); + res = walrcv_exec(LogRepWorkerWalRcvConn, cmd.data, + lengthof(attrRow), attrRow); if (res->status != WALRCV_OK_TUPLES) ereport(ERROR, @@ -784,7 +786,7 @@ copy_table(Relation rel) initStringInfo(&cmd); appendStringInfo(&cmd, "COPY %s TO STDOUT", quote_qualified_identifier(lrel.nspname, lrel.relname)); - res = walrcv_exec(wrconn, cmd.data, 0, NULL); + res = walrcv_exec(LogRepWorkerWalRcvConn, cmd.data, 0, NULL); pfree(cmd.data); if (res->status != WALRCV_OK_COPY_OUT) ereport(ERROR, @@ -850,8 +852,9 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos) * application_name, so that it is different from the main apply worker, * so that synchronous replication can distinguish them. */ - wrconn = walrcv_connect(MySubscription->conninfo, true, slotname, &err); - if (wrconn == NULL) + LogRepWorkerWalRcvConn = walrcv_connect(MySubscription->conninfo, true, + slotname, &err); + if (LogRepWorkerWalRcvConn == NULL) ereport(ERROR, (errmsg("could not connect to the publisher: %s", err))); @@ -896,7 +899,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos) * inside the transaction so that we can use the snapshot made * by the slot to get existing data. */ - res = walrcv_exec(wrconn, + res = walrcv_exec(LogRepWorkerWalRcvConn, "BEGIN READ ONLY ISOLATION LEVEL " "REPEATABLE READ", 0, NULL); if (res->status != WALRCV_OK_COMMAND) @@ -913,14 +916,14 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos) * that is consistent with the lsn used by the slot to start * decoding. */ - walrcv_create_slot(wrconn, slotname, true, + walrcv_create_slot(LogRepWorkerWalRcvConn, slotname, true, CRS_USE_SNAPSHOT, origin_startpos); PushActiveSnapshot(GetTransactionSnapshot()); copy_table(rel); PopActiveSnapshot(); - res = walrcv_exec(wrconn, "COMMIT", 0, NULL); + res = walrcv_exec(LogRepWorkerWalRcvConn, "COMMIT", 0, NULL); if (res->status != WALRCV_OK_COMMAND) ereport(ERROR, (errmsg("table copy could not finish transaction on publisher"), |