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
d75b2ec4
Commit
d75b2ec4
authored
Dec 20, 2003
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
This patch is the next step towards (re)allowing fork/exec.
Claudio Natoli
parent
1ee0ddf9
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
492 additions
and
218 deletions
+492
-218
src/backend/access/transam/xlog.c
src/backend/access/transam/xlog.c
+13
-14
src/backend/bootstrap/bootstrap.c
src/backend/bootstrap/bootstrap.c
+4
-3
src/backend/postmaster/pgstat.c
src/backend/postmaster/pgstat.c
+2
-2
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+228
-58
src/backend/storage/buffer/buf_init.c
src/backend/storage/buffer/buf_init.c
+5
-1
src/backend/storage/file/fd.c
src/backend/storage/file/fd.c
+7
-8
src/backend/storage/freespace/freespace.c
src/backend/storage/freespace/freespace.c
+14
-8
src/backend/storage/ipc/ipci.c
src/backend/storage/ipc/ipci.c
+26
-2
src/backend/storage/ipc/pmsignal.c
src/backend/storage/ipc/pmsignal.c
+4
-2
src/backend/storage/ipc/shmem.c
src/backend/storage/ipc/shmem.c
+82
-55
src/backend/storage/ipc/sinvaladt.c
src/backend/storage/ipc/sinvaladt.c
+5
-2
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/lock.c
+26
-22
src/backend/storage/lmgr/lwlock.c
src/backend/storage/lmgr/lwlock.c
+2
-2
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/proc.c
+3
-2
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+36
-25
src/include/access/xlogdefs.h
src/include/access/xlogdefs.h
+8
-1
src/include/c.h
src/include/c.h
+8
-1
src/include/libpq/libpq-be.h
src/include/libpq/libpq-be.h
+7
-1
src/include/storage/fd.h
src/include/storage/fd.h
+5
-1
src/include/storage/ipc.h
src/include/storage/ipc.h
+3
-1
src/include/storage/lock.h
src/include/storage/lock.h
+1
-3
src/include/storage/lwlock.h
src/include/storage/lwlock.h
+1
-2
src/include/storage/shmem.h
src/include/storage/shmem.h
+2
-2
No files found.
src/backend/access/transam/xlog.c
View file @
d75b2ec4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.12
8 2003/12/14 00:34:47 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.12
9 2003/12/20 17:31:20 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -166,7 +166,7 @@ XLogRecPtr ProcLastRecEnd = {0, 0};
...
@@ -166,7 +166,7 @@ XLogRecPtr ProcLastRecEnd = {0, 0};
* to update from XLogCtl->Insert.RedoRecPtr if we hold the info_lck;
* to update from XLogCtl->Insert.RedoRecPtr if we hold the info_lck;
* see GetRedoRecPtr.
* see GetRedoRecPtr.
*/
*/
static
XLogRecPtr
RedoRecPtr
;
NON_EXEC_STATIC
XLogRecPtr
RedoRecPtr
;
/*----------
/*----------
* Shared-memory data structures for XLOG control
* Shared-memory data structures for XLOG control
...
@@ -231,12 +231,6 @@ typedef struct XLogwrtRqst
...
@@ -231,12 +231,6 @@ typedef struct XLogwrtRqst
XLogRecPtr
Flush
;
/* last byte + 1 to flush */
XLogRecPtr
Flush
;
/* last byte + 1 to flush */
}
XLogwrtRqst
;
}
XLogwrtRqst
;
typedef
struct
XLogwrtResult
{
XLogRecPtr
Write
;
/* last byte + 1 written out */
XLogRecPtr
Flush
;
/* last byte + 1 flushed */
}
XLogwrtResult
;
/*
/*
* Shared state data for XLogInsert.
* Shared state data for XLogInsert.
*/
*/
...
@@ -404,7 +398,7 @@ static char ControlFilePath[MAXPGPATH];
...
@@ -404,7 +398,7 @@ static char ControlFilePath[MAXPGPATH];
* Private, possibly out-of-date copy of shared LogwrtResult.
* Private, possibly out-of-date copy of shared LogwrtResult.
* See discussion above.
* See discussion above.
*/
*/
static
XLogwrtResult
LogwrtResult
=
{{
0
,
0
},
{
0
,
0
}};
NON_EXEC_STATIC
XLogwrtResult
LogwrtResult
=
{{
0
,
0
},
{
0
,
0
}};
/*
/*
* openLogFile is -1 or a kernel FD for an open log file segment.
* openLogFile is -1 or a kernel FD for an open log file segment.
...
@@ -2398,7 +2392,7 @@ XLOGShmemSize(void)
...
@@ -2398,7 +2392,7 @@ XLOGShmemSize(void)
void
void
XLOGShmemInit
(
void
)
XLOGShmemInit
(
void
)
{
{
bool
found
;
bool
found
XLog
,
foundCFile
;
/* this must agree with space requested by XLOGShmemSize() */
/* this must agree with space requested by XLOGShmemSize() */
if
(
XLOGbuffers
<
MinXLOGbuffers
)
if
(
XLOGbuffers
<
MinXLOGbuffers
)
...
@@ -2409,11 +2403,16 @@ XLOGShmemInit(void)
...
@@ -2409,11 +2403,16 @@ XLOGShmemInit(void)
MAXALIGN
(
sizeof
(
XLogCtlData
)
+
MAXALIGN
(
sizeof
(
XLogCtlData
)
+
sizeof
(
XLogRecPtr
)
*
XLOGbuffers
)
sizeof
(
XLogRecPtr
)
*
XLOGbuffers
)
+
BLCKSZ
*
XLOGbuffers
,
+
BLCKSZ
*
XLOGbuffers
,
&
found
);
&
foundXLog
);
Assert
(
!
found
);
ControlFile
=
(
ControlFileData
*
)
ControlFile
=
(
ControlFileData
*
)
ShmemInitStruct
(
"Control File"
,
sizeof
(
ControlFileData
),
&
found
);
ShmemInitStruct
(
"Control File"
,
sizeof
(
ControlFileData
),
&
foundCFile
);
Assert
(
!
found
);
if
(
foundXLog
||
foundCFile
)
{
/* both should be present or neither */
Assert
(
foundXLog
&&
foundCFile
);
return
;
}
memset
(
XLogCtl
,
0
,
sizeof
(
XLogCtlData
));
memset
(
XLogCtl
,
0
,
sizeof
(
XLogCtlData
));
...
...
src/backend/bootstrap/bootstrap.c
View file @
d75b2ec4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.17
0 2003/12/12 18:45:08 petere
Exp $
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.17
1 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -347,9 +347,10 @@ BootstrapMain(int argc, char *argv[])
...
@@ -347,9 +347,10 @@ BootstrapMain(int argc, char *argv[])
if
(
!
dbname
||
argc
!=
optind
)
if
(
!
dbname
||
argc
!=
optind
)
usage
();
usage
();
#ifdef EXEC_BACKEND
if
(
IsUnderPostmaster
&&
ExecBackend
&&
MyProc
/* ordinary backend */
)
if
(
IsUnderPostmaster
&&
MyProc
/* ordinary backend */
)
AttachSharedMemoryAndSemaphores
();
AttachSharedMemoryAndSemaphores
();
#endif
if
(
!
IsUnderPostmaster
/* when exec || ExecBackend */
)
if
(
!
IsUnderPostmaster
/* when exec || ExecBackend */
)
{
{
...
...
src/backend/postmaster/pgstat.c
View file @
d75b2ec4
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
*
*
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
*
*
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.4
8 2003/11/29 19:51:55 pgsql
Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.4
9 2003/12/20 17:31:21 momjian
Exp $
* ----------
* ----------
*/
*/
#include "postgres.h"
#include "postgres.h"
...
@@ -71,7 +71,7 @@ bool pgstat_is_running = false;
...
@@ -71,7 +71,7 @@ bool pgstat_is_running = false;
* Local data
* Local data
* ----------
* ----------
*/
*/
static
int
pgStatSock
=
-
1
;
NON_EXEC_STATIC
int
pgStatSock
=
-
1
;
static
int
pgStatPipe
[
2
];
static
int
pgStatPipe
[
2
];
static
struct
sockaddr_storage
pgStatAddr
;
static
struct
sockaddr_storage
pgStatAddr
;
static
int
pgStatPmPipe
[
2
]
=
{
-
1
,
-
1
};
static
int
pgStatPmPipe
[
2
]
=
{
-
1
,
-
1
};
...
...
src/backend/postmaster/postmaster.c
View file @
d75b2ec4
This diff is collapsed.
Click to expand it.
src/backend/storage/buffer/buf_init.c
View file @
d75b2ec4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/buffer/buf_init.c,v 1.
59 2003/12/14 00:34:47 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/storage/buffer/buf_init.c,v 1.
60 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -125,7 +125,9 @@ InitBufferPool(void)
...
@@ -125,7 +125,9 @@ InitBufferPool(void)
* anyone else attached to the shmem at this point, we've got
* anyone else attached to the shmem at this point, we've got
* problems.
* problems.
*/
*/
#ifndef EXEC_BACKEND
LWLockAcquire
(
BufMgrLock
,
LW_EXCLUSIVE
);
LWLockAcquire
(
BufMgrLock
,
LW_EXCLUSIVE
);
#endif
BufferDescriptors
=
(
BufferDesc
*
)
BufferDescriptors
=
(
BufferDesc
*
)
ShmemInitStruct
(
"Buffer Descriptors"
,
ShmemInitStruct
(
"Buffer Descriptors"
,
...
@@ -177,7 +179,9 @@ InitBufferPool(void)
...
@@ -177,7 +179,9 @@ InitBufferPool(void)
/* Init other shared buffer-management stuff */
/* Init other shared buffer-management stuff */
StrategyInitialize
(
!
foundDescs
);
StrategyInitialize
(
!
foundDescs
);
#ifndef EXEC_BACKEND
LWLockRelease
(
BufMgrLock
);
LWLockRelease
(
BufMgrLock
);
#endif
}
}
/*
/*
...
...
src/backend/storage/file/fd.c
View file @
d75b2ec4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.10
4 2003/12/12 18:45:09 petere
Exp $
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.10
5 2003/12/20 17:31:21 momjian
Exp $
*
*
* NOTES:
* NOTES:
*
*
...
@@ -53,11 +53,6 @@
...
@@ -53,11 +53,6 @@
#include "storage/ipc.h"
#include "storage/ipc.h"
/* Filename components for OpenTemporaryFile */
#define PG_TEMP_FILES_DIR "pgsql_tmp"
#define PG_TEMP_FILE_PREFIX "pgsql_tmp"
/*
/*
* Problem: Postgres does a system(ld...) to do dynamic loading.
* Problem: Postgres does a system(ld...) to do dynamic loading.
* This will open several extra files in addition to those used by
* This will open several extra files in addition to those used by
...
@@ -1217,8 +1212,12 @@ RemovePgTempFiles(void)
...
@@ -1217,8 +1212,12 @@ RemovePgTempFiles(void)
{
{
while
((
db_de
=
readdir
(
db_dir
))
!=
NULL
)
while
((
db_de
=
readdir
(
db_dir
))
!=
NULL
)
{
{
if
(
strcmp
(
db_de
->
d_name
,
"."
)
==
0
||
if
(
strcmp
(
db_de
->
d_name
,
"."
)
==
0
strcmp
(
db_de
->
d_name
,
".."
)
==
0
)
#ifndef EXEC_BACKEND
/* no PG_TEMP_FILES_DIR in DataDir in non EXEC_BACKEND case */
||
strcmp
(
db_de
->
d_name
,
".."
)
==
0
#endif
)
continue
;
continue
;
snprintf
(
temp_path
,
sizeof
(
temp_path
),
snprintf
(
temp_path
,
sizeof
(
temp_path
),
...
...
src/backend/storage/freespace/freespace.c
View file @
d75b2ec4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/freespace/freespace.c,v 1.2
7 2003/12/12 18:45:09 petere
Exp $
* $PostgreSQL: pgsql/src/backend/storage/freespace/freespace.c,v 1.2
8 2003/12/20 17:31:21 momjian
Exp $
*
*
*
*
* NOTES:
* NOTES:
...
@@ -180,7 +180,6 @@ typedef struct FSMRelation FSMRelation;
...
@@ -180,7 +180,6 @@ typedef struct FSMRelation FSMRelation;
/* Header for whole map */
/* Header for whole map */
struct
FSMHeader
struct
FSMHeader
{
{
HTAB
*
relHash
;
/* hashtable of FSMRelation entries */
FSMRelation
*
usageList
;
/* FSMRelations in usage-recency order */
FSMRelation
*
usageList
;
/* FSMRelations in usage-recency order */
FSMRelation
*
usageListTail
;
/* tail of usage-recency list */
FSMRelation
*
usageListTail
;
/* tail of usage-recency list */
FSMRelation
*
firstRel
;
/* FSMRelations in arena storage order */
FSMRelation
*
firstRel
;
/* FSMRelations in arena storage order */
...
@@ -218,6 +217,7 @@ int MaxFSMRelations; /* these are set by guc.c */
...
@@ -218,6 +217,7 @@ int MaxFSMRelations; /* these are set by guc.c */
int
MaxFSMPages
;
int
MaxFSMPages
;
static
FSMHeader
*
FreeSpaceMap
;
/* points to FSMHeader in shared memory */
static
FSMHeader
*
FreeSpaceMap
;
/* points to FSMHeader in shared memory */
static
HTAB
*
FreeSpaceMapRelHash
;
/* points to (what used to be) FSMHeader->relHash */
static
FSMRelation
*
lookup_fsm_rel
(
RelFileNode
*
rel
);
static
FSMRelation
*
lookup_fsm_rel
(
RelFileNode
*
rel
);
...
@@ -265,13 +265,15 @@ InitFreeSpaceMap(void)
...
@@ -265,13 +265,15 @@ InitFreeSpaceMap(void)
{
{
HASHCTL
info
;
HASHCTL
info
;
int
nchunks
;
int
nchunks
;
bool
found
;
/* Create table header */
/* Create table header */
FreeSpaceMap
=
(
FSMHeader
*
)
Shmem
Alloc
(
sizeof
(
FSMHeader
)
);
FreeSpaceMap
=
(
FSMHeader
*
)
Shmem
InitStruct
(
"Free Space Map Header"
,
sizeof
(
FSMHeader
),
&
found
);
if
(
FreeSpaceMap
==
NULL
)
if
(
FreeSpaceMap
==
NULL
)
ereport
(
FATAL
,
ereport
(
FATAL
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
errmsg
(
"insufficient shared memory for free space map"
)));
errmsg
(
"insufficient shared memory for free space map"
)));
if
(
!
found
)
MemSet
(
FreeSpaceMap
,
0
,
sizeof
(
FSMHeader
));
MemSet
(
FreeSpaceMap
,
0
,
sizeof
(
FSMHeader
));
/* Create hashtable for FSMRelations */
/* Create hashtable for FSMRelations */
...
@@ -279,17 +281,21 @@ InitFreeSpaceMap(void)
...
@@ -279,17 +281,21 @@ InitFreeSpaceMap(void)
info
.
entrysize
=
sizeof
(
FSMRelation
);
info
.
entrysize
=
sizeof
(
FSMRelation
);
info
.
hash
=
tag_hash
;
info
.
hash
=
tag_hash
;
FreeSpaceMap
->
r
elHash
=
ShmemInitHash
(
"Free Space Map Hash"
,
FreeSpaceMap
R
elHash
=
ShmemInitHash
(
"Free Space Map Hash"
,
MaxFSMRelations
/
10
,
MaxFSMRelations
/
10
,
MaxFSMRelations
,
MaxFSMRelations
,
&
info
,
&
info
,
(
HASH_ELEM
|
HASH_FUNCTION
));
(
HASH_ELEM
|
HASH_FUNCTION
));
if
(
!
FreeSpaceMap
->
r
elHash
)
if
(
!
FreeSpaceMap
R
elHash
)
ereport
(
FATAL
,
ereport
(
FATAL
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
errmsg
(
"insufficient shared memory for free space map"
)));
errmsg
(
"insufficient shared memory for free space map"
)));
if
(
found
)
return
;
/* Allocate page-storage arena */
/* Allocate page-storage arena */
nchunks
=
(
MaxFSMPages
-
1
)
/
CHUNKPAGES
+
1
;
nchunks
=
(
MaxFSMPages
-
1
)
/
CHUNKPAGES
+
1
;
/* This check ensures spareChunks will be greater than zero */
/* This check ensures spareChunks will be greater than zero */
...
@@ -974,7 +980,7 @@ lookup_fsm_rel(RelFileNode *rel)
...
@@ -974,7 +980,7 @@ lookup_fsm_rel(RelFileNode *rel)
{
{
FSMRelation
*
fsmrel
;
FSMRelation
*
fsmrel
;
fsmrel
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
->
r
elHash
,
fsmrel
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
R
elHash
,
(
void
*
)
rel
,
(
void
*
)
rel
,
HASH_FIND
,
HASH_FIND
,
NULL
);
NULL
);
...
@@ -995,7 +1001,7 @@ create_fsm_rel(RelFileNode *rel)
...
@@ -995,7 +1001,7 @@ create_fsm_rel(RelFileNode *rel)
FSMRelation
*
fsmrel
;
FSMRelation
*
fsmrel
;
bool
found
;
bool
found
;
fsmrel
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
->
r
elHash
,
fsmrel
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
R
elHash
,
(
void
*
)
rel
,
(
void
*
)
rel
,
HASH_ENTER
,
HASH_ENTER
,
&
found
);
&
found
);
...
@@ -1050,7 +1056,7 @@ delete_fsm_rel(FSMRelation *fsmrel)
...
@@ -1050,7 +1056,7 @@ delete_fsm_rel(FSMRelation *fsmrel)
unlink_fsm_rel_usage
(
fsmrel
);
unlink_fsm_rel_usage
(
fsmrel
);
unlink_fsm_rel_storage
(
fsmrel
);
unlink_fsm_rel_storage
(
fsmrel
);
FreeSpaceMap
->
numRels
--
;
FreeSpaceMap
->
numRels
--
;
result
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
->
r
elHash
,
result
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
R
elHash
,
(
void
*
)
&
(
fsmrel
->
key
),
(
void
*
)
&
(
fsmrel
->
key
),
HASH_REMOVE
,
HASH_REMOVE
,
NULL
);
NULL
);
...
...
src/backend/storage/ipc/ipci.c
View file @
d75b2ec4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/ipc/ipci.c,v 1.
59 2003/12/01 21:59:25
momjian Exp $
* $PostgreSQL: pgsql/src/backend/storage/ipc/ipci.c,v 1.
60 2003/12/20 17:31:21
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -87,7 +87,7 @@ CreateSharedMemoryAndSemaphores(bool makePrivate,
...
@@ -87,7 +87,7 @@ CreateSharedMemoryAndSemaphores(bool makePrivate,
/*
/*
* Set up shared memory allocation mechanism
* Set up shared memory allocation mechanism
*/
*/
InitShmemAllocation
(
seghdr
);
InitShmemAllocation
(
seghdr
,
true
);
/*
/*
* Now initialize LWLocks, which do shared memory allocation and are
* Now initialize LWLocks, which do shared memory allocation and are
...
@@ -135,12 +135,36 @@ CreateSharedMemoryAndSemaphores(bool makePrivate,
...
@@ -135,12 +135,36 @@ CreateSharedMemoryAndSemaphores(bool makePrivate,
}
}
#ifdef EXEC_BACKEND
/*
/*
* AttachSharedMemoryAndSemaphores
* AttachSharedMemoryAndSemaphores
* Attaches to the existing shared resources.
* Attaches to the existing shared resources.
*/
*/
/* FIXME: [fork/exec] This function is starting to look pretty much like
CreateSharedMemoryAndSemaphores. Refactor? */
void
void
AttachSharedMemoryAndSemaphores
(
void
)
AttachSharedMemoryAndSemaphores
(
void
)
{
{
PGShmemHeader
*
seghdr
=
PGSharedMemoryCreate
(
-
1
,
false
,
-
1
);
InitShmemAllocation
(
seghdr
,
false
);
InitShmemIndex
();
XLOGShmemInit
();
CLOGShmemInit
();
CLOGShmemInit
();
InitBufferPool
();
InitLocks
();
InitLockTable
(
MaxBackends
);
InitProcGlobal
(
MaxBackends
);
CreateSharedInvalidationState
(
MaxBackends
);
InitFreeSpaceMap
();
PMSignalInit
();
}
}
#endif
src/backend/storage/ipc/pmsignal.c
View file @
d75b2ec4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/ipc/pmsignal.c,v 1.
6 2003/11/29 19:51:56 pgsql
Exp $
* $PostgreSQL: pgsql/src/backend/storage/ipc/pmsignal.c,v 1.
7 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -44,9 +44,11 @@ static volatile sig_atomic_t *PMSignalFlags;
...
@@ -44,9 +44,11 @@ static volatile sig_atomic_t *PMSignalFlags;
void
void
PMSignalInit
(
void
)
PMSignalInit
(
void
)
{
{
bool
found
;
PMSignalFlags
=
(
sig_atomic_t
*
)
PMSignalFlags
=
(
sig_atomic_t
*
)
Shmem
Alloc
(
NUM_PMSIGNALS
*
sizeof
(
sig_atomic_t
)
);
Shmem
InitStruct
(
"PMSignalFlags"
,
NUM_PMSIGNALS
*
sizeof
(
sig_atomic_t
),
&
found
);
if
(
!
found
)
MemSet
(
PMSignalFlags
,
0
,
NUM_PMSIGNALS
*
sizeof
(
sig_atomic_t
));
MemSet
(
PMSignalFlags
,
0
,
NUM_PMSIGNALS
*
sizeof
(
sig_atomic_t
));
}
}
...
...
src/backend/storage/ipc/shmem.c
View file @
d75b2ec4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.7
4 2003/11/29 19:51:56 pgsql
Exp $
* $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.7
5 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -74,7 +74,11 @@ SHMEM_OFFSET ShmemBase; /* start address of shared memory */
...
@@ -74,7 +74,11 @@ SHMEM_OFFSET ShmemBase; /* start address of shared memory */
static
SHMEM_OFFSET
ShmemEnd
;
/* end+1 address of shared memory */
static
SHMEM_OFFSET
ShmemEnd
;
/* end+1 address of shared memory */
static
slock_t
*
ShmemLock
;
/* spinlock for shared memory allocation */
NON_EXEC_STATIC
slock_t
*
ShmemLock
;
/* spinlock for shared memory allocation */
NON_EXEC_STATIC
slock_t
*
ShmemIndexLock
;
/* spinlock for ShmemIndex */
NON_EXEC_STATIC
void
*
ShmemIndexAlloc
=
NULL
;
/* Memory actually allocated for ShmemIndex */
static
HTAB
*
ShmemIndex
=
NULL
;
/* primary index hashtable for shmem */
static
HTAB
*
ShmemIndex
=
NULL
;
/* primary index hashtable for shmem */
...
@@ -88,7 +92,7 @@ static bool ShmemBootstrap = false; /* bootstrapping shmem index? */
...
@@ -88,7 +92,7 @@ static bool ShmemBootstrap = false; /* bootstrapping shmem index? */
* but we use void to avoid having to include ipc.h in shmem.h.
* but we use void to avoid having to include ipc.h in shmem.h.
*/
*/
void
void
InitShmemAllocation
(
void
*
seghdr
)
InitShmemAllocation
(
void
*
seghdr
,
bool
init
)
{
{
PGShmemHeader
*
shmhdr
=
(
PGShmemHeader
*
)
seghdr
;
PGShmemHeader
*
shmhdr
=
(
PGShmemHeader
*
)
seghdr
;
...
@@ -97,26 +101,34 @@ InitShmemAllocation(void *seghdr)
...
@@ -97,26 +101,34 @@ InitShmemAllocation(void *seghdr)
ShmemBase
=
(
SHMEM_OFFSET
)
shmhdr
;
ShmemBase
=
(
SHMEM_OFFSET
)
shmhdr
;
ShmemEnd
=
ShmemBase
+
shmhdr
->
totalsize
;
ShmemEnd
=
ShmemBase
+
shmhdr
->
totalsize
;
/*
if
(
init
)
* Initialize the spinlock used by ShmemAlloc. We have to do the
{
* space allocation the hard way, since ShmemAlloc can't be called
/*
* yet.
* Initialize the spinlocks used by ShmemAlloc/ShmemInitStruct. We
*/
* have to do the space allocation the hard way, since ShmemAlloc
ShmemLock
=
(
slock_t
*
)
(((
char
*
)
shmhdr
)
+
shmhdr
->
freeoffset
);
* can't be called yet.
shmhdr
->
freeoffset
+=
MAXALIGN
(
sizeof
(
slock_t
));
*/
Assert
(
shmhdr
->
freeoffset
<=
shmhdr
->
totalsize
);
ShmemLock
=
(
slock_t
*
)
(((
char
*
)
shmhdr
)
+
shmhdr
->
freeoffset
);
shmhdr
->
freeoffset
+=
MAXALIGN
(
sizeof
(
slock_t
));
SpinLockInit
(
ShmemLock
);
Assert
(
shmhdr
->
freeoffset
<=
shmhdr
->
totalsize
);
/* ShmemIndex can't be set up yet (need LWLocks first) */
ShmemIndexLock
=
(
slock_t
*
)
(((
char
*
)
shmhdr
)
+
shmhdr
->
freeoffset
);
ShmemIndex
=
(
HTAB
*
)
NULL
;
shmhdr
->
freeoffset
+=
MAXALIGN
(
sizeof
(
slock_t
));
Assert
(
shmhdr
->
freeoffset
<=
shmhdr
->
totalsize
);
/*
* Initialize ShmemVariableCache for transaction manager.
SpinLockInit
(
ShmemLock
);
*/
SpinLockInit
(
ShmemIndexLock
);
ShmemVariableCache
=
(
VariableCache
)
/* ShmemIndex can't be set up yet (need LWLocks first) */
ShmemIndex
=
(
HTAB
*
)
NULL
;
/*
* Initialize ShmemVariableCache for transaction manager.
*/
ShmemVariableCache
=
(
VariableCache
)
ShmemAlloc
(
sizeof
(
*
ShmemVariableCache
));
ShmemAlloc
(
sizeof
(
*
ShmemVariableCache
));
memset
(
ShmemVariableCache
,
0
,
sizeof
(
*
ShmemVariableCache
));
memset
(
ShmemVariableCache
,
0
,
sizeof
(
*
ShmemVariableCache
));
}
}
}
/*
/*
...
@@ -218,25 +230,28 @@ InitShmemIndex(void)
...
@@ -218,25 +230,28 @@ InitShmemIndex(void)
/*
/*
* Now, create an entry in the hashtable for the index itself.
* Now, create an entry in the hashtable for the index itself.
*/
*/
MemSet
(
item
.
key
,
0
,
SHMEM_INDEX_KEYSIZE
);
if
(
!
IsUnderPostmaster
)
strncpy
(
item
.
key
,
"ShmemIndex"
,
SHMEM_INDEX_KEYSIZE
);
{
MemSet
(
item
.
key
,
0
,
SHMEM_INDEX_KEYSIZE
);
result
=
(
ShmemIndexEnt
*
)
strncpy
(
item
.
key
,
"ShmemIndex"
,
SHMEM_INDEX_KEYSIZE
);
hash_search
(
ShmemIndex
,
(
void
*
)
&
item
,
HASH_ENTER
,
&
found
);
if
(
!
result
)
result
=
(
ShmemIndexEnt
*
)
ereport
(
FATAL
,
hash_search
(
ShmemIndex
,
(
void
*
)
&
item
,
HASH_ENTER
,
&
found
);
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
if
(
!
result
)
errmsg
(
"out of shared memory"
)));
ereport
(
FATAL
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
Assert
(
ShmemBootstrap
&&
!
found
);
errmsg
(
"out of shared memory"
)));
result
->
location
=
MAKE_OFFSET
(
ShmemIndex
->
hctl
);
Assert
(
ShmemBootstrap
&&
!
found
);
result
->
size
=
SHMEM_INDEX_SIZE
;
result
->
location
=
MAKE_OFFSET
(
ShmemIndex
->
hctl
);
ShmemBootstrap
=
false
;
result
->
size
=
SHMEM_INDEX_SIZE
;
ShmemBootstrap
=
false
;
}
/* now release the lock acquired in ShmemInitStruct */
/* now release the lock acquired in ShmemInitStruct */
LW
LockRelease
(
ShmemIndexLock
);
Spin
LockRelease
(
ShmemIndexLock
);
}
}
/*
/*
...
@@ -320,21 +335,33 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
...
@@ -320,21 +335,33 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
strncpy
(
item
.
key
,
name
,
SHMEM_INDEX_KEYSIZE
);
strncpy
(
item
.
key
,
name
,
SHMEM_INDEX_KEYSIZE
);
item
.
location
=
BAD_LOCATION
;
item
.
location
=
BAD_LOCATION
;
LWLockAcquire
(
ShmemIndexLock
,
LW_EXCLUSIVE
);
SpinLockAcquire
(
ShmemIndexLock
);
if
(
!
ShmemIndex
)
if
(
!
ShmemIndex
)
{
{
/*
if
(
IsUnderPostmaster
)
* If the shmem index doesn't exist, we are bootstrapping: we must
{
* be trying to init the shmem index itself.
/* Must be initializing a (non-standalone) backend */
*
Assert
(
strcmp
(
name
,
"ShmemIndex"
)
==
0
);
* Notice that the ShmemIndexLock is held until the shmem index has
Assert
(
ShmemBootstrap
);
* been completely initialized.
Assert
(
ShmemIndexAlloc
);
*/
*
foundPtr
=
TRUE
;
Assert
(
strcmp
(
name
,
"ShmemIndex"
)
==
0
);
}
Assert
(
ShmemBootstrap
);
else
*
foundPtr
=
FALSE
;
{
return
ShmemAlloc
(
size
);
/*
* If the shmem index doesn't exist, we are bootstrapping: we must
* be trying to init the shmem index itself.
*
* Notice that the ShmemIndexLock is held until the shmem index has
* been completely initialized.
*/
Assert
(
strcmp
(
name
,
"ShmemIndex"
)
==
0
);
Assert
(
ShmemBootstrap
);
*
foundPtr
=
FALSE
;
ShmemIndexAlloc
=
ShmemAlloc
(
size
);
}
return
ShmemIndexAlloc
;
}
}
/* look it up in the shmem index */
/* look it up in the shmem index */
...
@@ -343,7 +370,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
...
@@ -343,7 +370,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
if
(
!
result
)
if
(
!
result
)
{
{
LW
LockRelease
(
ShmemIndexLock
);
Spin
LockRelease
(
ShmemIndexLock
);
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
errmsg
(
"out of shared memory"
)));
errmsg
(
"out of shared memory"
)));
...
@@ -359,7 +386,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
...
@@ -359,7 +386,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
*/
*/
if
(
result
->
size
!=
size
)
if
(
result
->
size
!=
size
)
{
{
LW
LockRelease
(
ShmemIndexLock
);
Spin
LockRelease
(
ShmemIndexLock
);
elog
(
WARNING
,
"ShmemIndex entry size is wrong"
);
elog
(
WARNING
,
"ShmemIndex entry size is wrong"
);
/* let caller print its message too */
/* let caller print its message too */
...
@@ -376,7 +403,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
...
@@ -376,7 +403,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
/* out of memory */
/* out of memory */
Assert
(
ShmemIndex
);
Assert
(
ShmemIndex
);
hash_search
(
ShmemIndex
,
(
void
*
)
&
item
,
HASH_REMOVE
,
NULL
);
hash_search
(
ShmemIndex
,
(
void
*
)
&
item
,
HASH_REMOVE
,
NULL
);
LW
LockRelease
(
ShmemIndexLock
);
Spin
LockRelease
(
ShmemIndexLock
);
ereport
(
WARNING
,
ereport
(
WARNING
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
...
@@ -389,6 +416,6 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
...
@@ -389,6 +416,6 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
}
}
Assert
(
ShmemIsValid
((
unsigned
long
)
structPtr
));
Assert
(
ShmemIsValid
((
unsigned
long
)
structPtr
));
LW
LockRelease
(
ShmemIndexLock
);
Spin
LockRelease
(
ShmemIndexLock
);
return
structPtr
;
return
structPtr
;
}
}
src/backend/storage/ipc/sinvaladt.c
View file @
d75b2ec4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.5
3 2003/11/29 19:51:56 pgsql
Exp $
* $PostgreSQL: pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.5
4 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -50,10 +50,13 @@ SIBufferInit(int maxBackends)
...
@@ -50,10 +50,13 @@ SIBufferInit(int maxBackends)
int
segSize
;
int
segSize
;
SISeg
*
segP
;
SISeg
*
segP
;
int
i
;
int
i
;
bool
found
;
/* Allocate space in shared memory */
/* Allocate space in shared memory */
segSize
=
SInvalShmemSize
(
maxBackends
);
segSize
=
SInvalShmemSize
(
maxBackends
);
shmInvalBuffer
=
segP
=
(
SISeg
*
)
ShmemAlloc
(
segSize
);
shmInvalBuffer
=
segP
=
(
SISeg
*
)
ShmemInitStruct
(
"shmInvalBuffer"
,
segSize
,
&
found
);
if
(
found
)
return
;
/* Clear message counters, save size of procState array */
/* Clear message counters, save size of procState array */
segP
->
minMsgNum
=
0
;
segP
->
minMsgNum
=
0
;
...
...
src/backend/storage/lmgr/lock.c
View file @
d75b2ec4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.13
0 2003/12/01 21:59:25
momjian Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.13
1 2003/12/20 17:31:21
momjian Exp $
*
*
* NOTES
* NOTES
* Outside modules can create a lock table and acquire/release
* Outside modules can create a lock table and acquire/release
...
@@ -153,9 +153,11 @@ PROCLOCK_PRINT(const char *where, const PROCLOCK *proclockP)
...
@@ -153,9 +153,11 @@ PROCLOCK_PRINT(const char *where, const PROCLOCK *proclockP)
* map from lock method id to the lock table structure
* map from lock method id to the lock table structure
*/
*/
static
LockMethod
LockMethods
[
MAX_LOCK_METHODS
];
static
LockMethod
LockMethods
[
MAX_LOCK_METHODS
];
static
HTAB
*
LockMethodLockHash
[
MAX_LOCK_METHODS
];
static
HTAB
*
LockMethodProcLockHash
[
MAX_LOCK_METHODS
];
static
int
NumLockMethods
;
static
int
NumLockMethods
;
/*
/*
* InitLocks -- Init the lock module. Create a private data
* InitLocks -- Init the lock module. Create a private data
* structure for constructing conflict masks.
* structure for constructing conflict masks.
...
@@ -245,8 +247,9 @@ LockMethodTableInit(char *tabName,
...
@@ -245,8 +247,9 @@ LockMethodTableInit(char *tabName,
/*
/*
* Lock the LWLock for the table (probably not necessary here)
* Lock the LWLock for the table (probably not necessary here)
*/
*/
#ifndef EXEC_BACKEND
LWLockAcquire
(
LockMgrLock
,
LW_EXCLUSIVE
);
LWLockAcquire
(
LockMgrLock
,
LW_EXCLUSIVE
);
#endif
/*
/*
* no zero-th table
* no zero-th table
*/
*/
...
@@ -279,15 +282,15 @@ LockMethodTableInit(char *tabName,
...
@@ -279,15 +282,15 @@ LockMethodTableInit(char *tabName,
hash_flags
=
(
HASH_ELEM
|
HASH_FUNCTION
);
hash_flags
=
(
HASH_ELEM
|
HASH_FUNCTION
);
sprintf
(
shmemName
,
"%s (lock hash)"
,
tabName
);
sprintf
(
shmemName
,
"%s (lock hash)"
,
tabName
);
newLockMethod
->
lockHash
=
ShmemInitHash
(
shmemName
,
LockMethodLockHash
[
NumLockMethods
-
1
]
=
ShmemInitHash
(
shmemName
,
init_table_size
,
init_table_size
,
max_table_size
,
max_table_size
,
&
info
,
&
info
,
hash_flags
);
hash_flags
);
if
(
!
newLockMethod
->
lockHash
)
if
(
!
LockMethodLockHash
[
NumLockMethods
-
1
]
)
elog
(
FATAL
,
"could not initialize lock table
\"
%s
\"
"
,
tabName
);
elog
(
FATAL
,
"could not initialize lock table
\"
%s
\"
"
,
tabName
);
Assert
(
newLockMethod
->
lockHash
->
hash
==
tag_hash
);
Assert
(
LockMethodLockHash
[
NumLockMethods
-
1
]
->
hash
==
tag_hash
);
/*
/*
* allocate a hash table for PROCLOCK structs. This is used to store
* allocate a hash table for PROCLOCK structs. This is used to store
...
@@ -299,20 +302,21 @@ LockMethodTableInit(char *tabName,
...
@@ -299,20 +302,21 @@ LockMethodTableInit(char *tabName,
hash_flags
=
(
HASH_ELEM
|
HASH_FUNCTION
);
hash_flags
=
(
HASH_ELEM
|
HASH_FUNCTION
);
sprintf
(
shmemName
,
"%s (proclock hash)"
,
tabName
);
sprintf
(
shmemName
,
"%s (proclock hash)"
,
tabName
);
newLockMethod
->
proclockHash
=
ShmemInitHash
(
shmemName
,
LockMethodProcLockHash
[
NumLockMethods
-
1
]
=
ShmemInitHash
(
shmemName
,
init_table_size
,
init_table_size
,
max_table_size
,
max_table_size
,
&
info
,
&
info
,
hash_flags
);
hash_flags
);
if
(
!
newLockMethod
->
proclockHash
)
if
(
!
LockMethodProcLockHash
[
NumLockMethods
-
1
]
)
elog
(
FATAL
,
"could not initialize lock table
\"
%s
\"
"
,
tabName
);
elog
(
FATAL
,
"could not initialize lock table
\"
%s
\"
"
,
tabName
);
/* init data structures */
/* init data structures */
LockMethodInit
(
newLockMethod
,
conflictsP
,
numModes
);
LockMethodInit
(
newLockMethod
,
conflictsP
,
numModes
);
#ifndef EXEC_BACKEND
LWLockRelease
(
LockMgrLock
);
LWLockRelease
(
LockMgrLock
);
#endif
pfree
(
shmemName
);
pfree
(
shmemName
);
return
newLockMethod
->
lockmethodid
;
return
newLockMethod
->
lockmethodid
;
...
@@ -449,8 +453,8 @@ LockAcquire(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
...
@@ -449,8 +453,8 @@ LockAcquire(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
/*
/*
* Find or create a lock with this tag
* Find or create a lock with this tag
*/
*/
Assert
(
lockMethodTable
->
lockHash
->
hash
==
tag_hash
);
Assert
(
LockMethodLockHash
[
lockmethodid
]
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
lockMethodTable
->
lockHash
,
lock
=
(
LOCK
*
)
hash_search
(
LockMethodLockHash
[
lockmethodid
]
,
(
void
*
)
locktag
,
(
void
*
)
locktag
,
HASH_ENTER
,
&
found
);
HASH_ENTER
,
&
found
);
if
(
!
lock
)
if
(
!
lock
)
...
@@ -497,7 +501,7 @@ LockAcquire(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
...
@@ -497,7 +501,7 @@ LockAcquire(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
/*
/*
* Find or create a proclock entry with this tag
* Find or create a proclock entry with this tag
*/
*/
proclockTable
=
lockMethodTable
->
proclockHash
;
proclockTable
=
LockMethodProcLockHash
[
lockmethodid
]
;
proclock
=
(
PROCLOCK
*
)
hash_search
(
proclockTable
,
proclock
=
(
PROCLOCK
*
)
hash_search
(
proclockTable
,
(
void
*
)
&
proclocktag
,
(
void
*
)
&
proclocktag
,
HASH_ENTER
,
&
found
);
HASH_ENTER
,
&
found
);
...
@@ -988,8 +992,8 @@ LockRelease(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
...
@@ -988,8 +992,8 @@ LockRelease(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
/*
/*
* Find a lock with this tag
* Find a lock with this tag
*/
*/
Assert
(
lockMethodTable
->
lockHash
->
hash
==
tag_hash
);
Assert
(
LockMethodLockHash
[
lockmethodid
]
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
lockMethodTable
->
lockHash
,
lock
=
(
LOCK
*
)
hash_search
(
LockMethodLockHash
[
lockmethodid
]
,
(
void
*
)
locktag
,
(
void
*
)
locktag
,
HASH_FIND
,
NULL
);
HASH_FIND
,
NULL
);
...
@@ -1014,7 +1018,7 @@ LockRelease(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
...
@@ -1014,7 +1018,7 @@ LockRelease(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
proclocktag
.
proc
=
MAKE_OFFSET
(
MyProc
);
proclocktag
.
proc
=
MAKE_OFFSET
(
MyProc
);
TransactionIdStore
(
xid
,
&
proclocktag
.
xid
);
TransactionIdStore
(
xid
,
&
proclocktag
.
xid
);
proclockTable
=
lockMethodTable
->
proclockHash
;
proclockTable
=
LockMethodProcLockHash
[
lockmethodid
]
;
proclock
=
(
PROCLOCK
*
)
hash_search
(
proclockTable
,
proclock
=
(
PROCLOCK
*
)
hash_search
(
proclockTable
,
(
void
*
)
&
proclocktag
,
(
void
*
)
&
proclocktag
,
HASH_FIND_SAVE
,
NULL
);
HASH_FIND_SAVE
,
NULL
);
...
@@ -1086,8 +1090,8 @@ LockRelease(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
...
@@ -1086,8 +1090,8 @@ LockRelease(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
* if there's no one waiting in the queue, we just released the
* if there's no one waiting in the queue, we just released the
* last lock on this object. Delete it from the lock table.
* last lock on this object. Delete it from the lock table.
*/
*/
Assert
(
lockMethodTable
->
lockHash
->
hash
==
tag_hash
);
Assert
(
LockMethodLockHash
[
lockmethodid
]
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
lockMethodTable
->
lockHash
,
lock
=
(
LOCK
*
)
hash_search
(
LockMethodLockHash
[
lockmethodid
]
,
(
void
*
)
&
(
lock
->
tag
),
(
void
*
)
&
(
lock
->
tag
),
HASH_REMOVE
,
HASH_REMOVE
,
NULL
);
NULL
);
...
@@ -1269,7 +1273,7 @@ LockReleaseAll(LOCKMETHODID lockmethodid, PGPROC *proc,
...
@@ -1269,7 +1273,7 @@ LockReleaseAll(LOCKMETHODID lockmethodid, PGPROC *proc,
/*
/*
* remove the proclock entry from the hashtable
* remove the proclock entry from the hashtable
*/
*/
proclock
=
(
PROCLOCK
*
)
hash_search
(
lockMethodTable
->
proclockHash
,
proclock
=
(
PROCLOCK
*
)
hash_search
(
LockMethodProcLockHash
[
lockmethodid
]
,
(
void
*
)
proclock
,
(
void
*
)
proclock
,
HASH_REMOVE
,
HASH_REMOVE
,
NULL
);
NULL
);
...
@@ -1287,8 +1291,8 @@ LockReleaseAll(LOCKMETHODID lockmethodid, PGPROC *proc,
...
@@ -1287,8 +1291,8 @@ LockReleaseAll(LOCKMETHODID lockmethodid, PGPROC *proc,
* lock object.
* lock object.
*/
*/
LOCK_PRINT
(
"LockReleaseAll: deleting"
,
lock
,
0
);
LOCK_PRINT
(
"LockReleaseAll: deleting"
,
lock
,
0
);
Assert
(
lockMethodTable
->
lockHash
->
hash
==
tag_hash
);
Assert
(
LockMethodLockHash
[
lockmethodid
]
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
lockMethodTable
->
lockHash
,
lock
=
(
LOCK
*
)
hash_search
(
LockMethodLockHash
[
lockmethodid
]
,
(
void
*
)
&
(
lock
->
tag
),
(
void
*
)
&
(
lock
->
tag
),
HASH_REMOVE
,
NULL
);
HASH_REMOVE
,
NULL
);
if
(
!
lock
)
if
(
!
lock
)
...
@@ -1367,7 +1371,7 @@ GetLockStatusData(void)
...
@@ -1367,7 +1371,7 @@ GetLockStatusData(void)
LWLockAcquire
(
LockMgrLock
,
LW_EXCLUSIVE
);
LWLockAcquire
(
LockMgrLock
,
LW_EXCLUSIVE
);
proclockTable
=
LockMethod
s
[
DEFAULT_LOCKMETHOD
]
->
proclockHash
;
proclockTable
=
LockMethod
ProcLockHash
[
DEFAULT_LOCKMETHOD
]
;
data
->
nelements
=
i
=
proclockTable
->
hctl
->
nentries
;
data
->
nelements
=
i
=
proclockTable
->
hctl
->
nentries
;
...
@@ -1480,7 +1484,7 @@ DumpAllLocks(void)
...
@@ -1480,7 +1484,7 @@ DumpAllLocks(void)
if
(
!
lockMethodTable
)
if
(
!
lockMethodTable
)
return
;
return
;
proclockTable
=
lockMethodTable
->
proclockHash
;
proclockTable
=
LockMethodProcLockHash
[
lockmethodid
]
;
if
(
proc
->
waitLock
)
if
(
proc
->
waitLock
)
LOCK_PRINT
(
"DumpAllLocks: waiting on"
,
proc
->
waitLock
,
0
);
LOCK_PRINT
(
"DumpAllLocks: waiting on"
,
proc
->
waitLock
,
0
);
...
...
src/backend/storage/lmgr/lwlock.c
View file @
d75b2ec4
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lwlock.c,v 1.1
8 2003/11/29 19:51:57 pgsql
Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lwlock.c,v 1.1
9 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -43,7 +43,7 @@ typedef struct LWLock
...
@@ -43,7 +43,7 @@ typedef struct LWLock
* the pointer by fork from the postmaster. LWLockIds are indexes into
* the pointer by fork from the postmaster. LWLockIds are indexes into
* the array.
* the array.
*/
*/
static
LWLock
*
LWLockArray
=
NULL
;
NON_EXEC_STATIC
LWLock
*
LWLockArray
=
NULL
;
/* shared counter for dynamic allocation of LWLockIds */
/* shared counter for dynamic allocation of LWLockIds */
static
int
*
LWLockCounter
;
static
int
*
LWLockCounter
;
...
...
src/backend/storage/lmgr/proc.c
View file @
d75b2ec4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.14
0 2003/12/12 18:45:09 petere
Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.14
1 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -66,7 +66,7 @@ PGPROC *MyProc = NULL;
...
@@ -66,7 +66,7 @@ PGPROC *MyProc = NULL;
* relatively infrequently (only at backend startup or shutdown) and not for
* relatively infrequently (only at backend startup or shutdown) and not for
* very long, so a spinlock is okay.
* very long, so a spinlock is okay.
*/
*/
static
slock_t
*
ProcStructLock
=
NULL
;
NON_EXEC_STATIC
slock_t
*
ProcStructLock
=
NULL
;
static
PROC_HDR
*
ProcGlobal
=
NULL
;
static
PROC_HDR
*
ProcGlobal
=
NULL
;
...
@@ -248,6 +248,7 @@ InitProcess(void)
...
@@ -248,6 +248,7 @@ InitProcess(void)
MyProc
->
waitHolder
=
NULL
;
MyProc
->
waitHolder
=
NULL
;
SHMQueueInit
(
&
(
MyProc
->
procHolders
));
SHMQueueInit
(
&
(
MyProc
->
procHolders
));
/*
/*
* Arrange to clean up at backend exit.
* Arrange to clean up at backend exit.
*/
*/
...
...
src/backend/tcop/postgres.c
View file @
d75b2ec4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.3
79 2003/12/01 22:15:37 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.3
80 2003/12/20 17:31:21 momjian
Exp $
*
*
* NOTES
* NOTES
* this is the "main" module of the postgres backend and
* this is the "main" module of the postgres backend and
...
@@ -68,6 +68,10 @@
...
@@ -68,6 +68,10 @@
extern
int
optind
;
extern
int
optind
;
extern
char
*
optarg
;
extern
char
*
optarg
;
#ifdef EXEC_BACKEND
extern
bool
BackendInit
(
Port
*
);
extern
void
read_backend_variables
(
pid_t
,
Port
*
);
#endif
/* ----------------
/* ----------------
* global variables
* global variables
...
@@ -2052,7 +2056,6 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -2052,7 +2056,6 @@ PostgresMain(int argc, char *argv[], const char *username)
* initialize globals (already done if under postmaster, but not if
* initialize globals (already done if under postmaster, but not if
* standalone; cheap enough to do over)
* standalone; cheap enough to do over)
*/
*/
MyProcPid
=
getpid
();
MyProcPid
=
getpid
();
/*
/*
...
@@ -2060,7 +2063,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -2060,7 +2063,7 @@ PostgresMain(int argc, char *argv[], const char *username)
*
*
* If we are running under the postmaster, this is done already.
* If we are running under the postmaster, this is done already.
*/
*/
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
/* when exec || ExecBackend */
)
MemoryContextInit
();
MemoryContextInit
();
set_ps_display
(
"startup"
);
set_ps_display
(
"startup"
);
...
@@ -2268,7 +2271,6 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -2268,7 +2271,6 @@ PostgresMain(int argc, char *argv[], const char *username)
break
;
break
;
case
'p'
:
case
'p'
:
/*
/*
* p - special flag passed if backend was forked by a
* p - special flag passed if backend was forked by a
* postmaster.
* postmaster.
...
@@ -2276,23 +2278,11 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -2276,23 +2278,11 @@ PostgresMain(int argc, char *argv[], const char *username)
if
(
secure
)
if
(
secure
)
{
{
#ifdef EXEC_BACKEND
#ifdef EXEC_BACKEND
char
*
p
;
IsUnderPostmaster
=
true
;
int
i
;
int
PMcanAcceptConnections
;
/* will eventually be
* global or static,
* when fork */
sscanf
(
optarg
,
"%d,%d,%lu,%p,"
,
&
MyProcPort
->
sock
,
&
PMcanAcceptConnections
,
&
UsedShmemSegID
,
&
UsedShmemSegAddr
);
/* Grab dbname as last param */
for
(
i
=
0
,
p
=
optarg
-
1
;
i
<
4
&&
p
;
i
++
)
p
=
strchr
(
p
+
1
,
','
);
if
(
i
==
4
&&
p
)
dbname
=
strdup
(
p
+
1
);
#else
#else
dbname
=
strdup
(
optarg
);
dbname
=
strdup
(
optarg
);
#endif
#endif
secure
=
false
;
/* subsequent switches are NOT
secure
=
false
;
/* subsequent switches are NOT
* secure */
* secure */
ctx
=
PGC_BACKEND
;
ctx
=
PGC_BACKEND
;
...
@@ -2477,7 +2467,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -2477,7 +2467,7 @@ PostgresMain(int argc, char *argv[], const char *username)
SetConfigOption
(
"log_statement_stats"
,
"false"
,
ctx
,
gucsource
);
SetConfigOption
(
"log_statement_stats"
,
"false"
,
ctx
,
gucsource
);
}
}
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
||
ExecBackend
)
{
{
if
(
!
potential_DataDir
)
if
(
!
potential_DataDir
)
{
{
...
@@ -2497,10 +2487,27 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -2497,10 +2487,27 @@ PostgresMain(int argc, char *argv[], const char *username)
if
(
IsUnderPostmaster
)
if
(
IsUnderPostmaster
)
{
{
#ifdef EXEC_BACKEND
#ifdef EXEC_BACKEND
Port
*
port
=
(
Port
*
)
malloc
(
sizeof
(
Port
));
if
(
port
==
NULL
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
errmsg
(
"insufficient memory to allocate port"
)));
read_nondefault_variables
();
read_nondefault_variables
();
read_backend_variables
(
getpid
(),
port
);
/* FIXME: [fork/exec] Ugh */
load_hba
();
load_ident
();
load_user
();
load_group
();
if
(
!
BackendInit
(
port
))
return
-
1
;
dbname
=
port
->
database_name
;
#endif
#endif
}
}
else
else
ProcessConfigFile
(
PGC_POSTMASTER
);
ProcessConfigFile
(
PGC_POSTMASTER
);
/*
/*
...
@@ -2517,7 +2524,6 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -2517,7 +2524,6 @@ PostgresMain(int argc, char *argv[], const char *username)
* course, this isn't an issue for signals that are locally generated,
* course, this isn't an issue for signals that are locally generated,
* such as SIGALRM and SIGPIPE.)
* such as SIGALRM and SIGPIPE.)
*/
*/
pqsignal
(
SIGHUP
,
SigHupHandler
);
/* set flag to read config file */
pqsignal
(
SIGHUP
,
SigHupHandler
);
/* set flag to read config file */
pqsignal
(
SIGINT
,
StatementCancelHandler
);
/* cancel current query */
pqsignal
(
SIGINT
,
StatementCancelHandler
);
/* cancel current query */
pqsignal
(
SIGTERM
,
die
);
/* cancel current query and exit */
pqsignal
(
SIGTERM
,
die
);
/* cancel current query and exit */
...
@@ -2565,10 +2571,12 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -2565,10 +2571,12 @@ PostgresMain(int argc, char *argv[], const char *username)
errmsg
(
"invalid command-line arguments for server process"
),
errmsg
(
"invalid command-line arguments for server process"
),
errhint
(
"Try
\"
%s --help
\"
for more information."
,
argv
[
0
])));
errhint
(
"Try
\"
%s --help
\"
for more information."
,
argv
[
0
])));
}
}
BaseInit
();
#ifdef EXEC_BACKEND
#ifdef EXECBACKEND
AttachSharedMemoryAndSemaphores
();
AttachSharedMemoryAndSemaphores
();
#endif
#endif
XLOGPathInit
();
BaseInit
();
}
}
else
else
{
{
...
@@ -2845,7 +2853,11 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -2845,7 +2853,11 @@ PostgresMain(int argc, char *argv[], const char *username)
if
(
got_SIGHUP
)
if
(
got_SIGHUP
)
{
{
got_SIGHUP
=
false
;
got_SIGHUP
=
false
;
#ifdef EXEC_BACKEND
read_nondefault_variables
();
#else
ProcessConfigFile
(
PGC_SIGHUP
);
ProcessConfigFile
(
PGC_SIGHUP
);
#endif
}
}
/*
/*
...
@@ -3199,4 +3211,3 @@ ShowUsage(const char *title)
...
@@ -3199,4 +3211,3 @@ ShowUsage(const char *title)
pfree
(
str
.
data
);
pfree
(
str
.
data
);
}
}
src/include/access/xlogdefs.h
View file @
d75b2ec4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/access/xlogdefs.h,v 1.1
0 2003/11/29 22:40:55 pgsql
Exp $
* $PostgreSQL: pgsql/src/include/access/xlogdefs.h,v 1.1
1 2003/12/20 17:31:21 momjian
Exp $
*/
*/
#ifndef XLOG_DEFS_H
#ifndef XLOG_DEFS_H
#define XLOG_DEFS_H
#define XLOG_DEFS_H
...
@@ -33,6 +33,13 @@ typedef struct XLogRecPtr
...
@@ -33,6 +33,13 @@ typedef struct XLogRecPtr
uint32
xrecoff
;
/* byte offset of location in log file */
uint32
xrecoff
;
/* byte offset of location in log file */
}
XLogRecPtr
;
}
XLogRecPtr
;
typedef
struct
XLogwrtResult
{
XLogRecPtr
Write
;
/* last byte + 1 written out */
XLogRecPtr
Flush
;
/* last byte + 1 flushed */
}
XLogwrtResult
;
/*
/*
* Macros for comparing XLogRecPtrs
* Macros for comparing XLogRecPtrs
*
*
...
...
src/include/c.h
View file @
d75b2ec4
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/c.h,v 1.15
7 2003/11/29 22:40:53 pgsql
Exp $
* $PostgreSQL: pgsql/src/include/c.h,v 1.15
8 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -793,6 +793,13 @@ extern int fdatasync(int fildes);
...
@@ -793,6 +793,13 @@ extern int fdatasync(int fildes);
#define HAVE_STRTOULL 1
#define HAVE_STRTOULL 1
#endif
#endif
/* EXEC_BACKEND defines */
#ifdef EXEC_BACKEND
#define NON_EXEC_STATIC
#else
#define NON_EXEC_STATIC static
#endif
/* /port compatibility functions */
/* /port compatibility functions */
#include "port.h"
#include "port.h"
...
...
src/include/libpq/libpq-be.h
View file @
d75b2ec4
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.3
8 2003/11/29 22:41:03 pgsql
Exp $
* $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.3
9 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -27,6 +27,11 @@
...
@@ -27,6 +27,11 @@
#endif
#endif
typedef
enum
CAC_state
{
CAC_OK
,
CAC_STARTUP
,
CAC_SHUTDOWN
,
CAC_RECOVERY
,
CAC_TOOMANY
}
CAC_state
;
/*
/*
* This is used by the postmaster in its communication with frontends. It
* This is used by the postmaster in its communication with frontends. It
* contains all state information needed during this communication before the
* contains all state information needed during this communication before the
...
@@ -42,6 +47,7 @@ typedef struct Port
...
@@ -42,6 +47,7 @@ typedef struct Port
ProtocolVersion
proto
;
/* FE/BE protocol version */
ProtocolVersion
proto
;
/* FE/BE protocol version */
SockAddr
laddr
;
/* local addr (postmaster) */
SockAddr
laddr
;
/* local addr (postmaster) */
SockAddr
raddr
;
/* remote addr (client) */
SockAddr
raddr
;
/* remote addr (client) */
CAC_state
canAcceptConnections
;
/* postmaster connection status */
/*
/*
* Information that needs to be saved from the startup packet and
* Information that needs to be saved from the startup packet and
...
...
src/include/storage/fd.h
View file @
d75b2ec4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/storage/fd.h,v 1.4
0 2003/11/29 22:41:13 pgsql
Exp $
* $PostgreSQL: pgsql/src/include/storage/fd.h,v 1.4
1 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -77,4 +77,8 @@ extern void RemovePgTempFiles(void);
...
@@ -77,4 +77,8 @@ extern void RemovePgTempFiles(void);
extern
int
pg_fsync
(
int
fd
);
extern
int
pg_fsync
(
int
fd
);
extern
int
pg_fdatasync
(
int
fd
);
extern
int
pg_fdatasync
(
int
fd
);
/* Filename components for OpenTemporaryFile */
#define PG_TEMP_FILES_DIR "pgsql_tmp"
#define PG_TEMP_FILE_PREFIX "pgsql_tmp"
#endif
/* FD_H */
#endif
/* FD_H */
src/include/storage/ipc.h
View file @
d75b2ec4
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.6
3 2003/12/12 18:45:10 petere
Exp $
* $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.6
4 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -32,6 +32,8 @@ extern void on_exit_reset(void);
...
@@ -32,6 +32,8 @@ extern void on_exit_reset(void);
extern
void
CreateSharedMemoryAndSemaphores
(
bool
makePrivate
,
extern
void
CreateSharedMemoryAndSemaphores
(
bool
makePrivate
,
int
maxBackends
,
int
maxBackends
,
int
port
);
int
port
);
#ifdef EXEC_BACKEND
extern
void
AttachSharedMemoryAndSemaphores
(
void
);
extern
void
AttachSharedMemoryAndSemaphores
(
void
);
#endif
#endif
/* IPC_H */
#endif
/* IPC_H */
src/include/storage/lock.h
View file @
d75b2ec4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.7
5 2003/12/01 21:59:25
momjian Exp $
* $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.7
6 2003/12/20 17:31:21
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -86,8 +86,6 @@ typedef uint16 LOCKMETHODID;
...
@@ -86,8 +86,6 @@ typedef uint16 LOCKMETHODID;
*/
*/
typedef
struct
LockMethodData
typedef
struct
LockMethodData
{
{
HTAB
*
lockHash
;
HTAB
*
proclockHash
;
LOCKMETHODID
lockmethodid
;
LOCKMETHODID
lockmethodid
;
int
numLockModes
;
int
numLockModes
;
LOCKMASK
conflictTab
[
MAX_LOCKMODES
];
LOCKMASK
conflictTab
[
MAX_LOCKMODES
];
...
...
src/include/storage/lwlock.h
View file @
d75b2ec4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/storage/lwlock.h,v 1.
9 2003/11/29 22:41:13 pgsql
Exp $
* $PostgreSQL: pgsql/src/include/storage/lwlock.h,v 1.
10 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -29,7 +29,6 @@ typedef enum LWLockId
...
@@ -29,7 +29,6 @@ typedef enum LWLockId
LockMgrLock
,
LockMgrLock
,
OidGenLock
,
OidGenLock
,
XidGenLock
,
XidGenLock
,
ShmemIndexLock
,
SInvalLock
,
SInvalLock
,
FreeSpaceLock
,
FreeSpaceLock
,
MMCacheLock
,
MMCacheLock
,
...
...
src/include/storage/shmem.h
View file @
d75b2ec4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/storage/shmem.h,v 1.4
0 2003/11/29 22:41:13 pgsql
Exp $
* $PostgreSQL: pgsql/src/include/storage/shmem.h,v 1.4
1 2003/12/20 17:31:21 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -61,7 +61,7 @@ typedef struct SHM_QUEUE
...
@@ -61,7 +61,7 @@ typedef struct SHM_QUEUE
}
SHM_QUEUE
;
}
SHM_QUEUE
;
/* shmem.c */
/* shmem.c */
extern
void
InitShmemAllocation
(
void
*
seghdr
);
extern
void
InitShmemAllocation
(
void
*
seghdr
,
bool
init
);
extern
void
*
ShmemAlloc
(
Size
size
);
extern
void
*
ShmemAlloc
(
Size
size
);
extern
bool
ShmemIsValid
(
unsigned
long
addr
);
extern
bool
ShmemIsValid
(
unsigned
long
addr
);
extern
void
InitShmemIndex
(
void
);
extern
void
InitShmemIndex
(
void
);
...
...
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