proposal of 26-Aug.
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/postgres-ref.sgml,v 1.19 2001/09/08 15:24:00 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/postgres-ref.sgml,v 1.20 2001/09/27 16:29:12 tgl Exp $
Postgres documentation
-->
<arg>-f<group choice="plain"><arg>s</arg><arg>i</arg><arg>t</arg><arg>n</arg><arg>m</arg><arg>h</arg></group></arg>
<arg>-F</arg>
<arg>-i</arg>
- <arg>-L</arg>
<arg>-N</arg>
<arg>-o <replaceable>filename</replaceable></arg>
<arg>-O</arg>
<arg>-f<group choice="plain"><arg>s</arg><arg>i</arg><arg>t</arg><arg>n</arg><arg>m</arg><arg>h</arg></group></arg>
<arg>-F</arg>
<arg>-i</arg>
- <arg>-L</arg>
<arg>-o <replaceable>filename</replaceable></arg>
<arg>-O</arg>
<arg>-p <replaceable>database</replaceable></arg>
</listitem>
</varlistentry>
- <varlistentry>
- <term>-L</term>
- <listitem>
- <para>
- Turns off the locking system.
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry>
<term>-O</term>
<listitem>
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.115 2001/08/25 00:31:17 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.116 2001/09/27 16:29:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* backend initialization
*/
InitPostgres(dbName, NULL);
- LockDisable(true);
for (i = 0; i < MAXATTR; i++)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.50 2001/08/25 18:52:42 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.51 2001/09/27 16:29:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
LOCKTAG tag;
- if (LockingDisabled())
- return;
-
MemSet(&tag, 0, sizeof(tag));
tag.relId = relation->rd_lockInfo.lockRelId.relId;
tag.dbId = relation->rd_lockInfo.lockRelId.dbId;
{
LOCKTAG tag;
- if (LockingDisabled())
- return true;
-
MemSet(&tag, 0, sizeof(tag));
tag.relId = relation->rd_lockInfo.lockRelId.relId;
tag.dbId = relation->rd_lockInfo.lockRelId.dbId;
{
LOCKTAG tag;
- if (LockingDisabled())
- return;
-
MemSet(&tag, 0, sizeof(tag));
tag.relId = relation->rd_lockInfo.lockRelId.relId;
tag.dbId = relation->rd_lockInfo.lockRelId.dbId;
{
LOCKTAG tag;
- if (LockingDisabled())
- return;
-
MemSet(&tag, 0, sizeof(tag));
tag.relId = relid->relId;
tag.dbId = relid->dbId;
{
LOCKTAG tag;
- if (LockingDisabled())
- return;
-
MemSet(&tag, 0, sizeof(tag));
tag.relId = relid->relId;
tag.dbId = relid->dbId;
/*
* LockPage
+ *
+ * Obtain a page-level lock. This is currently used by some index access
+ * methods to lock index pages. For heap relations, it is used only with
+ * blkno == 0 to signify locking the relation for extension.
*/
void
LockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode)
{
LOCKTAG tag;
- if (LockingDisabled())
- return;
-
MemSet(&tag, 0, sizeof(tag));
tag.relId = relation->rd_lockInfo.lockRelId.relId;
tag.dbId = relation->rd_lockInfo.lockRelId.dbId;
{
LOCKTAG tag;
- if (LockingDisabled())
- return;
-
MemSet(&tag, 0, sizeof(tag));
tag.relId = relation->rd_lockInfo.lockRelId.relId;
tag.dbId = relation->rd_lockInfo.lockRelId.dbId;
LockRelease(LockTableId, &tag, GetCurrentTransactionId(), lockmode);
}
+/*
+ * XactLockTableInsert
+ *
+ * Insert a lock showing that the given transaction ID is running ---
+ * this is done during xact startup. The lock can then be used to wait
+ * for the transaction to finish.
+ *
+ * We need no corresponding unlock function, since the lock will always
+ * be released implicitly at transaction commit/abort, never any other way.
+ */
void
XactLockTableInsert(TransactionId xid)
{
LOCKTAG tag;
- if (LockingDisabled())
- return;
-
MemSet(&tag, 0, sizeof(tag));
tag.relId = XactLockTableId;
tag.dbId = InvalidOid; /* xids are globally unique */
elog(ERROR, "XactLockTableInsert: LockAcquire failed");
}
-#ifdef NOT_USED
-void
-XactLockTableDelete(TransactionId xid)
-{
- LOCKTAG tag;
-
- if (LockingDisabled())
- return;
-
- MemSet(&tag, 0, sizeof(tag));
- tag.relId = XactLockTableId;
- tag.dbId = InvalidOid;
- tag.objId.xid = xid;
-
- LockRelease(LockTableId, &tag, xid, ExclusiveLock);
-}
-
-#endif
-
+/*
+ * XactLockTableWait
+ *
+ * Wait for the specified transaction to commit or abort.
+ */
void
XactLockTableWait(TransactionId xid)
{
LOCKTAG tag;
+ TransactionId myxid = GetCurrentTransactionId();
- if (LockingDisabled())
- return;
+ Assert(! TransactionIdEquals(xid, myxid));
MemSet(&tag, 0, sizeof(tag));
tag.relId = XactLockTableId;
tag.dbId = InvalidOid;
tag.objId.xid = xid;
- if (!LockAcquire(LockTableId, &tag, GetCurrentTransactionId(),
+ if (!LockAcquire(LockTableId, &tag, myxid,
ShareLock, false))
elog(ERROR, "XactLockTableWait: LockAcquire failed");
- LockRelease(LockTableId, &tag, GetCurrentTransactionId(), ShareLock);
+ LockRelease(LockTableId, &tag, myxid, ShareLock);
/*
* Transaction was committed/aborted/crashed - we have to update
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.94 2001/09/07 00:27:29 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.95 2001/09/27 16:29:12 tgl Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
static LOCKMASK BITS_OFF[MAX_LOCKMODES];
static LOCKMASK BITS_ON[MAX_LOCKMODES];
-/*
- * Disable flag
- */
-static bool LockingIsDisabled;
-
/*
* map from lockmethod to the lock table structure
*/
}
}
-/*
- * LockDisable -- sets LockingIsDisabled flag to TRUE or FALSE.
- */
-void
-LockDisable(bool status)
-{
- LockingIsDisabled = status;
-}
-
-/*
- * Boolean function to determine current locking status
- */
-bool
-LockingDisabled(void)
-{
- return LockingIsDisabled;
-}
/*
* Fetch the lock method table associated with a given lock
return FALSE;
}
- if (LockingIsDisabled)
- return TRUE;
-
masterLock = lockMethodTable->ctl->masterLock;
SpinAcquire(masterLock);
return FALSE;
}
- if (LockingIsDisabled)
- return TRUE;
-
masterLock = lockMethodTable->ctl->masterLock;
SpinAcquire(masterLock);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.233 2001/09/21 17:06:12 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.234 2001/09/27 16:29:12 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
printf("Developer options:\n");
printf(" -f [s|i|n|m|h] forbid use of some plan types\n");
printf(" -i do not execute queries\n");
- printf(" -L turn off locking\n");
printf(" -O allow system table structure changes\n");
printf(" -t [pa|pl|ex] show timings after each query\n");
printf(" -W NUM wait NUM seconds to allow attach from a debugger\n");
optind = 1; /* reset after postmaster's usage */
- while ((flag = getopt(argc, argv, "A:B:c:CD:d:Eef:FiLNOPo:p:S:st:v:W:x:-:")) != EOF)
+ while ((flag = getopt(argc, argv, "A:B:c:CD:d:Eef:FiNOPo:p:S:st:v:W:x:-:")) != EOF)
switch (flag)
{
case 'A':
dontExecute = true;
break;
- case 'L':
-
- /*
- * turn off locking
- */
- if (secure)
- lockingOff = 1;
- break;
-
case 'N':
/*
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.233 $ $Date: 2001/09/21 17:06:12 $\n");
+ puts("$Revision: 1.234 $ $Date: 2001/09/27 16:29:12 $\n");
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.91 2001/09/08 15:24:00 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.92 2001/09/27 16:29:12 tgl Exp $
*
*
*-------------------------------------------------------------------------
static void ShutdownPostgres(void);
static bool ThereIsAtLeastOneUser(void);
-int lockingOff = 0; /* backend -L switch */
-
/*** InitPostgres support ***/
/* replace faked-up relcache entries with the real info */
RelationCacheInitializePhase2();
- if (lockingOff)
- LockDisable(true);
-
/*
* Figure out our postgres user id. In standalone mode we use a
* fixed id, otherwise we figure it out from the authenticated
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: miscadmin.h,v 1.91 2001/09/21 03:32:36 tgl Exp $
+ * $Id: miscadmin.h,v 1.92 2001/09/27 16:29:13 tgl Exp $
*
* NOTES
* some of the information in this file should be moved to
* pmod.h -- *
* POSTGRES processing mode definitions. *
*****************************************************************************/
+
/*
* Description:
* There are three processing modes in POSTGRES. They are
NormalProcessing /* normal processing */
} ProcessingMode;
-
-/*****************************************************************************
- * pinit.h -- *
- * POSTGRES initialization and cleanup definitions. *
- *****************************************************************************/
-
-/* in utils/init/postinit.c */
-extern int lockingOff;
-
-extern void InitPostgres(const char *dbname, const char *username);
-extern void BaseInit(void);
-
-/* processing mode support stuff */
extern ProcessingMode Mode;
#define IsBootstrapProcessingMode() ((bool)(Mode == BootstrapProcessing))
#define GetProcessingMode() Mode
+
+/*****************************************************************************
+ * pinit.h -- *
+ * POSTGRES initialization and cleanup definitions. *
+ *****************************************************************************/
+
+/* in utils/init/postinit.c */
+extern void InitPostgres(const char *dbname, const char *username);
+extern void BaseInit(void);
+
+/* in utils/init/miscinit.c */
extern bool CreateDataDirLockFile(const char *datadir, bool amPostmaster);
extern bool CreateSocketLockFile(const char *socketfile, bool amPostmaster);
extern void TouchSocketLockFile(void);
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: lock.h,v 1.51 2001/07/09 22:18:34 tgl Exp $
+ * $Id: lock.h,v 1.52 2001/09/27 16:29:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* function prototypes
*/
extern void InitLocks(void);
-extern void LockDisable(bool status);
-extern bool LockingDisabled(void);
extern LOCKMETHODTABLE *GetLocksMethodTable(LOCK *lock);
extern LOCKMETHOD LockMethodTableInit(char *tabName, LOCKMASK *conflictsP,
int *prioP, int numModes, int maxBackends);