bool        aggressive;
    /* Use visibility map to skip? (disabled by DISABLE_PAGE_SKIPPING) */
    bool        skipwithvm;
-   /* Wraparound failsafe has been triggered? */
-   bool        failsafe_active;
    /* Consider index vacuuming bypass optimization? */
    bool        consider_bypass_optimization;
 
    Assert(params->index_cleanup != VACOPTVALUE_UNSPECIFIED);
    Assert(params->truncate != VACOPTVALUE_UNSPECIFIED &&
           params->truncate != VACOPTVALUE_AUTO);
-   vacrel->failsafe_active = false;
+   VacuumFailsafeActive = false;
    vacrel->consider_bypass_optimization = true;
    vacrel->do_index_vacuuming = true;
    vacrel->do_index_cleanup = true;
            }
            else
            {
-               if (!vacrel->failsafe_active)
+               if (!VacuumFailsafeActive)
                    appendStringInfoString(&buf, _("index scan bypassed: "));
                else
                    appendStringInfoString(&buf, _("index scan bypassed by failsafe: "));
         * vacuuming or heap vacuuming.  This VACUUM operation won't end up
         * back here again.
         */
-       Assert(vacrel->failsafe_active);
+       Assert(VacuumFailsafeActive);
    }
 
    /*
     */
    Assert(vacrel->num_index_scans > 0 ||
           vacrel->dead_items->num_items == vacrel->lpdead_items);
-   Assert(allindexes || vacrel->failsafe_active);
+   Assert(allindexes || VacuumFailsafeActive);
 
    /*
     * Increase and report the number of index scans.
 lazy_check_wraparound_failsafe(LVRelState *vacrel)
 {
    /* Don't warn more than once per VACUUM */
-   if (vacrel->failsafe_active)
+   if (VacuumFailsafeActive)
        return true;
 
    if (unlikely(vacuum_xid_failsafe_check(&vacrel->cutoffs)))
    {
-       vacrel->failsafe_active = true;
+       VacuumFailsafeActive = true;
 
        /*
         * Abandon use of a buffer access strategy to allow use of all of
 {
    BlockNumber possibly_freeable;
 
-   if (!vacrel->do_rel_truncate || vacrel->failsafe_active ||
+   if (!vacrel->do_rel_truncate || VacuumFailsafeActive ||
        old_snapshot_threshold >= 0)
        return false;
 
 
 int            vacuum_failsafe_age;
 int            vacuum_multixact_failsafe_age;
 
+/*
+ * VacuumFailsafeActive is a defined as a global so that we can determine
+ * whether or not to re-enable cost-based vacuum delay when vacuuming a table.
+ * If failsafe mode has been engaged, we will not re-enable cost-based delay
+ * for the table until after vacuuming has completed, regardless of other
+ * settings.
+ *
+ * Only VACUUM code should inspect this variable and only table access methods
+ * should set it to true. In Table AM-agnostic VACUUM code, this variable is
+ * inspected to determine whether or not to allow cost-based delays. Table AMs
+ * are free to set it if they desire this behavior, but it is false by default
+ * and reset to false in between vacuuming each relation.
+ */
+bool       VacuumFailsafeActive = false;
+
 /*
  * Variables for cost-based parallel vacuum.  See comments atop
  * compute_parallel_delay to understand how it works.