1996-08-28 01:59:28 +00:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* lmgr.h--
|
1997-09-07 05:04:48 +00:00
|
|
|
* POSTGRES lock manager definitions.
|
1996-08-28 01:59:28 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
1998-09-01 04:40:42 +00:00
|
|
|
* $Id: lmgr.h,v 1.15 1998/09/01 04:38:23 momjian Exp $
|
1996-08-28 01:59:28 +00:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 05:04:48 +00:00
|
|
|
#ifndef LMGR_H
|
1996-08-28 01:59:28 +00:00
|
|
|
#define LMGR_H
|
|
|
|
|
1996-11-05 06:11:08 +00:00
|
|
|
#include <storage/lock.h>
|
|
|
|
#include <utils/rel.h>
|
1998-07-13 16:35:04 +00:00
|
|
|
#include <catalog/catname.h>
|
1996-08-28 01:59:28 +00:00
|
|
|
|
1997-09-07 05:04:48 +00:00
|
|
|
/*
|
1996-08-28 01:59:28 +00:00
|
|
|
* This was moved from pladt.h for the new lock manager. Want to obsolete
|
|
|
|
* all of the old code.
|
|
|
|
*/
|
1998-07-13 16:35:04 +00:00
|
|
|
typedef struct LockRelId
|
1997-09-07 05:04:48 +00:00
|
|
|
{
|
1997-09-08 02:41:22 +00:00
|
|
|
Oid relId; /* a relation identifier */
|
|
|
|
Oid dbId; /* a database identifier */
|
1998-09-01 04:40:42 +00:00
|
|
|
} LockRelId;
|
1996-08-28 01:59:28 +00:00
|
|
|
|
1998-08-01 15:26:38 +00:00
|
|
|
#ifdef LowLevelLocking
|
1997-09-07 05:04:48 +00:00
|
|
|
typedef struct LockInfoData
|
|
|
|
{
|
1998-07-13 16:35:04 +00:00
|
|
|
LockRelId lockRelId;
|
1998-09-01 04:40:42 +00:00
|
|
|
bool lockHeld[MAX_LOCKMODES]; /* on table level */
|
1997-09-08 21:56:23 +00:00
|
|
|
} LockInfoData;
|
1998-09-01 04:40:42 +00:00
|
|
|
|
1998-08-01 15:26:38 +00:00
|
|
|
#else
|
|
|
|
typedef struct LockInfoData
|
|
|
|
{
|
|
|
|
LockRelId lockRelId;
|
|
|
|
} LockInfoData;
|
1998-09-01 04:40:42 +00:00
|
|
|
|
1998-08-01 15:26:38 +00:00
|
|
|
#endif
|
1998-07-13 16:35:04 +00:00
|
|
|
|
1998-08-01 15:26:38 +00:00
|
|
|
typedef LockInfoData *LockInfo;
|
1996-08-28 01:59:28 +00:00
|
|
|
|
1998-08-01 15:26:38 +00:00
|
|
|
#define LockInfoIsValid(lockinfo) PointerIsValid(lockinfo)
|
1996-08-28 01:59:28 +00:00
|
|
|
|
1997-09-08 02:41:22 +00:00
|
|
|
extern void RelationInitLockInfo(Relation relation);
|
|
|
|
extern void RelationSetLockForDescriptorOpen(Relation relation);
|
|
|
|
extern void RelationSetLockForRead(Relation relation);
|
|
|
|
extern void RelationUnsetLockForRead(Relation relation);
|
|
|
|
extern void RelationSetLockForWrite(Relation relation);
|
|
|
|
extern void RelationUnsetLockForWrite(Relation relation);
|
1996-08-28 01:59:28 +00:00
|
|
|
|
|
|
|
/* used in vaccum.c */
|
1998-09-01 04:40:42 +00:00
|
|
|
extern void RelationSetLockForWritePage(Relation relation,
|
1997-09-07 05:04:48 +00:00
|
|
|
ItemPointer itemPointer);
|
1996-08-28 01:59:28 +00:00
|
|
|
|
|
|
|
/* used in nbtpage.c, hashpage.c */
|
1998-09-01 04:40:42 +00:00
|
|
|
extern void RelationSetSingleWLockPage(Relation relation,
|
1997-09-07 05:04:48 +00:00
|
|
|
ItemPointer itemPointer);
|
1998-09-01 04:40:42 +00:00
|
|
|
extern void RelationUnsetSingleWLockPage(Relation relation,
|
1997-09-07 05:04:48 +00:00
|
|
|
ItemPointer itemPointer);
|
1998-09-01 04:40:42 +00:00
|
|
|
extern void RelationSetSingleRLockPage(Relation relation,
|
1997-09-07 05:04:48 +00:00
|
|
|
ItemPointer itemPointer);
|
1998-09-01 04:40:42 +00:00
|
|
|
extern void RelationUnsetSingleRLockPage(Relation relation,
|
1997-09-07 05:04:48 +00:00
|
|
|
ItemPointer itemPointer);
|
1997-09-08 02:41:22 +00:00
|
|
|
extern void RelationSetRIntentLock(Relation relation);
|
|
|
|
extern void RelationUnsetRIntentLock(Relation relation);
|
|
|
|
extern void RelationSetWIntentLock(Relation relation);
|
|
|
|
extern void RelationUnsetWIntentLock(Relation relation);
|
1996-08-28 01:59:28 +00:00
|
|
|
|
|
|
|
/* single.c */
|
1998-07-13 16:35:04 +00:00
|
|
|
extern bool SingleLockReln(LockInfo lockinfo, LOCKMODE lockmode, int action);
|
1998-09-01 04:40:42 +00:00
|
|
|
extern bool SingleLockPage(LockInfo lockinfo, ItemPointer tidPtr,
|
1998-06-30 02:33:34 +00:00
|
|
|
LOCKMODE lockmode, int action);
|
1996-08-28 01:59:28 +00:00
|
|
|
|
1996-11-08 06:02:30 +00:00
|
|
|
/* proc.c */
|
1997-09-08 02:41:22 +00:00
|
|
|
extern void InitProcGlobal(IPCKey key);
|
1996-11-08 06:02:30 +00:00
|
|
|
|
1998-09-01 04:40:42 +00:00
|
|
|
#endif /* LMGR_H */
|