• Tom Lane's avatar
    Rethink the locking mechanisms used for CREATE/DROP/RENAME DATABASE. · 52667d56
    Tom Lane authored
    The former approach used ExclusiveLock on pg_database, which being a
    cluster-wide lock meant only one of these operations could proceed at
    a time; worse, it also blocked all incoming connections in ReverifyMyDatabase.
    Now that we have LockSharedObject(), we can use locks of different types
    applied to databases considered as objects.  This allows much more
    flexible management of the interlocking: two CREATE DATABASEs need not
    block each other, and need not block connections except to the template
    database being used.  Similarly DROP DATABASE doesn't block unrelated
    operations.  The locking used in flatfiles.c is also much narrower in
    scope than before.  Per recent proposal.
    52667d56
user.c 40.4 KB