195 pg_fatal(
"failed to create connection with connection string: \"%s\"",
333 fd_set save_input = *
input;
334 fd_set save_output = *
output;
349 if (
i < 0 && errno ==
EINTR)
352 if (
i == SOCKET_ERROR && WSAGetLastError() == WSAEINTR)
373 for (
int i = 0;
i < numslots;
i++)
395 if (slots[
i].sock < 0)
397 FD_SET(slots[
i].sock, slots[
i].select_mode ? &
input : &
output);
398 maxFd =
Max(maxFd, slots[
i].sock);
410 for (
int i = 0;
i < numslots;
i++)
411 slots[
i].ready |= (FD_ISSET(slots[
i].sock, &
input) ||
412 FD_ISSET(slots[
i].sock, &
output));
431 for (
int i = 0;
i < jobs;
i++)
432 slots[
i].ready =
true;
434 while (dbs_complete < cluster->dbarr.ndbs)
436 for (
int i = 0;
i < jobs;
i++)
void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel)
#define ALWAYS_SECURE_SEARCH_PATH_SQL
static void PGresult * res
PGconn * PQconnectStart(const char *conninfo)
PostgresPollingStatusType PQconnectPoll(PGconn *conn)
char * PQerrorMessage(const PGconn *conn)
ConnStatusType PQstatus(const PGconn *conn)
void PQfinish(PGconn *conn)
int PQsocket(const PGconn *conn)
ExecStatusType PQresultStatus(const PGresult *res)
int PQconsumeInput(PGconn *conn)
int PQsendQuery(PGconn *conn, const char *query)
int PQisBusy(PGconn *conn)
PGresult * PQgetResult(PGconn *conn)
void * pg_realloc(void *ptr, size_t size)
void * pg_malloc0(size_t size)
PostgresPollingStatusType
static struct LogicalRepInfo * dbinfo
void(* UpgradeTaskProcessCB)(DbInfo *dbinfo, PGresult *res, void *arg)
PQExpBuffer createPQExpBuffer(void)
void initPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void destroyPQExpBuffer(PQExpBuffer str)
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
void termPQExpBuffer(PQExpBuffer str)
void appendConnStrVal(PQExpBuffer buf, const char *str)
UpgradeTaskSlotState state
UpgradeTaskProcessCB process_cb
static int dbs_processing
static void wait_on_slots(UpgradeTaskSlot *slots, int numslots)
struct UpgradeTaskSlot UpgradeTaskSlot
struct UpgradeTaskStep UpgradeTaskStep
UpgradeTask * upgrade_task_create(void)
void upgrade_task_run(const UpgradeTask *task, const ClusterInfo *cluster)
static void process_slot(const ClusterInfo *cluster, UpgradeTaskSlot *slot, const UpgradeTask *task)
static void start_conn(const ClusterInfo *cluster, UpgradeTaskSlot *slot)
static int select_loop(int maxFd, fd_set *input, fd_set *output)
void upgrade_task_free(UpgradeTask *task)
static void process_query_result(const ClusterInfo *cluster, UpgradeTaskSlot *slot, const UpgradeTask *task)
void upgrade_task_add_step(UpgradeTask *task, const char *query, UpgradeTaskProcessCB process_cb, bool free_result, void *arg)
#define select(n, r, w, e, timeout)