Tables Drupal creates lazily, and the expiry condition each one needs.
Every entry is guarded, because none of these tables is guaranteed to exist:
sessions, flood, key_value_expire, batch, queue and semaphore are
all created on first write by an ensureTableExists() call in their own backend,
so a site that has never had an anonymous session has no sessions table and a
DELETE against it is a hard error rather than a no-op.
Each condition is copied from the Drupal service that owns the table, so this
is Drupal's policy executed by a different caller, not a new policy:
SessionHandler::gc(), Flood\DatabaseBackend::garbageCollection(),
KeyValueDatabaseExpirableFactory::garbageCollection(), BatchStorage::cleanup()
and DatabaseQueue::garbageCollection().
batch is the one with nothing behind it at all. BatchStorage::cleanup() has NO
CALLER anywhere in Drupal 11.4.5 -- grepped across core/lib, core/modules and
core/includes, the only hits are its own declaration, the interface, and the
lazy-loading ProxyClass that delegates to it -- so it is dead code upstream and
batch GC is ours or nobody's.
Tables Drupal creates lazily, and the expiry condition each one needs.
Every entry is guarded, because none of these tables is guaranteed to exist:
sessions,flood,key_value_expire,batch,queueandsemaphoreare all created on first write by an ensureTableExists() call in their own backend, so a site that has never had an anonymous session has nosessionstable and a DELETE against it is a hard error rather than a no-op.Each condition is copied from the Drupal service that owns the table, so this is Drupal's policy executed by a different caller, not a new policy: SessionHandler::gc(), Flood\DatabaseBackend::garbageCollection(), KeyValueDatabaseExpirableFactory::garbageCollection(), BatchStorage::cleanup() and DatabaseQueue::garbageCollection().
batchis the one with nothing behind it at all. BatchStorage::cleanup() has NO CALLER anywhere in Drupal 11.4.5 -- grepped across core/lib, core/modules and core/includes, the only hits are its own declaration, the interface, and the lazy-loading ProxyClass that delegates to it -- so it is dead code upstream and batch GC is ours or nobody's.