Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit aa6d5cf

Browse files
knizhnikkelvich
authored andcommitted
Define constant for precommitted state
1 parent 8ba9bd3 commit aa6d5cf

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

multimaster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ MtmVotingCompleted(MtmTransState* ts)
975975
return true;
976976
} else if (MtmUseDtm) {
977977
ts->votedMask = 0;
978-
SetPrepareTransactionState(ts->gid, "precommitted");
978+
SetPrepareTransactionState(ts->gid, MULTIMASTER_PRECOMMITTED);
979979
//MtmSend2PCMessage(ts, MSG_PRECOMMIT);
980980
return false;
981981
} else {
@@ -1131,7 +1131,7 @@ MtmCommitPreparedTransaction(MtmCurrentTrans* x)
11311131
ts->votedMask = 0;
11321132
ts->procno = MyProc->pgprocno;
11331133
MTM_TXTRACE(ts, "Coordinator sends MSG_PRECOMMIT");
1134-
SetPrepareTransactionState(ts->gid, "precommitted");
1134+
SetPrepareTransactionState(ts->gid, MULTIMASTER_PRECOMMITTED);
11351135
//MtmSend2PCMessage(ts, MSG_PRECOMMIT);
11361136

11371137
Mtm2PCVoting(x, ts);
@@ -1374,7 +1374,7 @@ static void MtmLoadPreparedTransactions(void)
13741374
Mtm->nActiveTransactions += 1;
13751375
ts->isEnqueued = false;
13761376
ts->isActive = true;
1377-
ts->status = strcmp(pxacts[i].state_3pc, "precommitted") == 0 ? TRANSACTION_STATUS_UNKNOWN : TRANSACTION_STATUS_IN_PROGRESS;
1377+
ts->status = strcmp(pxacts[i].state_3pc, MULTIMASTER_PRECOMMITTED) == 0 ? TRANSACTION_STATUS_UNKNOWN : TRANSACTION_STATUS_IN_PROGRESS;
13781378
ts->isLocal = true;
13791379
ts->isPrepared = false;
13801380
ts->isPinned = false;

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)