mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
The heralded `Grand Unified Configuration scheme' (GUC)
That means you can now set your options in either or all of $PGDATA/configuration, some postmaster option (--enable-fsync=off), or set a SET command. The list of options is in backend/utils/misc/guc.c, documentation will be written post haste. pg_options is gone, so is that pq_geqo config file. Also removed were backend -K, -Q, and -T options (no longer applicable, although -d0 does the same as -Q). Added to configure an --enable-syslog option. changed all callers from TPRINTF to elog(DEBUG)
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.47 2000/05/16 20:48:48 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.48 2000/05/31 00:28:29 petere Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@@ -36,9 +36,9 @@
|
||||
/* In Ultrix, sem.h and shm.h must be included AFTER ipc.h */
|
||||
#include <sys/sem.h>
|
||||
#include <sys/shm.h>
|
||||
#include "miscadmin.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "libpq/libpq.h"
|
||||
#include "utils/trace.h"
|
||||
|
||||
#if defined(solaris_sparc)
|
||||
#include <sys/ipc.h>
|
||||
@@ -124,7 +124,8 @@ proc_exit(int code)
|
||||
*/
|
||||
proc_exit_inprogress = true;
|
||||
|
||||
TPRINTF(TRACE_VERBOSE, "proc_exit(%d)", code);
|
||||
if (DebugLvl > 1)
|
||||
elog(DEBUG, "proc_exit(%d)", code);
|
||||
|
||||
/* do our shared memory exits first */
|
||||
shmem_exit(code);
|
||||
@@ -143,7 +144,8 @@ proc_exit(int code)
|
||||
(*on_proc_exit_list[on_proc_exit_index].function) (code,
|
||||
on_proc_exit_list[on_proc_exit_index].arg);
|
||||
|
||||
TPRINTF(TRACE_VERBOSE, "exit(%d)", code);
|
||||
if (DebugLvl > 1)
|
||||
elog(DEBUG, "exit(%d)", code);
|
||||
exit(code);
|
||||
}
|
||||
|
||||
@@ -156,7 +158,8 @@ proc_exit(int code)
|
||||
void
|
||||
shmem_exit(int code)
|
||||
{
|
||||
TPRINTF(TRACE_VERBOSE, "shmem_exit(%d)", code);
|
||||
if (DebugLvl > 1)
|
||||
elog(DEBUG, "shmem_exit(%d)", code);
|
||||
|
||||
/* ----------------
|
||||
* call all the registered callbacks.
|
||||
@@ -297,18 +300,16 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
|
||||
if (semId == -1)
|
||||
{
|
||||
#ifdef DEBUG_IPC
|
||||
EPRINTF("calling semget with %d, %d , %d\n",
|
||||
semKey,
|
||||
semNum,
|
||||
IPC_CREAT | permission);
|
||||
fprintf(stderr, "calling semget(%d, %d, 0%o)\n",
|
||||
semKey, semNum, (unsigned)(IPC_CREAT|permission));
|
||||
#endif
|
||||
semId = semget(semKey, semNum, IPC_CREAT | permission);
|
||||
|
||||
if (semId < 0)
|
||||
{
|
||||
EPRINTF("IpcSemaphoreCreate: semget failed (%s) "
|
||||
"key=%d, num=%d, permission=%o",
|
||||
strerror(errno), semKey, semNum, permission);
|
||||
fprintf(stderr, "IpcSemaphoreCreate: semget(%d, %d, 0%o) failed: %s\n",
|
||||
semKey, semNum, (unsigned)(permission|IPC_CREAT),
|
||||
strerror(errno));
|
||||
IpcConfigTip();
|
||||
return (-1);
|
||||
}
|
||||
@@ -318,8 +319,8 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
|
||||
errStatus = semctl(semId, 0, SETALL, semun);
|
||||
if (errStatus == -1)
|
||||
{
|
||||
EPRINTF("IpcSemaphoreCreate: semctl failed (%s) id=%d",
|
||||
strerror(errno), semId);
|
||||
fprintf(stderr, "IpcSemaphoreCreate: semctl(id=%d) failed: %s\n",
|
||||
semId, strerror(errno));
|
||||
semctl(semId, 0, IPC_RMID, semun);
|
||||
IpcConfigTip();
|
||||
return (-1);
|
||||
@@ -330,10 +331,11 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
|
||||
}
|
||||
|
||||
#ifdef DEBUG_IPC
|
||||
EPRINTF("\nIpcSemaphoreCreate, returns %d\n", semId);
|
||||
fprintf(stderr, "IpcSemaphoreCreate returns %d\n", semId);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
#endif
|
||||
|
||||
return semId;
|
||||
}
|
||||
|
||||
@@ -357,13 +359,11 @@ IpcSemaphoreSet(int semId, int semno, int value)
|
||||
IpcSemaphoreSet_return = errStatus;
|
||||
|
||||
if (errStatus == -1)
|
||||
{
|
||||
EPRINTF("IpcSemaphoreSet: semctl failed (%s) id=%d",
|
||||
strerror(errno), semId);
|
||||
}
|
||||
fprintf(stderr, "IpcSemaphoreSet: semctl(id=%d) failed: %s\n",
|
||||
semId, strerror(errno));
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* NOT_USED */
|
||||
|
||||
/****************************************************************************/
|
||||
/* IpcSemaphoreKill(key) - removes a semaphore */
|
||||
@@ -421,8 +421,8 @@ IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
|
||||
|
||||
if (errStatus == -1)
|
||||
{
|
||||
EPRINTF("IpcSemaphoreLock: semop failed (%s) id=%d",
|
||||
strerror(errno), semId);
|
||||
fprintf(stderr, "IpcSemaphoreLock: semop(id=%d) failed: %s\n",
|
||||
semId, strerror(errno));
|
||||
proc_exit(255);
|
||||
}
|
||||
}
|
||||
@@ -466,8 +466,8 @@ IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
|
||||
|
||||
if (errStatus == -1)
|
||||
{
|
||||
EPRINTF("IpcSemaphoreUnlock: semop failed (%s) id=%d",
|
||||
strerror(errno), semId);
|
||||
fprintf(stderr, "IpcSemaphoreUnlock: semop(id=%d) failed: %s\n",
|
||||
semId, strerror(errno));
|
||||
proc_exit(255);
|
||||
}
|
||||
}
|
||||
@@ -516,9 +516,8 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
|
||||
|
||||
if (shmid < 0)
|
||||
{
|
||||
EPRINTF("IpcMemoryCreate: shmget failed (%s) "
|
||||
"key=%d, size=%d, permission=%o",
|
||||
strerror(errno), memKey, size, permission);
|
||||
fprintf(stderr, "IpcMemoryCreate: shmget(%d, %d, 0%o) failed: %s\n",
|
||||
memKey, size, (unsigned)(IPC_CREAT|permission), strerror(errno));
|
||||
IpcConfigTip();
|
||||
return IpcMemCreationFailed;
|
||||
}
|
||||
@@ -542,9 +541,8 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
|
||||
|
||||
if (shmid < 0)
|
||||
{
|
||||
EPRINTF("IpcMemoryIdGet: shmget failed (%s) "
|
||||
"key=%d, size=%d, permission=%o",
|
||||
strerror(errno), memKey, size, 0);
|
||||
fprintf(stderr, "IpcMemoryIdGet: shmget(%d, %d, 0) failed: %s\n",
|
||||
memKey, size, strerror(errno));
|
||||
return IpcMemIdGetFailed;
|
||||
}
|
||||
|
||||
@@ -583,8 +581,8 @@ IpcMemoryAttach(IpcMemoryId memId)
|
||||
/* if ( *memAddress == -1) { XXX ??? */
|
||||
if (memAddress == (char *) -1)
|
||||
{
|
||||
EPRINTF("IpcMemoryAttach: shmat failed (%s) id=%d",
|
||||
strerror(errno), memId);
|
||||
fprintf(stderr, "IpcMemoryAttach: shmat(id=%d) failed: %s\n",
|
||||
memId, strerror(errno));
|
||||
return IpcMemAttachFailed;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.31 2000/05/30 00:49:52 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.32 2000/05/31 00:28:29 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -268,8 +268,8 @@ SIInsertDataEntry(SISeg *segP, SharedInvalidData *data)
|
||||
if (numMsgs == (MAXNUMMESSAGES * 70 / 100) &&
|
||||
IsUnderPostmaster)
|
||||
{
|
||||
TPRINTF(TRACE_VERBOSE,
|
||||
"SIInsertDataEntry: table is 70%% full, signaling postmaster");
|
||||
if (DebugLvl >= 1)
|
||||
elog(DEBUG, "SIInsertDataEntry: table is 70%% full, signaling postmaster");
|
||||
kill(getppid(), SIGUSR2);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.24 2000/04/12 17:15:37 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.25 2000/05/31 00:28:29 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "storage/proc.h"
|
||||
#include "storage/s_lock.h"
|
||||
|
||||
|
||||
/* globals used in this file */
|
||||
IpcSemaphoreId SpinLockId;
|
||||
|
||||
@@ -84,14 +85,23 @@ InitSpinLocks(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef LOCKDEBUG
|
||||
#define PRINT_LOCK(LOCK) \
|
||||
TPRINTF(TRACE_SPINLOCKS, \
|
||||
"(locklock = %d, flag = %d, nshlocks = %d, shlock = %d, " \
|
||||
"exlock =%d)\n", LOCK->locklock, \
|
||||
LOCK->flag, LOCK->nshlocks, LOCK->shlock, \
|
||||
LOCK->exlock)
|
||||
#endif
|
||||
|
||||
#ifdef LOCK_DEBUG
|
||||
bool Trace_spinlocks = false;
|
||||
|
||||
inline static void
|
||||
PRINT_SLDEBUG(const char * where, SPINLOCK lockid, const SLock * lock)
|
||||
{
|
||||
if (Trace_spinlocks)
|
||||
elog(DEBUG,
|
||||
"%s: id=%d (locklock=%d, flag=%d, nshlocks=%d, shlock=%d, exlock=%d)",
|
||||
where, lockid,
|
||||
lock->locklock, lock->flag, lock->nshlocks, lock->shlock, lock->exlock);
|
||||
}
|
||||
#else /* not LOCK_DEBUG */
|
||||
#define PRINT_SLDEBUG(a,b,c)
|
||||
#endif /* not LOCK_DEBUG */
|
||||
|
||||
|
||||
/* from ipc.c */
|
||||
extern SLock *SLockArray;
|
||||
@@ -103,10 +113,7 @@ SpinAcquire(SPINLOCK lockid)
|
||||
|
||||
/* This used to be in ipc.c, but move here to reduce function calls */
|
||||
slckP = &(SLockArray[lockid]);
|
||||
#ifdef LOCKDEBUG
|
||||
TPRINTF(TRACE_SPINLOCKS, "SpinAcquire: %d", lockid);
|
||||
PRINT_LOCK(slckP);
|
||||
#endif
|
||||
PRINT_SLDEBUG("SpinAcquire", lockid, slckP);
|
||||
ex_try_again:
|
||||
S_LOCK(&(slckP->locklock));
|
||||
switch (slckP->flag)
|
||||
@@ -116,10 +123,7 @@ ex_try_again:
|
||||
S_LOCK(&(slckP->exlock));
|
||||
S_LOCK(&(slckP->shlock));
|
||||
S_UNLOCK(&(slckP->locklock));
|
||||
#ifdef LOCKDEBUG
|
||||
TPRINTF(TRACE_SPINLOCKS, "OUT: ");
|
||||
PRINT_LOCK(slckP);
|
||||
#endif
|
||||
PRINT_SLDEBUG("OUT", lockid, slckP);
|
||||
break;
|
||||
case SHAREDLOCK:
|
||||
case EXCLUSIVELOCK:
|
||||
@@ -129,9 +133,7 @@ ex_try_again:
|
||||
goto ex_try_again;
|
||||
}
|
||||
PROC_INCR_SLOCK(lockid);
|
||||
#ifdef LOCKDEBUG
|
||||
TPRINTF(TRACE_SPINLOCKS, "SpinAcquire: got %d", lockid);
|
||||
#endif
|
||||
PRINT_SLDEBUG("SpinAcquire/success", lockid, slckP);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -142,23 +144,16 @@ SpinRelease(SPINLOCK lockid)
|
||||
/* This used to be in ipc.c, but move here to reduce function calls */
|
||||
slckP = &(SLockArray[lockid]);
|
||||
|
||||
#ifdef USE_ASSERT_CHECKING
|
||||
|
||||
/*
|
||||
* Check that we are actually holding the lock we are releasing. This
|
||||
* can be done only after MyProc has been initialized.
|
||||
*/
|
||||
if (MyProc)
|
||||
Assert(MyProc->sLocks[lockid] > 0);
|
||||
Assert(!MyProc || MyProc->sLocks[lockid] > 0);
|
||||
Assert(slckP->flag != NOLOCK);
|
||||
#endif
|
||||
|
||||
|
||||
PROC_DECR_SLOCK(lockid);
|
||||
|
||||
#ifdef LOCKDEBUG
|
||||
TPRINTF("SpinRelease: %d\n", lockid);
|
||||
PRINT_LOCK(slckP);
|
||||
#endif
|
||||
PRINT_SLDEBUG("SpinRelease", lockid, slckP);
|
||||
S_LOCK(&(slckP->locklock));
|
||||
/* -------------
|
||||
* give favor to read processes
|
||||
@@ -178,13 +173,10 @@ SpinRelease(SPINLOCK lockid)
|
||||
S_UNLOCK(&(slckP->shlock));
|
||||
S_UNLOCK(&(slckP->exlock));
|
||||
S_UNLOCK(&(slckP->locklock));
|
||||
#ifdef LOCKDEBUG
|
||||
TPRINTF(TRACE_SPINLOCKS, "SpinRelease: released %d", lockid);
|
||||
PRINT_LOCK(slckP);
|
||||
#endif
|
||||
PRINT_SLDEBUG("SpinRelease/released", lockid, slckP);
|
||||
}
|
||||
|
||||
#else /* HAS_TEST_AND_SET */
|
||||
#else /* !HAS_TEST_AND_SET */
|
||||
/* Spinlocks are implemented using SysV semaphores */
|
||||
|
||||
static bool AttachSpinLocks(IPCKey key);
|
||||
@@ -290,4 +282,4 @@ InitSpinLocks(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* HAS_TEST_AND_SET */
|
||||
#endif /* !HAS_TEST_AND_SET */
|
||||
|
||||
Reference in New Issue
Block a user