diff options
| author | Michael Paquier | 2012-07-11 01:04:12 +0000 |
|---|---|---|
| committer | Michael Paquier | 2012-07-11 01:04:12 +0000 |
| commit | 700db54f04412e0fc91557d46da2b5a236b264a8 (patch) | |
| tree | 3c590f7c7effbdcd2a9ed5ec95e23c3721b6639f /src | |
| parent | 20f55550d003a0a7beccb91dc86f275bea5018ab (diff) | |
Block GXID generation on standbys
If a node accidentally connects to the Standby and reconnects to the
Master afterwards, it will get an inconsistent GXID value since GTM
Master is not aware of GXIDs generated by GTM Standby.
Patch by Andrei Martsinchyk
Diffstat (limited to 'src')
| -rw-r--r-- | src/gtm/main/gtm_txn.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gtm/main/gtm_txn.c b/src/gtm/main/gtm_txn.c index 44148e06a4..d45a9e2448 100644 --- a/src/gtm/main/gtm_txn.c +++ b/src/gtm/main/gtm_txn.c @@ -505,6 +505,12 @@ GTM_GetGlobalTransactionIdMulti(GTM_TransactionHandle handle[], int txn_count) GTM_TransactionInfo *gtm_txninfo = NULL; int ii; + if (Recovery_IsStandby()) + { + ereport(ERROR, (EINVAL, errmsg("GTM is running in STANDBY mode -- can not issue new transaction ids"))); + return InvalidGlobalTransactionId; + } + GTM_RWLockAcquire(>MTransactions.gt_XidGenLock, GTM_LOCKMODE_WRITE); if (GTMTransactions.gt_gtm_state == GTM_SHUTTING_DOWN) |
