mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Several changes here, not very related but touching some of the same files.
* Buffer refcount cleanup (per my "progress report" to pghackers, 9/22). * Add links to backend PROC structs to sinval's array of per-backend info, and use these links for routines that need to check the state of all backends (rather than the slow, complicated search of the ShmemIndex hashtable that was used before). Add databaseOID to PROC structs. * Use this to implement an interlock that prevents DESTROY DATABASE of a database containing running backends. (It's a little tricky to prevent a concurrently-starting backend from getting in there, since the new backend is not able to lock anything at the time it tries to look up its database in pg_database. My solution is to recheck that the DB is OK at the end of InitPostgres. It may not be a 100% solution, but it's a lot better than no interlock at all...) * In ALTER TABLE RENAME, flush buffers for the relation before doing the rename of the physical files, to ensure we don't get failures later from mdblindwrt(). * Update TRUNCATE patch so that it actually compiles against current sources :-(. You should do "make clean all" after pulling these changes.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: proc.h,v 1.25 1999/07/15 23:04:13 momjian Exp $
|
||||
* $Id: proc.h,v 1.26 1999/09/24 00:25:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -51,7 +51,8 @@ typedef struct proc
|
||||
LOCK *waitLock; /* Lock we're sleeping on ... */
|
||||
int token; /* type of lock we sleeping for */
|
||||
int holdLock; /* while holding these locks */
|
||||
int pid; /* This procs process id */
|
||||
int pid; /* This backend's process id */
|
||||
Oid databaseId; /* OID of database this backend is using */
|
||||
short sLocks[MAX_SPINS]; /* Spin lock stats */
|
||||
SHM_QUEUE lockQueue; /* locks associated with current
|
||||
* transaction */
|
||||
@ -64,6 +65,7 @@ typedef struct proc
|
||||
* on your machine), or our free-semaphores bitmap won't work. You also must
|
||||
* not set it higher than your kernel's SEMMSL (max semaphores per set)
|
||||
* parameter, which is often around 25.
|
||||
*
|
||||
* MAX_PROC_SEMS is the maximum number of per-process semaphores (those used
|
||||
* by the lock mgr) we can keep track of. It must be a multiple of
|
||||
* PROC_NSEMS_PER_SET.
|
||||
@ -78,9 +80,9 @@ typedef struct procglobal
|
||||
int32 freeSemMap[MAX_PROC_SEMS / PROC_NSEMS_PER_SET];
|
||||
|
||||
/*
|
||||
* In each freeSemMap entry, the PROC_NSEMS_PER_SET lsbs flag whether
|
||||
* individual semaphores are in use, and the next higher bit is set to
|
||||
* show that the entire set is allocated.
|
||||
* In each freeSemMap entry, the PROC_NSEMS_PER_SET least-significant bits
|
||||
* flag whether individual semaphores are in use, and the next higher bit
|
||||
* is set to show that the entire set is allocated.
|
||||
*/
|
||||
} PROC_HDR;
|
||||
|
||||
|
Reference in New Issue
Block a user