Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
3d59ad00
Commit
3d59ad00
authored
Sep 27, 2001
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove useless LockDisable() function and associated overhead, per my
proposal of 26-Aug.
parent
19656b74
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
127 deletions
+45
-127
doc/src/sgml/ref/postgres-ref.sgml
doc/src/sgml/ref/postgres-ref.sgml
+1
-12
src/backend/bootstrap/bootstrap.c
src/backend/bootstrap/bootstrap.c
+1
-2
src/backend/storage/lmgr/lmgr.c
src/backend/storage/lmgr/lmgr.c
+24
-48
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/lock.c
+1
-29
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+3
-13
src/backend/utils/init/postinit.c
src/backend/utils/init/postinit.c
+1
-6
src/include/miscadmin.h
src/include/miscadmin.h
+13
-14
src/include/storage/lock.h
src/include/storage/lock.h
+1
-3
No files found.
doc/src/sgml/ref/postgres-ref.sgml
View file @
3d59ad00
<!--
$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
-->
...
...
@@ -33,7 +33,6 @@ 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>
...
...
@@ -57,7 +56,6 @@ 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>-o <replaceable>filename</replaceable></arg>
<arg>-O</arg>
<arg>-p <replaceable>database</replaceable></arg>
...
...
@@ -293,15 +291,6 @@ Postgres documentation
</listitem>
</varlistentry>
<varlistentry>
<term>-L</term>
<listitem>
<para>
Turns off the locking system.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-O</term>
<listitem>
...
...
src/backend/bootstrap/bootstrap.c
View file @
3d59ad00
...
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.11
5 2001/08/25 00:31:17 petere
Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.11
6 2001/09/27 16:29:12 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -389,7 +389,6 @@ BootstrapMain(int argc, char *argv[])
* backend initialization
*/
InitPostgres
(
dbName
,
NULL
);
LockDisable
(
true
);
for
(
i
=
0
;
i
<
MAXATTR
;
i
++
)
{
...
...
src/backend/storage/lmgr/lmgr.c
View file @
3d59ad00
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.5
0 2001/08/25 18:52:4
2 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.5
1 2001/09/27 16:29:1
2 tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -145,9 +145,6 @@ LockRelation(Relation relation, 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
;
...
...
@@ -182,9 +179,6 @@ ConditionalLockRelation(Relation relation, LOCKMODE lockmode)
{
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
;
...
...
@@ -215,9 +209,6 @@ UnlockRelation(Relation relation, 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
;
...
...
@@ -243,9 +234,6 @@ LockRelationForSession(LockRelId *relid, LOCKMODE lockmode)
{
LOCKTAG
tag
;
if
(
LockingDisabled
())
return
;
MemSet
(
&
tag
,
0
,
sizeof
(
tag
));
tag
.
relId
=
relid
->
relId
;
tag
.
dbId
=
relid
->
dbId
;
...
...
@@ -264,9 +252,6 @@ UnlockRelationForSession(LockRelId *relid, LOCKMODE lockmode)
{
LOCKTAG
tag
;
if
(
LockingDisabled
())
return
;
MemSet
(
&
tag
,
0
,
sizeof
(
tag
));
tag
.
relId
=
relid
->
relId
;
tag
.
dbId
=
relid
->
dbId
;
...
...
@@ -277,15 +262,16 @@ UnlockRelationForSession(LockRelId *relid, LOCKMODE lockmode)
/*
* 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
;
...
...
@@ -304,9 +290,6 @@ UnlockPage(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
;
...
...
@@ -315,14 +298,21 @@ UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode)
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 */
...
...
@@ -333,43 +323,29 @@ XactLockTableInsert(TransactionId xid)
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
...
...
src/backend/storage/lmgr/lock.c
View file @
3d59ad00
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.9
4 2001/09/07 00:27:29
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.9
5 2001/09/27 16:29:12
tgl Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
...
...
@@ -165,11 +165,6 @@ SPINLOCK LockMgrLock; /* in Shmem or created in
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
*/
...
...
@@ -195,23 +190,6 @@ InitLocks(void)
}
}
/*
* 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
...
...
@@ -509,9 +487,6 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
return
FALSE
;
}
if
(
LockingIsDisabled
)
return
TRUE
;
masterLock
=
lockMethodTable
->
ctl
->
masterLock
;
SpinAcquire
(
masterLock
);
...
...
@@ -1047,9 +1022,6 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
return
FALSE
;
}
if
(
LockingIsDisabled
)
return
TRUE
;
masterLock
=
lockMethodTable
->
ctl
->
masterLock
;
SpinAcquire
(
masterLock
);
...
...
src/backend/tcop/postgres.c
View file @
3d59ad00
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.23
3 2001/09/21 17:06
:12 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.23
4 2001/09/27 16:29
:12 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
...
...
@@ -1096,7 +1096,6 @@ usage(char *progname)
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
"
);
...
...
@@ -1207,7 +1206,7 @@ PostgresMain(int argc, char *argv[],
optind
=
1
;
/* reset after postmaster's usage */
while
((
flag
=
getopt
(
argc
,
argv
,
"A:B:c:CD:d:Eef:Fi
L
NOPo: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'
:
...
...
@@ -1314,15 +1313,6 @@ PostgresMain(int argc, char *argv[],
dontExecute
=
true
;
break
;
case
'L'
:
/*
* turn off locking
*/
if
(
secure
)
lockingOff
=
1
;
break
;
case
'N'
:
/*
...
...
@@ -1726,7 +1716,7 @@ PostgresMain(int argc, char *argv[],
if
(
!
IsUnderPostmaster
)
{
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"$Revision: 1.23
3 $ $Date: 2001/09/21 17:06
:12 $
\n
"
);
puts
(
"$Revision: 1.23
4 $ $Date: 2001/09/27 16:29
:12 $
\n
"
);
}
/*
...
...
src/backend/utils/init/postinit.c
View file @
3d59ad00
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.9
1 2001/09/08 15:24:00 petere
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.9
2 2001/09/27 16:29:12 tgl
Exp $
*
*
*-------------------------------------------------------------------------
...
...
@@ -46,8 +46,6 @@ static void InitCommunication(void);
static
void
ShutdownPostgres
(
void
);
static
bool
ThereIsAtLeastOneUser
(
void
);
int
lockingOff
=
0
;
/* backend -L switch */
/*** InitPostgres support ***/
...
...
@@ -327,9 +325,6 @@ InitPostgres(const char *dbname, const char *username)
/* 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
...
...
src/include/miscadmin.h
View file @
3d59ad00
...
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: miscadmin.h,v 1.9
1 2001/09/21 03:32:36
tgl Exp $
* $Id: miscadmin.h,v 1.9
2 2001/09/27 16:29:13
tgl Exp $
*
* NOTES
* some of the information in this file should be moved to
...
...
@@ -236,6 +236,7 @@ extern bool is_dbadmin(Oid dbid); /* current user is owner of database */
* pmod.h -- *
* POSTGRES processing mode definitions. *
*****************************************************************************/
/*
* Description:
* There are three processing modes in POSTGRES. They are
...
...
@@ -262,19 +263,6 @@ typedef enum ProcessingMode
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))
...
...
@@ -291,6 +279,17 @@ extern ProcessingMode Mode;
#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
);
...
...
src/include/storage/lock.h
View file @
3d59ad00
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: lock.h,v 1.5
1 2001/07/09 22:18:34
tgl Exp $
* $Id: lock.h,v 1.5
2 2001/09/27 16:29:13
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -244,8 +244,6 @@ typedef struct HOLDER
* 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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment