Skip to content

Commit 2eca05a

Browse files
committed
cleanup 2
1 parent 031c3f6 commit 2eca05a

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

src/backend/access/transam/twophase.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,22 +219,18 @@ StandbyCheckPointTwoPhase(XLogRecPtr redo_horizon)
219219

220220
// Assert(RecoveryInProgress());
221221

222-
elog(WARNING, "StandbyCheckPointTwoPhase");
223-
224222
TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_START();
225223

226224
dlist_foreach_modify(miter, &StandbyTwoPhaseStateData)
227225
{
228226
StandbyPreparedTransaction *xact = dlist_container(StandbyPreparedTransaction,
229227
list_node, miter.cur);
230228

231-
if (redo_horizon == 0 || xact->prepare_end_lsn <= redo_horizon)
232-
// if (true)
229+
if (redo_horizon == InvalidXLogRecPtr || xact->prepare_end_lsn <= redo_horizon)
233230
{
234231
char *buf;
235232
int len;
236233

237-
fprintf(stderr, "2PC: checkpoint: %x --> %d (horizon: %x)\n", xact->prepare_start_lsn, xact->xid, redo_horizon);
238234
XlogReadTwoPhaseData(xact->prepare_start_lsn, &buf, &len);
239235
RecreateTwoPhaseFile(xact->xid, buf, len);
240236
pfree(buf);
@@ -270,8 +266,6 @@ StandbyAtCommit(TransactionId xid)
270266

271267
if (xact->xid == xid)
272268
{
273-
// pfree(xact);
274-
fprintf(stderr, "2PC: commit: %x/%d\n", xact->prepare_start_lsn, xact->xid);
275269
dlist_delete(miter.cur);
276270
return;
277271
}
@@ -1746,8 +1740,6 @@ StandbyAtPrepare(XLogReaderState *record)
17461740
xact->prepare_start_lsn = record->ReadRecPtr;
17471741
xact->prepare_end_lsn = record->EndRecPtr;
17481742

1749-
fprintf(stderr, "2PC: at_prepare: %x/%d\n", xact->prepare_start_lsn, xact->xid);
1750-
17511743
dlist_push_tail(&StandbyTwoPhaseStateData, &xact->list_node);
17521744
}
17531745

@@ -1789,7 +1781,6 @@ PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p)
17891781
int nxids = 0;
17901782
int allocsize = 0;
17911783

1792-
fprintf(stderr, "--- PrescanPreparedTransactions\n");
17931784
StandbyCheckPointTwoPhase(0);
17941785

17951786
cldir = AllocateDir(TWOPHASE_DIR);
@@ -1928,8 +1919,6 @@ StandbyRecoverPreparedTransactions(bool overwriteOK)
19281919
DIR *cldir;
19291920
struct dirent *clde;
19301921

1931-
fprintf(stderr, "--- StandbyRecoverPreparedTransactions\n");
1932-
19331922
cldir = AllocateDir(TWOPHASE_DIR);
19341923
while ((clde = ReadDir(cldir, TWOPHASE_DIR)) != NULL)
19351924
{
@@ -2013,8 +2002,6 @@ RecoverPreparedTransactions(void)
20132002
struct dirent *clde;
20142003
bool overwriteOK = false;
20152004

2016-
fprintf(stderr, "--- RecoverPreparedTransactions\n");
2017-
20182005
snprintf(dir, MAXPGPATH, "%s", TWOPHASE_DIR);
20192006

20202007
cldir = AllocateDir(dir);

src/backend/access/transam/xact.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5604,7 +5604,6 @@ xact_redo(XLogReaderState *record)
56045604
Assert(TransactionIdIsValid(parsed.twophase_xid));
56055605
xact_redo_commit(&parsed, parsed.twophase_xid,
56065606
record->EndRecPtr, XLogRecGetOrigin(record));
5607-
// RemoveTwoPhaseFile(parsed.twophase_xid, false);
56085607
StandbyAtCommit(parsed.twophase_xid);
56095608
}
56105609
}
@@ -5625,17 +5624,12 @@ xact_redo(XLogReaderState *record)
56255624
{
56265625
Assert(TransactionIdIsValid(parsed.twophase_xid));
56275626
xact_redo_abort(&parsed, parsed.twophase_xid);
5628-
// RemoveTwoPhaseFile(parsed.twophase_xid, false);
56295627
StandbyAtCommit(parsed.twophase_xid);
56305628
}
56315629
}
56325630
else if (info == XLOG_XACT_PREPARE)
56335631
{
56345632
/* the record contents are exactly the 2PC file */
5635-
// elog(WARNING, "2PC: RecreateTwoPhaseFile");
5636-
// RecreateTwoPhaseFile(XLogRecGetXid(record),
5637-
// XLogRecGetData(record), XLogRecGetDataLen(record));
5638-
elog(WARNING, "reading prepared tx");
56395633
StandbyAtPrepare(record);
56405634
}
56415635
else if (info == XLOG_XACT_ASSIGNMENT)

src/backend/access/transam/xlog.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6734,7 +6734,6 @@ StartupXLOG(void)
67346734

67356735
ProcArrayApplyRecoveryInfo(&running);
67366736

6737-
StandbyCheckPointTwoPhase(0);
67386737
StandbyRecoverPreparedTransactions(false);
67396738
}
67406739
}
@@ -8774,7 +8773,6 @@ CreateEndOfRecoveryRecord(void)
87748773
END_CRIT_SECTION();
87758774

87768775
LocalXLogInsertAllowed = -1; /* return to "check" state */
8777-
// StandbyCheckPointTwoPhase(0);
87788776
}
87798777

87808778
/*
@@ -8798,7 +8796,6 @@ CheckPointGuts(XLogRecPtr checkPointRedo, int flags)
87988796
CheckPointBuffers(flags); /* performs all required fsyncs */
87998797
CheckPointReplicationOrigin();
88008798
/* We deliberately delay 2PC checkpointing as long as possible */
8801-
StandbyCheckPointTwoPhase(checkPointRedo);
88028799
CheckPointTwoPhase(checkPointRedo);
88038800
}
88048801

@@ -9398,7 +9395,6 @@ xlog_redo(XLogReaderState *record)
93989395
Assert(info == XLOG_FPI || info == XLOG_FPI_FOR_HINT ||
93999396
!XLogRecHasAnyBlockRefs(record));
94009397

9401-
elog(WARNING, "2PC: xlog_redo, info=%x", info);
94029398
if (info == XLOG_NEXTOID)
94039399
{
94049400
Oid nextOid;
@@ -9482,8 +9478,6 @@ xlog_redo(XLogReaderState *record)
94829478

94839479
ProcArrayApplyRecoveryInfo(&running);
94849480

9485-
fprintf(stderr, "--- aaa\n");
9486-
StandbyCheckPointTwoPhase(0);
94879481
StandbyRecoverPreparedTransactions(true);
94889482
}
94899483

@@ -9576,7 +9570,6 @@ xlog_redo(XLogReaderState *record)
95769570
ereport(PANIC,
95779571
(errmsg("unexpected timeline ID %u (should be %u) in checkpoint record",
95789572
xlrec.ThisTimeLineID, ThisTimeLineID)));
9579-
// StandbyCheckPointTwoPhase(0);
95809573
}
95819574
else if (info == XLOG_NOOP)
95829575
{

0 commit comments

Comments
 (0)