mirror of https://github.com/citusdata/citus.git
Fix wait_until_metadata_sync() for postgres 12.
Postgres 12 now has an assertion that the calls to WaitLatchOrSocket handle postmaster death.pull/3020/head
parent
06faba91c0
commit
48078a30e6
|
@ -84,6 +84,7 @@ wait_until_metadata_sync(PG_FUNCTION_ARGS)
|
||||||
ListCell *workerCell = NULL;
|
ListCell *workerCell = NULL;
|
||||||
bool waitNotifications = false;
|
bool waitNotifications = false;
|
||||||
MultiConnection *connection = NULL;
|
MultiConnection *connection = NULL;
|
||||||
|
int waitFlags = 0;
|
||||||
|
|
||||||
foreach(workerCell, workerList)
|
foreach(workerCell, workerList)
|
||||||
{
|
{
|
||||||
|
@ -112,9 +113,14 @@ wait_until_metadata_sync(PG_FUNCTION_ARGS)
|
||||||
"localhost", PostPortNumber);
|
"localhost", PostPortNumber);
|
||||||
ExecuteCriticalRemoteCommand(connection, "LISTEN " METADATA_SYNC_CHANNEL);
|
ExecuteCriticalRemoteCommand(connection, "LISTEN " METADATA_SYNC_CHANNEL);
|
||||||
|
|
||||||
waitResult = WaitLatchOrSocket(NULL, WL_SOCKET_READABLE | WL_TIMEOUT,
|
waitFlags = WL_SOCKET_READABLE | WL_TIMEOUT | WL_POSTMASTER_DEATH;
|
||||||
PQsocket(connection->pgConn), timeout, 0);
|
waitResult = WaitLatchOrSocket(NULL, waitFlags, PQsocket(connection->pgConn),
|
||||||
if (waitResult & WL_SOCKET_MASK)
|
timeout, 0);
|
||||||
|
if (waitResult & WL_POSTMASTER_DEATH)
|
||||||
|
{
|
||||||
|
ereport(ERROR, (errmsg("postmaster was shut down, exiting")));
|
||||||
|
}
|
||||||
|
else if (waitResult & WL_SOCKET_MASK)
|
||||||
{
|
{
|
||||||
ClearResults(connection, true);
|
ClearResults(connection, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -705,7 +705,9 @@ SELECT
|
||||||
FROM
|
FROM
|
||||||
distributed_table, all_data
|
distributed_table, all_data
|
||||||
WHERE
|
WHERE
|
||||||
distributed_table.key = all_data.key AND distributed_table.key = 1 AND EXISTS (SELECT * FROM all_data);
|
distributed_table.key = all_data.key AND distributed_table.key = 1
|
||||||
|
-- the following is to avoid CTE inlining
|
||||||
|
AND EXISTS (SELECT * FROM all_data);
|
||||||
count
|
count
|
||||||
-------
|
-------
|
||||||
1
|
1
|
||||||
|
|
|
@ -691,7 +691,9 @@ SELECT
|
||||||
FROM
|
FROM
|
||||||
distributed_table, all_data
|
distributed_table, all_data
|
||||||
WHERE
|
WHERE
|
||||||
distributed_table.key = all_data.key AND distributed_table.key = 1 AND EXISTS (SELECT * FROM all_data);
|
distributed_table.key = all_data.key AND distributed_table.key = 1
|
||||||
|
-- the following is to avoid CTE inlining
|
||||||
|
AND EXISTS (SELECT * FROM all_data);
|
||||||
count
|
count
|
||||||
-------
|
-------
|
||||||
1
|
1
|
||||||
|
|
|
@ -425,7 +425,9 @@ SELECT
|
||||||
FROM
|
FROM
|
||||||
distributed_table, all_data
|
distributed_table, all_data
|
||||||
WHERE
|
WHERE
|
||||||
distributed_table.key = all_data.key AND distributed_table.key = 1 AND EXISTS (SELECT * FROM all_data);
|
distributed_table.key = all_data.key AND distributed_table.key = 1
|
||||||
|
-- the following is to avoid CTE inlining
|
||||||
|
AND EXISTS (SELECT * FROM all_data);
|
||||||
|
|
||||||
|
|
||||||
-- get ready for the next commands
|
-- get ready for the next commands
|
||||||
|
|
Loading…
Reference in New Issue