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

Commit 215fbb1

Browse files
knizhnikkelvich
authored andcommitted
Fix bugs in 3PC implementation
1 parent 0a3c6c0 commit 215fbb1

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

multimaster.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,7 @@ void MtmSend2PCMessage(MtmTransState* ts, MtmMessageCode cmd)
13111311

13121312
if (MtmIsCoordinator(ts)) {
13131313
int i;
1314+
Assert(false); // All broadcasts are now done through logical decoding
13141315
for (i = 0; i < Mtm->nAllNodes; i++)
13151316
{
13161317
if (BIT_CHECK(ts->participantsMask & ~Mtm->disabledNodeMask & ~ts->votedMask, i))
@@ -3228,9 +3229,10 @@ bool MtmFilterTransaction(char* record, int size)
32283229
origin_node != 0 &&
32293230
(Mtm->status == MTM_RECOVERY || origin_node == replication_node));
32303231

3231-
switch(PGLOGICAL_XACT_EVENT(flags))
3232+
switch (PGLOGICAL_XACT_EVENT(flags))
32323233
{
32333234
case PGLOGICAL_PREPARE:
3235+
case PGLOGICAL_PRECOMMIT_PREPARED:
32343236
case PGLOGICAL_ABORT_PREPARED:
32353237
gid = pq_getmsgstring(&s);
32363238
break;

multimaster.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#define MTM_TXTRACE(tx, event)
4040
#else
4141
#define MTM_TXTRACE(tx, event) \
42-
fprintf(stderr, "[MTM_TXTRACE], %s, %lld, %s, %d\n", tx->gid, (long long)MtmGetSystemTime(), event, getpid())
42+
fprintf(stderr, "[MTM_TXTRACE], %s, %lld, %s, %d\n", tx->gid, (long long)MtmGetSystemTime(), event, MyProcPid)
4343
#endif
4444

4545
#define MULTIMASTER_NAME "multimaster"

pglogical_apply.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,9 @@ process_remote_commit(StringInfo in)
625625
{
626626
case PGLOGICAL_PRECOMMIT_PREPARED:
627627
{
628+
Assert(!TransactionIdIsValid(MtmGetCurrentTransactionId()));
628629
gid = pq_getmsgstring(in);
630+
MTM_LOG2("%d: PGLOGICAL_PRECOMMIT_PREPARED %s", MyProcPid, gid);
629631
MtmPrecommitTransaction(gid);
630632
return;
631633
}

pglogical_proto.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ pglogical_write_commit(StringInfo out, PGLogicalOutputData *data,
192192
else
193193
Assert(false);
194194

195-
if (flags == PGLOGICAL_COMMIT || flags == PGLOGICAL_PREPARE || flags == PGLOGICAL_PRECOMMIT_PREPARED) {
195+
if (flags == PGLOGICAL_COMMIT || flags == PGLOGICAL_PREPARE) {
196+
/* COMMIT and PREPARE are preceded by BEGIN, which set MtmIsFilteredTxn flag */
196197
if (MtmIsFilteredTxn) {
197198
Assert(MtmTransactionRecords == 0);
198199
return;

0 commit comments

Comments
 (0)