Fix Windows crash in multi_copy test

Without this change we crash on Windows with COPYing into a table with
62 shards, and we ERROR when COPYing into a table with >62 shards:

ERROR: WaitForMutipleObjects() failed: error code 87
pull/2071/merge
Brian Cloutier 2018-04-11 11:25:07 -07:00 committed by Brian Cloutier
parent d02f761d8e
commit b0b130f064
1 changed files with 7 additions and 3 deletions

View File

@ -992,13 +992,17 @@ BuildWaitEventSet(MultiConnection **allConnections, int totalConnectionCount,
WaitEventSet *waitEventSet = NULL; WaitEventSet *waitEventSet = NULL;
int connectionIndex = 0; int connectionIndex = 0;
/* we subtract 2 to make room for the WL_POSTMASTER_DEATH and WL_LATCH_SET events */ /*
if (pendingConnectionCount > FD_SETSIZE - 2) * subtract 3 to make room for WL_POSTMASTER_DEATH, WL_LATCH_SET, and
* pgwin32_signal_event.
*/
if (pendingConnectionCount > FD_SETSIZE - 3)
{ {
pendingConnectionCount = FD_SETSIZE - 2; pendingConnectionCount = FD_SETSIZE - 3;
} }
/* allocate pending connections + 2 for the signal latch and postmaster death */ /* allocate pending connections + 2 for the signal latch and postmaster death */
/* (CreateWaitEventSet makes room for pgwin32_signal_event automatically) */
waitEventSet = CreateWaitEventSet(CurrentMemoryContext, pendingConnectionCount + 2); waitEventSet = CreateWaitEventSet(CurrentMemoryContext, pendingConnectionCount + 2);
for (connectionIndex = 0; connectionIndex < pendingConnectionCount; connectionIndex++) for (connectionIndex = 0; connectionIndex < pendingConnectionCount; connectionIndex++)