• Tom Lane's avatar
    Only allow autovacuum to be auto-canceled by a directly blocked process. · 26b43869
    Tom Lane authored
    In the original coding of the autovacuum cancel feature, commit
    acac68b2, an autovacuum process was
    considered a target for cancellation if it was found to hard-block any
    process examined in the deadlock search.  This patch tightens the test so
    that the autovacuum must directly hard-block the current process.  This
    should make the behavior more predictable in general, and in particular
    it ensures that an autovacuum will not be canceled with less than
    deadlock_timeout grace period.  In the old coding, it was possible for an
    autovacuum to be canceled almost instantly, given unfortunate timing of two
    or more other processes' lock attempts.
    
    This also justifies the logging methodology in the recent commit
    d7318d43; without this restriction, that
    patch isn't providing enough information to see the connection of the
    canceling process to the autovacuum.  Like that one, patch all the way
    back.
    26b43869
deadlock.c 28.4 KB