mirror of
https://github.com/postgres/postgres.git
synced 2025-11-13 16:22:44 +03:00
XLOG (and related) changes:
* Store two past checkpoint locations, not just one, in pg_control. On startup, we fall back to the older checkpoint if the newer one is unreadable. Also, a physical copy of the newest checkpoint record is kept in pg_control for possible use in disaster recovery (ie, complete loss of pg_xlog). Also add a version number for pg_control itself. Remove archdir from pg_control; it ought to be a GUC parameter, not a special case (not that it's implemented yet anyway). * Suppress successive checkpoint records when nothing has been entered in the WAL log since the last one. This is not so much to avoid I/O as to make it actually useful to keep track of the last two checkpoints. If the things are right next to each other then there's not a lot of redundancy gained... * Change CRC scheme to a true 64-bit CRC, not a pair of 32-bit CRCs on alternate bytes. Polynomial borrowed from ECMA DLT1 standard. * Fix XLOG record length handling so that it will work at BLCKSZ = 32k. * Change XID allocation to work more like OID allocation. (This is of dubious necessity, but I think it's a good idea anyway.) * Fix a number of minor bugs, such as off-by-one logic for XLOG file wraparound at the 4 gig mark. * Add documentation and clean up some coding infelicities; move file format declarations out to include files where planned contrib utilities can get at them. * Checkpoint will now occur every CHECKPOINT_SEGMENTS log segments or every CHECKPOINT_TIMEOUT seconds, whichever comes first. It is also possible to force a checkpoint by sending SIGUSR1 to the postmaster (undocumented feature...) * Defend against kill -9 postmaster by storing shmem block's key and ID in postmaster.pid lockfile, and checking at startup to ensure that no processes are still connected to old shmem block (if it still exists). * Switch backends to accept SIGQUIT rather than SIGUSR1 for emergency stop, for symmetry with postmaster and xlog utilities. Clean up signal handling in bootstrap.c so that xlog utilities launched by postmaster will react to signals better. * Standalone bootstrap now grabs lockfile in target directory, as added insurance against running it in parallel with live postmaster.
This commit is contained in:
@@ -57,12 +57,25 @@ int* shmat(int memId,int m1,int m2)
|
||||
}
|
||||
}
|
||||
|
||||
/* Control a shared mem area : Used only to delete it */
|
||||
int shmctl(int shmid,int flag, struct shmid_ds* dummy)
|
||||
/* Control a shared mem area */
|
||||
int shmctl(int shmid, int flag, struct shmid_ds* dummy)
|
||||
{
|
||||
/* Delete the area */
|
||||
delete_area(shmid);
|
||||
return 0;
|
||||
if (flag == IPC_RMID)
|
||||
{
|
||||
/* Delete the area */
|
||||
delete_area(shmid);
|
||||
return 0;
|
||||
}
|
||||
if (flag == IPC_STAT)
|
||||
{
|
||||
/* Is there a way to check existence of an area given its ID?
|
||||
* For now, punt and assume it does not exist.
|
||||
*/
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get an area based on the IPC key */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/shm.c,v 1.2 2000/04/12 17:15:30 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/shm.c,v 1.3 2001/03/13 01:17:06 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -173,20 +173,25 @@ shmctl(int shmid, int cmd, struct shmid_ds * buf)
|
||||
struct shm_info info;
|
||||
char name[NAME_MAX + 1];
|
||||
|
||||
/* IPC_RMID supported only */
|
||||
if (cmd != IPC_RMID)
|
||||
if (cmd == IPC_RMID)
|
||||
{
|
||||
if (shm_getinfo(shmid, &info) == -1)
|
||||
{
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
return shm_unlink(itoa(info.key, name, 16));
|
||||
}
|
||||
if (cmd == IPC_STAT)
|
||||
{
|
||||
/* Can we support IPC_STAT? We only need shm_nattch ...
|
||||
* For now, punt and assume the shm seg does not exist.
|
||||
*/
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (shm_getinfo(shmid, &info) == -1)
|
||||
{
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return shm_unlink(itoa(info.key, name, 16));
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user