Skip to content

Commit cafa747

Browse files
committed
Don't raise ERROR in broadcast to actually handle error later.
Also, gid format reformatted.
1 parent 0fc77b2 commit cafa747

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

contrib/postgres_fdw/connection.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ BroadcastStmt(char const * sql, unsigned expectedStatus,
719719
PGresult *res = PQgetResult(entry->conn);
720720

721721
elog(WARNING, "Failed to send command %s", sql);
722-
pgfdw_report_error(ERROR, res, entry->conn, true, sql);
722+
pgfdw_report_error(WARNING, res, entry->conn, true, sql);
723723
PQclear(res);
724724
}
725725
}
@@ -818,11 +818,13 @@ pgfdw_xact_callback(XactEvent event, void *arg)
818818
bool res;
819819
char *sql;
820820

821-
fdwTransState->gid = psprintf("fdw:%llx:%lld:%d:%d",
822-
(long long) GetSystemIdentifier(),
823-
(long long) GetCurrentTimestamp(),
824-
MyProcPid,
825-
++two_phase_xact_count);
821+
fdwTransState->gid = psprintf("fdw:%lld:%llx:%u:%d:%d:%d",
822+
(long long) GetCurrentTimestamp(),
823+
(long long) GetSystemIdentifier(),
824+
GetCurrentTransactionIdIfAny(),
825+
fdwTransState->nparticipants,
826+
MyProcPid,
827+
++two_phase_xact_count);
826828

827829
/* Broadcast PREPARE */
828830
sql = psprintf("PREPARE TRANSACTION '%s'", fdwTransState->gid);
@@ -841,7 +843,7 @@ pgfdw_xact_callback(XactEvent event, void *arg)
841843
goto error;
842844

843845
/* select maximal global csn */
844-
if (my_csn > max_csn)
846+
if (include_local_tx && my_csn > max_csn)
845847
max_csn = my_csn;
846848

847849
/* Broadcast pg_global_snaphot_assign() */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy