barrier_desc(StringInfo buf, XLogReaderState *record)
{
char *rec = XLogRecGetData(record);
+#ifdef USE_ASSERT_CHECKING
uint8 info = XLogRecGetInfo(record);
-
Assert(info == XLOG_BARRIER_CREATE);
+#endif
appendStringInfo(buf, "BARRIER %s", rec);
}
if (!is_parallel_worker)
{
#ifdef XCP
- if (!IsConnFromDatanode())
+ if (IsConnFromDatanode())
+ latestXid = InvalidTransactionId;
+ else
#endif
latestXid = RecordTransactionAbort(false);
}
* Compare all fields in Var except varno
*/
bool
-equalVarExceptVarno(const void *a, const void *b)
+static equalVarExceptVarno(const void *a, const void *b)
{
if (a == b)
return true;
"RESET transaction_isolation;";
elog(DEBUG5, "pgxc_node_remote_cleanup_all - handles->co_conn_count %d,"
- "handles->dn_conn_count", handles->co_conn_count,
+ "handles->dn_conn_count %d", handles->co_conn_count,
handles->dn_conn_count);
/*
* We must handle reader and writer connections both since even a read-only
return true;
}
-/*
- * Encode parameter values to format of DataRow message (the same format is
- * used in Bind) to prepare for sending down to Datanodes.
- * The buffer to store encoded value is palloc'ed and returned as the result
- * parameter. Function returns size of the result
- */
-int
-ParamListToDataRow(ParamListInfo params, char** result)
-{
- StringInfoData buf;
- uint16 n16;
- int i;
- int real_num_params = 0;
-
- /*
- * It is necessary to fetch parameters
- * before looking at the output value.
- */
- for (i = 0; i < params->numParams; i++)
- {
- ParamExternData *param;
-
- param = ¶ms->params[i];
-
- if (!OidIsValid(param->ptype) && params->paramFetch != NULL)
- (*params->paramFetch) (params, i + 1);
-
- /*
- * This is the last parameter found as useful, so we need
- * to include all the previous ones to keep silent the remote
- * nodes. All the parameters prior to the last usable having no
- * type available will be considered as NULL entries.
- */
- if (OidIsValid(param->ptype))
- real_num_params = i + 1;
- }
-
- /*
- * If there are no parameters available, simply leave.
- * This is possible in the case of a query called through SPI
- * and using no parameters.
- */
- if (real_num_params == 0)
- {
- *result = NULL;
- return 0;
- }
-
- initStringInfo(&buf);
-
- /* Number of parameter values */
- n16 = htons(real_num_params);
- appendBinaryStringInfo(&buf, (char *) &n16, 2);
-
- /* Parameter values */
- for (i = 0; i < real_num_params; i++)
- {
- ParamExternData *param = ¶ms->params[i];
- uint32 n32;
-
- /*
- * Parameters with no types are considered as NULL and treated as integer
- * The same trick is used for dropped columns for remote DML generation.
- */
- if (param->isnull || !OidIsValid(param->ptype))
- {
- n32 = htonl(-1);
- appendBinaryStringInfo(&buf, (char *) &n32, 4);
- }
- else
- {
- Oid typOutput;
- bool typIsVarlena;
- Datum pval;
- char *pstring;
- int len;
-
- /* Get info needed to output the value */
- getTypeOutputInfo(param->ptype, &typOutput, &typIsVarlena);
-
- /*
- * If we have a toasted datum, forcibly detoast it here to avoid
- * memory leakage inside the type's output routine.
- */
- if (typIsVarlena)
- pval = PointerGetDatum(PG_DETOAST_DATUM(param->value));
- else
- pval = param->value;
-
- /* Convert Datum to string */
- pstring = OidOutputFunctionCall(typOutput, pval);
-
- /* copy data to the buffer */
- len = strlen(pstring);
- n32 = htonl(len);
- appendBinaryStringInfo(&buf, (char *) &n32, 4);
- appendBinaryStringInfo(&buf, pstring, len);
- }
- }
-
- /* Take data from the buffer */
- *result = palloc(buf.len);
- memcpy(*result, buf.data, buf.len);
- pfree(buf.data);
- return buf.len;
-}
-
/*
* Execute utility statement on multiple Datanodes
* It does approximately the same as
for (i = 0; i < 2; i++)
{
- int num_nodes;
+ int num_nodes = 0;
PGXCNodeHandle *array_handles;
switch (i)
/* message length */
int msgLen;
int cnt_params;
+#ifdef USE_ASSERT_CHECKING
size_t old_outEnd = handle->outEnd;
+#endif
/* if there are parameters, param_types should exist */
Assert(num_params <= 0 || param_types);
* we've seen a COMMIT or ABORT command; when we are in abort state, other
* commands are not processed any further than the raw parse stage.
*/
-List *
+static List *
pg_parse_query_internal(const char *query_string, List **querysource_list)
{
List *raw_parsetree_list;
"server, but received %d bytes\n",
msgLength);
- if (gtmpqGetInt(&conn->my_id, 4, conn))
+ if (gtmpqGetInt((int *)&conn->my_id, 4, conn))
{
/* We'll come back when there is more data */
return PGRES_POLLING_READING;
{
GTM_Conn *oldconn = GetMyThreadInfo->thr_conn->standby;
int count = 0;
- GTM_Timestamp timestamp;
+ GTM_Timestamp timestamp = 0;
elog(DEBUG1, "calling bkup_begin_transaction_gxid() for auxiliary transaction for standby GTM %p.",
GetMyThreadInfo->thr_conn->standby);
Server_Message_Level_Options();
-static const struct config_enum_entry gtm_startup_mode_options[] = {
- {"act", GTM_ACT_MODE, false},
- {"standby", GTM_STANDBY_MODE, false},
- {NULL, 0, false}
-};
-
-
/*
* GTM option variables that are exported from this module
*/
static GTM_Conn *ConnectGTM(void);
static void ReleaseCmdBackup(GTMProxy_CommandInfo *cmdinfo);
static void workerThreadReconnectToGTM(void);
+#ifdef USE_ASSERT_CHECKING
static bool IsProxiedMessage(GTM_MessageType mtype);
+#endif
/*
* One-time initialization. It's called immediately after the main process
/* Main thread has nothing to do twith this signal and should not receive this. */
PG_SETMASK(&BlockSig);
- elog(DEBUG1, "Detected SIGUSR2, thread:%ld", MyThreadID);
+ elog(DEBUG1, "Detected SIGUSR2, thread:%ld", (long) MyThreadID);
if (MyThreadID == TopMostThreadID)
{
}
+#ifdef USE_ASSERT_CHECKING
static bool
IsProxiedMessage(GTM_MessageType mtype)
{
return false;
}
}
+#endif
static void
ProcessResponse(GTMProxy_ThreadInfo *thrinfo, GTMProxy_CommandInfo *cmdinfo,
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_COMMIT_MULTI_RESULT, 4);
- pq_sendbytes(&buf, &txn_count, sizeof (int));
- pq_sendbytes(&buf, &status, sizeof (int));
+ pq_sendbytes(&buf, (const char *)&txn_count, sizeof (int));
+ pq_sendbytes(&buf, (const char *)&status, sizeof (int));
pq_endmessage(cmdinfo->ci_conn->con_port, &buf);
pq_flush(cmdinfo->ci_conn->con_port);
}
case MSG_TXN_COMMIT_MULTI:
{
- int txn_count = pq_getmsgint(message, sizeof (int));
- Assert (txn_count == 1);
+ (void) pq_getmsgint(message, sizeof (int));
}
/* fall through */
case MSG_TXN_ROLLBACK:
char proxyname[] = "";
time_t finish_time;
MemoryContext old_mcxt = NULL;
- GlobalTransactionId xmin = InvalidGlobalTransactionId;
if (is_reconnect)
{
extern GlobalTransactionId GTM_GetLatestCompletedXID(void);
extern void SetGlobalTransactionIdLimit(GlobalTransactionId oldest_datfrozenxid);
extern void SetNextGlobalTransactionId(GlobalTransactionId gxid);
+extern void SetControlXid(GlobalTransactionId gxid);
extern void GTM_SetShuttingDown(void);
/* For restoration point backup */
/* Functions to start cluster monitor process, called from postmaster */
int ClusterMonitorInit(void);
extern int StartClusterMonitor(void);
-GlobalTransactionId ClusterMonitorGetGlobalXmin(void);
-void ClusterMonitorSetGlobalXmin(GlobalTransactionId xmin);
+extern GlobalTransactionId ClusterMonitorGetGlobalXmin(void);
+extern void ClusterMonitorSetGlobalXmin(GlobalTransactionId xmin);
+extern GlobalTransactionId ClusterMonitorGetReportingGlobalXmin(void);
#ifdef EXEC_BACKEND
extern void ClusterMonitorIAm(void);
extern Datum pgxc_is_committed(PG_FUNCTION_ARGS);
extern Datum pgxc_is_inprogress(PG_FUNCTION_ARGS);
#endif
-#ifdef USE_MODULE_MSGIDS
extern Datum pg_msgmodule_set(PG_FUNCTION_ARGS);
extern Datum pg_msgmodule_change(PG_FUNCTION_ARGS);
extern Datum pg_msgmodule_enable(PG_FUNCTION_ARGS);
extern Datum pg_msgmodule_disable(PG_FUNCTION_ARGS);
extern Datum pg_msgmodule_enable_all(PG_FUNCTION_ARGS);
extern Datum pg_msgmodule_disable_all(PG_FUNCTION_ARGS);
-#endif
#endif /* BUILTINS_H */