summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2016-01-08 04:21:30 +0000
committerPavan Deolasee2016-10-18 09:24:59 +0000
commit13e4919b54cdcf3b7ea927d266a2347f41ed1ae5 (patch)
treef7f3db862351720904fff3877f28ae956bc6c93d
parent1aebccc3adfc803ea97ffe9ede33f5702450206d (diff)
Fix some protocol issues between GTM and GTM-standby.
-rw-r--r--src/backend/storage/ipc/procarray.c5
-rw-r--r--src/gtm/client/gtm_client.c8
-rw-r--r--src/gtm/main/gtm_txn.c8
-rw-r--r--src/include/gtm/gtm_client.h1
4 files changed, 17 insertions, 5 deletions
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 5c68490a0b..44fd584132 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -3358,8 +3358,9 @@ GetSnapshotFromGlobalSnapshot(Snapshot snapshot)
global_xmin = FirstNormalTransactionId;
if (TransactionIdPrecedes(globalSnapshot.gxmin, global_xmin))
- elog(ERROR, "Snapshot too old - RecentGlobalXmin has already "
- "advanced past the snapshot xmin");
+ elog(ERROR, "Snapshot too old - RecentGlobalXmin (%d) has already "
+ "advanced past the snapshot xmin (%d)",
+ global_xmin, globalSnapshot.gxmin);
memcpy(snapshot->xip, globalSnapshot.gxip,
globalSnapshot.gxcnt * sizeof(TransactionId));
diff --git a/src/gtm/client/gtm_client.c b/src/gtm/client/gtm_client.c
index ea27093b3a..1ac19f4c6f 100644
--- a/src/gtm/client/gtm_client.c
+++ b/src/gtm/client/gtm_client.c
@@ -1980,7 +1980,9 @@ send_failed:
int
bkup_begin_transaction_multi(GTM_Conn *conn, int txn_count,
GlobalTransactionId *gxid, GTM_IsolationLevel *isolevel,
- bool *read_only, uint32 *client_id,
+ bool *read_only,
+ char *txn_global_sessionid[],
+ uint32 *client_id,
GTMProxy_ConnID *txn_connid)
{
int ii;
@@ -1993,11 +1995,13 @@ bkup_begin_transaction_multi(GTM_Conn *conn, int txn_count,
gtmpqPutInt(txn_count, sizeof(int), conn))
goto send_failed;
- for (ii = 0; ii < txn_count; ii++, gxid++)
+ for (ii = 0; ii < txn_count; ii++)
{
if (gtmpqPutInt(gxid[ii], sizeof(GlobalTransactionId), conn) ||
gtmpqPutInt(isolevel[ii], sizeof(GTM_IsolationLevel), conn) ||
gtmpqPutc(read_only[ii], conn) ||
+ gtmpqPutInt(strlen(txn_global_sessionid[ii]) + 1, sizeof(uint32), conn) ||
+ gtmpqPutnchar(txn_global_sessionid[ii], strlen(txn_global_sessionid[ii]) + 1, conn) ||
gtmpqPutInt(client_id[ii], sizeof (uint32), conn) ||
gtmpqPutInt(txn_connid[ii], sizeof(GTMProxy_ConnID), conn))
goto send_failed;
diff --git a/src/gtm/main/gtm_txn.c b/src/gtm/main/gtm_txn.c
index 1fc18e4d48..7db191a393 100644
--- a/src/gtm/main/gtm_txn.c
+++ b/src/gtm/main/gtm_txn.c
@@ -1409,6 +1409,8 @@ GTM_BkupBeginTransactionGetGXIDMulti(GlobalTransactionId *gxid,
(EINVAL,
errmsg("Failed to start %d new transactions", txn_count)));
+ elog(DEBUG2, "GTM_BkupBeginTransactionGetGXIDMulti - count %d", count);
+
//XCPTODO check oldContext = MemoryContextSwitchTo(TopMemoryContext);
GTM_RWLockAcquire(&GTMTransactions.gt_TransArrayLock, GTM_LOCKMODE_WRITE);
@@ -1416,8 +1418,11 @@ GTM_BkupBeginTransactionGetGXIDMulti(GlobalTransactionId *gxid,
{
gtm_txninfo = GTM_HandleToTransactionInfo(txn[ii]);
gtm_txninfo->gti_gxid = gxid[ii];
+ if (global_sessionid[ii])
+ strncpy(gtm_txninfo->gti_global_session_id, global_sessionid[ii],
+ GTM_MAX_SESSION_ID_LEN);
- elog(DEBUG1, "GTM_BkupBeginTransactionGetGXIDMulti: xid(%u), handle(%u)",
+ elog(DEBUG2, "GTM_BkupBeginTransactionGetGXIDMulti: xid(%u), handle(%u)",
gxid[ii], txn[ii]);
/*
@@ -1675,6 +1680,7 @@ retry:
txn_gxid,
txn_isolation_level,
txn_read_only,
+ txn_global_sessionid,
txn_client_id,
txn_connid);
diff --git a/src/include/gtm/gtm_client.h b/src/include/gtm/gtm_client.h
index 1b6517a390..df785e6fa2 100644
--- a/src/include/gtm/gtm_client.h
+++ b/src/include/gtm/gtm_client.h
@@ -231,6 +231,7 @@ int
bkup_begin_transaction_multi(GTM_Conn *conn, int txn_count,
GlobalTransactionId *gxid, GTM_IsolationLevel *isolevel,
bool *read_only,
+ char *txn_global_sessionid[],
uint32 *client_id,
GTMProxy_ConnID *txn_connid);
int