mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Rethink the locking mechanisms used for CREATE/DROP/RENAME DATABASE.
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.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.8 2006/03/05 15:58:23 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.9 2006/05/04 16:07:29 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "lib/stringinfo.h"
|
||||
#include "miscadmin.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/inval.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
|
||||
@@ -911,12 +910,6 @@ shdepLockAndCheckObject(Oid classId, Oid objectId)
|
||||
/* AccessShareLock should be OK, since we are not modifying the object */
|
||||
LockSharedObject(classId, objectId, 0, AccessShareLock);
|
||||
|
||||
/*
|
||||
* We have to recognize sinval updates here, else our local syscache may
|
||||
* still contain the object even if it was just dropped.
|
||||
*/
|
||||
AcceptInvalidationMessages();
|
||||
|
||||
switch (classId)
|
||||
{
|
||||
case AuthIdRelationId:
|
||||
|
Reference in New Issue
Block a user