|
26 | 26 | #include "miscadmin.h" |
27 | 27 | #include "pgstat.h" |
28 | 28 | #include "postgres_fdw.h" |
29 | | -#include "storage/latch.h" |
| 29 | +#include "storage/interrupt.h" |
30 | 30 | #include "utils/builtins.h" |
31 | 31 | #include "utils/hsearch.h" |
32 | 32 | #include "utils/inval.h" |
@@ -740,8 +740,8 @@ do_sql_command_end(PGconn *conn, const char *sql, bool consume_input) |
740 | 740 | /* |
741 | 741 | * If requested, consume whatever data is available from the socket. (Note |
742 | 742 | * that if all data is available, this allows pgfdw_get_result to call |
743 | | - * PQgetResult without forcing the overhead of WaitLatchOrSocket, which |
744 | | - * would be large compared to the overhead of PQconsumeInput.) |
| 743 | + * PQgetResult without forcing the overhead of WaitInterruptOrSocket, |
| 744 | + * which would be large compared to the overhead of PQconsumeInput.) |
745 | 745 | */ |
746 | 746 | if (consume_input && !PQconsumeInput(conn)) |
747 | 747 | pgfdw_report_error(ERROR, NULL, conn, false, sql); |
@@ -1384,7 +1384,7 @@ pgfdw_cancel_query_end(PGconn *conn, TimestampTz endtime, |
1384 | 1384 | /* |
1385 | 1385 | * If requested, consume whatever data is available from the socket. (Note |
1386 | 1386 | * that if all data is available, this allows pgfdw_get_cleanup_result to |
1387 | | - * call PQgetResult without forcing the overhead of WaitLatchOrSocket, |
| 1387 | + * call PQgetResult without forcing the overhead of WaitInterruptOrSocket, |
1388 | 1388 | * which would be large compared to the overhead of PQconsumeInput.) |
1389 | 1389 | */ |
1390 | 1390 | if (consume_input && !PQconsumeInput(conn)) |
@@ -1479,7 +1479,7 @@ pgfdw_exec_cleanup_query_end(PGconn *conn, const char *query, |
1479 | 1479 | /* |
1480 | 1480 | * If requested, consume whatever data is available from the socket. (Note |
1481 | 1481 | * that if all data is available, this allows pgfdw_get_cleanup_result to |
1482 | | - * call PQgetResult without forcing the overhead of WaitLatchOrSocket, |
| 1482 | + * call PQgetResult without forcing the overhead of WaitInterruptOrSocket, |
1483 | 1483 | * which would be large compared to the overhead of PQconsumeInput.) |
1484 | 1484 | */ |
1485 | 1485 | if (consume_input && !PQconsumeInput(conn)) |
@@ -1592,12 +1592,12 @@ pgfdw_get_cleanup_result(PGconn *conn, TimestampTz endtime, |
1592 | 1592 | pgfdw_we_cleanup_result = WaitEventExtensionNew("PostgresFdwCleanupResult"); |
1593 | 1593 |
|
1594 | 1594 | /* Sleep until there's something to do */ |
1595 | | - wc = WaitLatchOrSocket(MyLatch, |
1596 | | - WL_LATCH_SET | WL_SOCKET_READABLE | |
1597 | | - WL_TIMEOUT | WL_EXIT_ON_PM_DEATH, |
1598 | | - PQsocket(conn), |
1599 | | - cur_timeout, pgfdw_we_cleanup_result); |
1600 | | - ResetLatch(MyLatch); |
| 1595 | + wc = WaitInterruptOrSocket(1 << INTERRUPT_GENERAL, |
| 1596 | + WL_INTERRUPT | WL_SOCKET_READABLE | |
| 1597 | + WL_TIMEOUT | WL_EXIT_ON_PM_DEATH, |
| 1598 | + PQsocket(conn), |
| 1599 | + cur_timeout, pgfdw_we_cleanup_result); |
| 1600 | + ClearInterrupt(INTERRUPT_GENERAL); |
1601 | 1601 |
|
1602 | 1602 | CHECK_FOR_INTERRUPTS(); |
1603 | 1603 |
|
|
0 commit comments