]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Limit depth of forced recursion for CLOBBER_CACHE_RECURSIVELY.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 7 Sep 2018 22:13:29 +0000 (18:13 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 7 Sep 2018 22:14:44 +0000 (18:14 -0400)
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 f868a8143.)
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

src/backend/utils/cache/inval.c

index a4a54d41af4409c654d43cd741e3a164649eaef9..5c2809132d1274e1862760dcd7e3fb30eb6fed44 100644 (file)
@@ -619,7 +619,17 @@ AcceptInvalidationMessages(void)
                }
        }
 #elif defined(CLOBBER_CACHE_RECURSIVELY)
-       InvalidateSystemCaches();
+       {
+               static int      recursion_depth = 0;
+
+               /* Maximum depth is arbitrary depending on your threshold of pain */
+               if (recursion_depth < 3)
+               {
+                       recursion_depth++;
+                       InvalidateSystemCaches();
+                       recursion_depth--;
+               }
+       }
 #endif
 }