Skip to content
Snippets Groups Projects
Commit e55380f3 authored by Tom Lane's avatar Tom Lane
Browse files

Add temporary debug logging, in 9.4 branch only.

Commit 5ee940e1 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
parent fea5bfde
No related branches found
No related tags found
No related merge requests found
......@@ -758,6 +758,8 @@ DefineIndex(Oid relationId,
*/
validate_index(relationId, indexRelationId, snapshot);
PrintSnapMgrStatus("concurrent index build, before snapshot release");
/*
* Drop the reference snapshot. We must do this before waiting out other
* snapshot holders, else we will deadlock against other processes also
......@@ -770,9 +772,13 @@ DefineIndex(Oid relationId,
limitXmin = snapshot->xmin;
PopActiveSnapshot();
PrintSnapMgrStatus("concurrent index build, after PopActiveSnapshot");
UnregisterSnapshot(snapshot);
PrintSnapMgrStatus("concurrent index build, after UnregisterSnapshot");
InvalidateCatalogSnapshot();
PrintSnapMgrStatus("concurrent index build, after InvalidateCatalogSnapshot");
/*
* The index is now valid in the sense that it contains all currently
* interesting tuples. But since it might not contain tuples deleted just
......
......@@ -1401,3 +1401,17 @@ HistoricSnapshotGetTupleCids(void)
Assert(HistoricSnapshotActive());
return tuplecid_data;
}
void
PrintSnapMgrStatus(const char *context)
{
int asdepth = 0;
ActiveSnapshotElt *active;
for (active = ActiveSnapshot; active != NULL; active = active->as_next)
asdepth++;
elog(LOG, "%s: %d reg snaps, %d active snaps, cat snap %p, xmin %u",
context, RegisteredSnapshots, asdepth,
CatalogSnapshot, MyPgXact->xmin);
}
......@@ -65,4 +65,6 @@ extern void SetupHistoricSnapshot(Snapshot snapshot_now, struct HTAB *tuplecids)
extern void TeardownHistoricSnapshot(bool is_error);
extern bool HistoricSnapshotActive(void);
extern void PrintSnapMgrStatus(const char *context);
#endif /* SNAPMGR_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment