Skip to content

Commit 4586a37

Browse files
committed
Define constant for precommitted state
1 parent 37624c4 commit 4586a37

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

contrib/mmts/multimaster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ MtmVotingCompleted(MtmTransState* ts)
974974
return true;
975975
} else if (MtmUseDtm) {
976976
ts->votedMask = 0;
977-
SetPrepareTransactionState(ts->gid, "precommitted");
977+
SetPrepareTransactionState(ts->gid, MULTIMASTER_PRECOMMITTED);
978978
//MtmSend2PCMessage(ts, MSG_PRECOMMIT);
979979
return false;
980980
} else {
@@ -1130,7 +1130,7 @@ MtmCommitPreparedTransaction(MtmCurrentTrans* x)
11301130
ts->votedMask = 0;
11311131
ts->procno = MyProc->pgprocno;
11321132
MTM_TXTRACE(ts, "Coordinator sends MSG_PRECOMMIT");
1133-
SetPrepareTransactionState(ts->gid, "precommitted");
1133+
SetPrepareTransactionState(ts->gid, MULTIMASTER_PRECOMMITTED);
11341134
//MtmSend2PCMessage(ts, MSG_PRECOMMIT);
11351135

11361136
Mtm2PCVoting(x, ts);
@@ -1372,7 +1372,7 @@ static void MtmLoadPreparedTransactions(void)
13721372
Mtm->nActiveTransactions += 1;
13731373
ts->isEnqueued = false;
13741374
ts->isActive = true;
1375-
ts->status = strcmp(pxacts[i].state_3pc, "precommitted") == 0 ? TRANSACTION_STATUS_UNKNOWN : TRANSACTION_STATUS_IN_PROGRESS;
1375+
ts->status = strcmp(pxacts[i].state_3pc, MULTIMASTER_PRECOMMITTED) == 0 ? TRANSACTION_STATUS_UNKNOWN : TRANSACTION_STATUS_IN_PROGRESS;
13761376
ts->isLocal = true;
13771377
ts->isPrepared = false;
13781378
ts->isPinned = false;

contrib/mmts/multimaster.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010
#include "commands/vacuum.h"
1111
#include "libpq-fe.h"
1212

13+
#ifndef DEBUG_LEVEL
1314
#define DEBUG_LEVEL 0
14-
#define MTM_TRACE 1
15+
#endif
16+
17+
#ifndef MTM_TRACE
18+
#define MTM_TRACE 0
19+
#endif
1520

1621
#if DEBUG_LEVEL == 0
1722
#define MTM_LOG1(fmt, ...) elog(LOG, fmt, ## __VA_ARGS__)
@@ -35,7 +40,7 @@
3540
#define MTM_LOG4(fmt, ...) fprintf(stderr, fmt "\n", ## __VA_ARGS__)
3641
#endif
3742

38-
#ifndef MTM_TRACE
43+
#if MTM_TRACE
3944
#define MTM_TXTRACE(tx, event)
4045
#else
4146
#define MTM_TXTRACE(tx, event) \
@@ -58,6 +63,7 @@
5863
#define MULTIMASTER_LOCK_BUF_INIT_SIZE 4096
5964
#define MULTIMASTER_BROADCAST_SERVICE "mtm_broadcast"
6065
#define MULTIMASTER_ADMIN "mtm_admin"
66+
#define MULTIMASTER_PRECOMMITTED "precommitted"
6167

6268
#define MULTIMASTER_DEFAULT_ARBITER_PORT 5433
6369

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy