Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb963913

Browse files
committed
pg_createsubscriber: Remove replication slot check on primary
It used to check if the replication slot exists and is active onprimary. This check might fail on slow hosts because the replicationslot might not be active at the time of this check.The current code obtains the replication slot name from theprimary_slot_name on standby and assumes the replication slot existsand is active on primary. If it doesn't exist, this tool will log anerror and continue.Author: Euler Taveira <euler.taveira@enterprisedb.com>Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>Discussion:https://www.postgresql.org/message-id/776c5cac-5ef5-4001-b1bc-5b698bc0c62a%40app.fastmail.com
1 parent04c8634 commitb963913

File tree

1 file changed

+1
-47
lines changed

1 file changed

+1
-47
lines changed

‎src/bin/pg_basebackup/pg_createsubscriber.c

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -879,47 +879,6 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
879879
pg_log_debug("publisher: max_wal_senders: %d",max_walsenders);
880880
pg_log_debug("publisher: current wal senders: %d",cur_walsenders);
881881

882-
/*
883-
* If standby sets primary_slot_name, check if this replication slot is in
884-
* use on primary for WAL retention purposes. This replication slot has no
885-
* use after the transformation, hence, it will be removed at the end of
886-
* this process.
887-
*/
888-
if (primary_slot_name)
889-
{
890-
PQExpBufferstr=createPQExpBuffer();
891-
char*psn_esc=PQescapeLiteral(conn,primary_slot_name,strlen(primary_slot_name));
892-
893-
appendPQExpBuffer(str,
894-
"SELECT 1 FROM pg_catalog.pg_replication_slots "
895-
"WHERE active AND slot_name = %s",
896-
psn_esc);
897-
898-
pg_free(psn_esc);
899-
900-
pg_log_debug("command is: %s",str->data);
901-
902-
res=PQexec(conn,str->data);
903-
if (PQresultStatus(res)!=PGRES_TUPLES_OK)
904-
{
905-
pg_log_error("could not obtain replication slot information: %s",
906-
PQresultErrorMessage(res));
907-
disconnect_database(conn, true);
908-
}
909-
910-
if (PQntuples(res)!=1)
911-
{
912-
pg_log_error("could not obtain replication slot information: got %d rows, expected %d row",
913-
PQntuples(res),1);
914-
disconnect_database(conn, true);
915-
}
916-
else
917-
pg_log_info("primary has replication slot \"%s\"",
918-
primary_slot_name);
919-
920-
PQclear(res);
921-
}
922-
923882
disconnect_database(conn, false);
924883

925884
if (strcmp(wal_level,"logical")!=0)
@@ -2061,12 +2020,7 @@ main(int argc, char **argv)
20612020
/* Check if the standby server is ready for logical replication */
20622021
check_subscriber(dbinfo);
20632022

2064-
/*
2065-
* Check if the primary server is ready for logical replication. This
2066-
* routine checks if a replication slot is in use on primary so it relies
2067-
* on check_subscriber() to obtain the primary_slot_name. That's why it is
2068-
* called after it.
2069-
*/
2023+
/* Check if the primary server is ready for logical replication */
20702024
check_publisher(dbinfo);
20712025

20722026
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp