Looks good and seems to handle the previous corner case, I only have
two very minor comments:

@@ -391,6 +392,7 @@ pgstat_report_skipped_vacuum_analyze(Oid relid, int flags)
                return;                                 /* somebody deleted the 
rel, forget it */
        isshared = ((Form_pg_class) GETSTRUCT(classTup))->relisshared;
        ReleaseSysCache(classTup);
+       INJECTION_POINT("expand-vacuum-rel-skip-locked", NULL);

Nitpick, but now that the injection point lives inside
pgstat_report_skipped_vacuum_analyze, it should be named accordingly.

+        * This mirrors the approach used in pgstat_init_function_usage() for
+        * functions.

pgstat_init_function_usage only drops the entry conditionally if it
was created immediately before, so it is not entirely the same
pattern, I'm not sure if I would say "mirrors". Maybe similar to? But
this is again just nitpick.

The flow there (pending_entry, created flag => only rechecking on
freshly created) has the advantage that it only runs
AcceptInvalidationMessages+recheck when needed, but here it would also
require an additional pgstat_lock_entry call.


Reply via email to