Skip to content

Commit e55380f

Browse files
committed
Add temporary debug logging, in 9.4 branch only.
Commit 5ee940e served its purpose by demonstrating that buildfarm member okapi is seeing some sort of locally-visible state mismanagement, not a cross-process data visibility problem as I'd first theorized. Put in some elog(LOG) messages in hopes of gathering more info about exactly what's happening there. Again, this is temporary code to be reverted once we have buildfarm results. Discussion: https://postgr.es/m/6744.1523833660@sss.pgh.pa.us
1 parent fea5bfd commit e55380f

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/backend/commands/indexcmds.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,8 @@ DefineIndex(Oid relationId,
758758
*/
759759
validate_index(relationId, indexRelationId, snapshot);
760760

761+
PrintSnapMgrStatus("concurrent index build, before snapshot release");
762+
761763
/*
762764
* Drop the reference snapshot. We must do this before waiting out other
763765
* snapshot holders, else we will deadlock against other processes also
@@ -770,9 +772,13 @@ DefineIndex(Oid relationId,
770772
limitXmin = snapshot->xmin;
771773

772774
PopActiveSnapshot();
775+
PrintSnapMgrStatus("concurrent index build, after PopActiveSnapshot");
773776
UnregisterSnapshot(snapshot);
777+
PrintSnapMgrStatus("concurrent index build, after UnregisterSnapshot");
774778
InvalidateCatalogSnapshot();
775779

780+
PrintSnapMgrStatus("concurrent index build, after InvalidateCatalogSnapshot");
781+
776782
/*
777783
* The index is now valid in the sense that it contains all currently
778784
* interesting tuples. But since it might not contain tuples deleted just

src/backend/utils/time/snapmgr.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,3 +1401,17 @@ HistoricSnapshotGetTupleCids(void)
14011401
Assert(HistoricSnapshotActive());
14021402
return tuplecid_data;
14031403
}
1404+
1405+
void
1406+
PrintSnapMgrStatus(const char *context)
1407+
{
1408+
int asdepth = 0;
1409+
ActiveSnapshotElt *active;
1410+
1411+
for (active = ActiveSnapshot; active != NULL; active = active->as_next)
1412+
asdepth++;
1413+
1414+
elog(LOG, "%s: %d reg snaps, %d active snaps, cat snap %p, xmin %u",
1415+
context, RegisteredSnapshots, asdepth,
1416+
CatalogSnapshot, MyPgXact->xmin);
1417+
}

src/include/utils/snapmgr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,6 @@ extern void SetupHistoricSnapshot(Snapshot snapshot_now, struct HTAB *tuplecids)
6565
extern void TeardownHistoricSnapshot(bool is_error);
6666
extern bool HistoricSnapshotActive(void);
6767

68+
extern void PrintSnapMgrStatus(const char *context);
69+
6870
#endif /* SNAPMGR_H */

0 commit comments

Comments
 (0)