Several fixes for concurrent index builds:
* Use poll() if it is available, or select() otherwise, to efficiently wait on index builds in worker queries to finish. * fix off-by-one error when initially assigning workers * move PQsetnonblocking() calls to setup_workers()
This commit is contained in:
@ -82,7 +82,11 @@ setup_workers(int num_workers)
|
||||
*/
|
||||
elog(DEBUG2, "Setting up worker conn %d", i);
|
||||
|
||||
/* Don't confuse pgut_connections by using pgut_connect() */
|
||||
/* Don't confuse pgut_connections by using pgut_connect()
|
||||
*
|
||||
* XXX: could use PQconnectStart() and PQconnectPoll() to
|
||||
* open these connections in non-blocking manner.
|
||||
*/
|
||||
conn = PQconnectdb(buf.data);
|
||||
if (PQstatus(conn) == CONNECTION_OK)
|
||||
{
|
||||
@ -94,6 +98,15 @@ setup_workers(int num_workers)
|
||||
PQerrorMessage(conn));
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make sure each worker connection can work in non-blocking
|
||||
* mode.
|
||||
*/
|
||||
if (PQsetnonblocking(workers.conns[i], 1))
|
||||
{
|
||||
elog(ERROR, "Unable to set worker connection %d "
|
||||
"non-blocking.", i);
|
||||
}
|
||||
}
|
||||
/* In case we bailed out of setting up all workers, record
|
||||
* how many successful worker conns we actually have.
|
||||
|
Reference in New Issue
Block a user