Skip to content

Commit f112d40

Browse files
committed
Limit depth of forced recursion for CLOBBER_CACHE_RECURSIVELY.
It's somewhat surprising that we got away with this before. (Actually, since nobody tests this routinely AFAIK, it might've been broken for awhile. But it's definitely broken in the wake of commit f868a81.) It seems sufficient to limit the forced recursion to a small number of levels. Back-patch to all supported branches, like the preceding patch. Discussion: https://postgr.es/m/12259.1532117714@sss.pgh.pa.us
1 parent 95e9f92 commit f112d40

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/backend/utils/cache/inval.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,17 @@ AcceptInvalidationMessages(void)
619619
}
620620
}
621621
#elif defined(CLOBBER_CACHE_RECURSIVELY)
622-
InvalidateSystemCaches();
622+
{
623+
static int recursion_depth = 0;
624+
625+
/* Maximum depth is arbitrary depending on your threshold of pain */
626+
if (recursion_depth < 3)
627+
{
628+
recursion_depth++;
629+
InvalidateSystemCaches();
630+
recursion_depth--;
631+
}
632+
}
623633
#endif
624634
}
625635

0 commit comments

Comments
 (0)