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 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* 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};
* to update from XLogCtl->Insert.RedoRecPtr if we hold the info_lck;
* see GetRedoRecPtr.
*/
static
XLogRecPtr
RedoRecPtr
;
NON_EXEC_STATIC
XLogRecPtr
RedoRecPtr
;
/*----------
* Shared-memory data structures for XLOG control
...
...
@@ -231,12 +231,6 @@ typedef struct XLogwrtRqst
XLogRecPtr
Flush
;
/* last byte + 1 to flush */
}
XLogwrtRqst
;
typedef
struct
XLogwrtResult
{
XLogRecPtr
Write
;
/* last byte + 1 written out */
XLogRecPtr
Flush
;
/* last byte + 1 flushed */
}
XLogwrtResult
;
/*
* Shared state data for XLogInsert.
*/
...
...
@@ -404,7 +398,7 @@ static char ControlFilePath[MAXPGPATH];
* Private, possibly out-of-date copy of shared LogwrtResult.
* 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.
...
...
@@ -2398,7 +2392,7 @@ XLOGShmemSize(void)
void
XLOGShmemInit
(
void
)
{
bool
found
;
bool
found
XLog
,
foundCFile
;
/* this must agree with space requested by XLOGShmemSize() */
if
(
XLOGbuffers
<
MinXLOGbuffers
)
...
...
@@ -2409,11 +2403,16 @@ XLOGShmemInit(void)
MAXALIGN
(
sizeof
(
XLogCtlData
)
+
sizeof
(
XLogRecPtr
)
*
XLOGbuffers
)
+
BLCKSZ
*
XLOGbuffers
,
&
found
);
Assert
(
!
found
);
&
foundXLog
);
ControlFile
=
(
ControlFileData
*
)
ShmemInitStruct
(
"Control File"
,
sizeof
(
ControlFileData
),
&
found
);
Assert
(
!
found
);
ShmemInitStruct
(
"Control File"
,
sizeof
(
ControlFileData
),
&
foundCFile
);
if
(
foundXLog
||
foundCFile
)
{
/* both should be present or neither */
Assert
(
foundXLog
&&
foundCFile
);
return
;
}
memset
(
XLogCtl
,
0
,
sizeof
(
XLogCtlData
));
...
...
src/backend/bootstrap/bootstrap.c
View file @
d75b2ec4
...
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* 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[])
if
(
!
dbname
||
argc
!=
optind
)
usage
();
if
(
IsUnderPostmaster
&&
ExecBackend
&&
MyProc
/* ordinary backend */
)
#ifdef EXEC_BACKEND
if
(
IsUnderPostmaster
&&
MyProc
/* ordinary backend */
)
AttachSharedMemoryAndSemaphores
();
#endif
if
(
!
IsUnderPostmaster
/* when exec || ExecBackend */
)
{
...
...
src/backend/postmaster/pgstat.c
View file @
d75b2ec4
...
...
@@ -13,7 +13,7 @@
*
* 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"
...
...
@@ -71,7 +71,7 @@ bool pgstat_is_running = false;
* Local data
* ----------
*/
static
int
pgStatSock
=
-
1
;
NON_EXEC_STATIC
int
pgStatSock
=
-
1
;
static
int
pgStatPipe
[
2
];
static
struct
sockaddr_storage
pgStatAddr
;
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 @@
*
*
* 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)
* anyone else attached to the shmem at this point, we've got
* problems.
*/
#ifndef EXEC_BACKEND
LWLockAcquire
(
BufMgrLock
,
LW_EXCLUSIVE
);
#endif
BufferDescriptors
=
(
BufferDesc
*
)
ShmemInitStruct
(
"Buffer Descriptors"
,
...
...
@@ -177,7 +179,9 @@ InitBufferPool(void)
/* Init other shared buffer-management stuff */
StrategyInitialize
(
!
foundDescs
);
#ifndef EXEC_BACKEND
LWLockRelease
(
BufMgrLock
);
#endif
}
/*
...
...
src/backend/storage/file/fd.c
View file @
d75b2ec4
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* 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:
*
...
...
@@ -53,11 +53,6 @@
#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.
* This will open several extra files in addition to those used by
...
...
@@ -1217,8 +1212,12 @@ RemovePgTempFiles(void)
{
while
((
db_de
=
readdir
(
db_dir
))
!=
NULL
)
{
if
(
strcmp
(
db_de
->
d_name
,
"."
)
==
0
||
strcmp
(
db_de
->
d_name
,
".."
)
==
0
)
if
(
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
;
snprintf
(
temp_path
,
sizeof
(
temp_path
),
...
...
src/backend/storage/freespace/freespace.c
View file @
d75b2ec4
...
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* 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:
...
...
@@ -180,7 +180,6 @@ typedef struct FSMRelation FSMRelation;
/* Header for whole map */
struct
FSMHeader
{
HTAB
*
relHash
;
/* hashtable of FSMRelation entries */
FSMRelation
*
usageList
;
/* FSMRelations in usage-recency order */
FSMRelation
*
usageListTail
;
/* tail of usage-recency list */
FSMRelation
*
firstRel
;
/* FSMRelations in arena storage order */
...
...
@@ -218,6 +217,7 @@ int MaxFSMRelations; /* these are set by guc.c */
int
MaxFSMPages
;
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
);
...
...
@@ -265,13 +265,15 @@ InitFreeSpaceMap(void)
{
HASHCTL
info
;
int
nchunks
;
bool
found
;
/* Create table header */
FreeSpaceMap
=
(
FSMHeader
*
)
Shmem
Alloc
(
sizeof
(
FSMHeader
)
);
FreeSpaceMap
=
(
FSMHeader
*
)
Shmem
InitStruct
(
"Free Space Map Header"
,
sizeof
(
FSMHeader
),
&
found
);
if
(
FreeSpaceMap
==
NULL
)
ereport
(
FATAL
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
errmsg
(
"insufficient shared memory for free space map"
)));
if
(
!
found
)
MemSet
(
FreeSpaceMap
,
0
,
sizeof
(
FSMHeader
));
/* Create hashtable for FSMRelations */
...
...
@@ -279,17 +281,21 @@ InitFreeSpaceMap(void)
info
.
entrysize
=
sizeof
(
FSMRelation
);
info
.
hash
=
tag_hash
;
FreeSpaceMap
->
r
elHash
=
ShmemInitHash
(
"Free Space Map Hash"
,
FreeSpaceMap
R
elHash
=
ShmemInitHash
(
"Free Space Map Hash"
,
MaxFSMRelations
/
10
,
MaxFSMRelations
,
&
info
,
(
HASH_ELEM
|
HASH_FUNCTION
));
if
(
!
FreeSpaceMap
->
r
elHash
)
if
(
!
FreeSpaceMap
R
elHash
)
ereport
(
FATAL
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
errmsg
(
"insufficient shared memory for free space map"
)));
if
(
found
)
return
;
/* Allocate page-storage arena */
nchunks
=
(
MaxFSMPages
-
1
)
/
CHUNKPAGES
+
1
;
/* This check ensures spareChunks will be greater than zero */
...
...
@@ -974,7 +980,7 @@ lookup_fsm_rel(RelFileNode *rel)
{
FSMRelation
*
fsmrel
;
fsmrel
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
->
r
elHash
,
fsmrel
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
R
elHash
,
(
void
*
)
rel
,
HASH_FIND
,
NULL
);
...
...
@@ -995,7 +1001,7 @@ create_fsm_rel(RelFileNode *rel)
FSMRelation
*
fsmrel
;
bool
found
;
fsmrel
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
->
r
elHash
,
fsmrel
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
R
elHash
,
(
void
*
)
rel
,
HASH_ENTER
,
&
found
);
...
...
@@ -1050,7 +1056,7 @@ delete_fsm_rel(FSMRelation *fsmrel)
unlink_fsm_rel_usage
(
fsmrel
);
unlink_fsm_rel_storage
(
fsmrel
);
FreeSpaceMap
->
numRels
--
;
result
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
->
r
elHash
,
result
=
(
FSMRelation
*
)
hash_search
(
FreeSpaceMap
R
elHash
,
(
void
*
)
&
(
fsmrel
->
key
),
HASH_REMOVE
,
NULL
);
...
...
src/backend/storage/ipc/ipci.c
View file @
d75b2ec4
...
...
@@ -8,7 +8,7 @@
*
*
* 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,
/*
* Set up shared memory allocation mechanism
*/
InitShmemAllocation
(
seghdr
);
InitShmemAllocation
(
seghdr
,
true
);
/*
* Now initialize LWLocks, which do shared memory allocation and are
...
...
@@ -135,12 +135,36 @@ CreateSharedMemoryAndSemaphores(bool makePrivate,
}
#ifdef EXEC_BACKEND
/*
* AttachSharedMemoryAndSemaphores
* Attaches to the existing shared resources.
*/
/* FIXME: [fork/exec] This function is starting to look pretty much like
CreateSharedMemoryAndSemaphores. Refactor? */
void
AttachSharedMemoryAndSemaphores
(
void
)
{
PGShmemHeader
*
seghdr
=
PGSharedMemoryCreate
(
-
1
,
false
,
-
1
);
InitShmemAllocation
(
seghdr
,
false
);
InitShmemIndex
();
XLOGShmemInit
();
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 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* 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;
void
PMSignalInit
(
void
)
{
bool
found
;
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
));
}
...
...
src/backend/storage/ipc/shmem.c
View file @
d75b2ec4
...
...
@@ -8,7 +8,7 @@
*
*
* 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 */
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 */
...
...
@@ -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.
*/
void
InitShmemAllocation
(
void
*
seghdr
)
InitShmemAllocation
(
void
*
seghdr
,
bool
init
)
{
PGShmemHeader
*
shmhdr
=
(
PGShmemHeader
*
)
seghdr
;
...
...
@@ -97,26 +101,34 @@ InitShmemAllocation(void *seghdr)
ShmemBase
=
(
SHMEM_OFFSET
)
shmhdr
;
ShmemEnd
=
ShmemBase
+
shmhdr
->
totalsize
;
/*
* Initialize the spinlock used by ShmemAlloc. We have to do the
* space allocation the hard way, since ShmemAlloc can't be called
* yet.
*/
ShmemLock
=
(
slock_t
*
)
(((
char
*
)
shmhdr
)
+
shmhdr
->
freeoffset
);
shmhdr
->
freeoffset
+=
MAXALIGN
(
sizeof
(
slock_t
));
Assert
(
shmhdr
->
freeoffset
<=
shmhdr
->
totalsize
);
SpinLockInit
(
ShmemLock
);
/* ShmemIndex can't be set up yet (need LWLocks first) */
ShmemIndex
=
(
HTAB
*
)
NULL
;
/*
* Initialize ShmemVariableCache for transaction manager.
*/
ShmemVariableCache
=
(
VariableCache
)
if
(
init
)
{
/*
* Initialize the spinlocks used by ShmemAlloc/ShmemInitStruct. We
* have to do the space allocation the hard way, since ShmemAlloc
* can't be called yet.
*/
ShmemLock
=
(
slock_t
*
)
(((
char
*
)
shmhdr
)
+
shmhdr
->
freeoffset
);
shmhdr
->
freeoffset
+=
MAXALIGN
(
sizeof
(
slock_t
));
Assert
(
shmhdr
->
freeoffset
<=
shmhdr
->
totalsize
);
ShmemIndexLock
=
(
slock_t
*
)
(((
char
*
)
shmhdr
)
+
shmhdr
->
freeoffset
);
shmhdr
->
freeoffset
+=
MAXALIGN
(
sizeof
(
slock_t
));
Assert
(
shmhdr
->
freeoffset
<=
shmhdr
->
totalsize
);
SpinLockInit
(
ShmemLock
);
SpinLockInit
(
ShmemIndexLock
);
/* ShmemIndex can't be set up yet (need LWLocks first) */
ShmemIndex
=
(
HTAB
*
)
NULL
;
/*
* Initialize ShmemVariableCache for transaction manager.
*/
ShmemVariableCache
=
(
VariableCache
)
ShmemAlloc
(
sizeof
(
*
ShmemVariableCache
));
memset
(
ShmemVariableCache
,
0
,
sizeof
(
*
ShmemVariableCache
));
memset
(
ShmemVariableCache
,
0
,
sizeof
(
*
ShmemVariableCache
));
}
}
/*
...
...
@@ -218,25 +230,28 @@ InitShmemIndex(void)
/*
* Now, create an entry in the hashtable for the index itself.
*/
MemSet
(
item
.
key
,
0
,
SHMEM_INDEX_KEYSIZE
);
strncpy
(
item
.
key
,
"ShmemIndex"
,
SHMEM_INDEX_KEYSIZE
);
result
=
(
ShmemIndexEnt
*
)
hash_search
(
ShmemIndex
,
(
void
*
)
&
item
,
HASH_ENTER
,
&
found
);
if
(
!
result
)
ereport
(
FATAL
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
errmsg
(
"out of shared memory"
)));
Assert
(
ShmemBootstrap
&&
!
found
);
result
->
location
=
MAKE_OFFSET
(
ShmemIndex
->
hctl
);
result
->
size
=
SHMEM_INDEX_SIZE
;
ShmemBootstrap
=
false
;
if
(
!
IsUnderPostmaster
)
{
MemSet
(
item
.
key
,
0
,
SHMEM_INDEX_KEYSIZE
);
strncpy
(
item
.
key
,
"ShmemIndex"
,
SHMEM_INDEX_KEYSIZE
);
result
=
(
ShmemIndexEnt
*
)
hash_search
(
ShmemIndex
,
(
void
*
)
&
item
,
HASH_ENTER
,
&
found
);
if
(
!
result
)
ereport
(
FATAL
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
errmsg
(
"out of shared memory"
)));
Assert
(
ShmemBootstrap
&&
!
found
);
result
->
location
=
MAKE_OFFSET
(
ShmemIndex
->
hctl
);
result
->
size
=
SHMEM_INDEX_SIZE
;
ShmemBootstrap
=
false
;
}
/* 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)
strncpy
(
item
.
key
,
name
,
SHMEM_INDEX_KEYSIZE
);
item
.
location
=
BAD_LOCATION
;
LWLockAcquire
(
ShmemIndexLock
,
LW_EXCLUSIVE
);
SpinLockAcquire
(
ShmemIndexLock
);
if
(
!
ShmemIndex
)
{
/*
* 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
;
return
ShmemAlloc
(
size
);
if
(
IsUnderPostmaster
)
{
/* Must be initializing a (non-standalone) backend */
Assert
(
strcmp
(
name
,
"ShmemIndex"
)
==
0
);
Assert
(
ShmemBootstrap
);
Assert
(
ShmemIndexAlloc
);
*
foundPtr
=
TRUE
;
}
else
{
/*
* 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 */
...
...
@@ -343,7 +370,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
if
(
!
result
)
{
LW
LockRelease
(
ShmemIndexLock
);
Spin
LockRelease
(
ShmemIndexLock
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
errmsg
(
"out of shared memory"
)));
...
...
@@ -359,7 +386,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
*/
if
(
result
->
size
!=
size
)
{
LW
LockRelease
(
ShmemIndexLock
);
Spin
LockRelease
(
ShmemIndexLock
);
elog
(
WARNING
,
"ShmemIndex entry size is wrong"
);
/* let caller print its message too */
...
...
@@ -376,7 +403,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
/* out of memory */
Assert
(
ShmemIndex
);
hash_search
(
ShmemIndex
,
(
void
*
)
&
item
,
HASH_REMOVE
,
NULL
);
LW
LockRelease
(
ShmemIndexLock
);
Spin
LockRelease
(
ShmemIndexLock
);
ereport
(
WARNING
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
...
...
@@ -389,6 +416,6 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
}
Assert
(
ShmemIsValid
((
unsigned
long
)
structPtr
));
LW
LockRelease
(
ShmemIndexLock
);
Spin
LockRelease
(
ShmemIndexLock
);
return
structPtr
;
}
src/backend/storage/ipc/sinvaladt.c
View file @
d75b2ec4
...
...
@@ -8,7 +8,7 @@
*
*
* 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)
int
segSize
;
SISeg
*
segP
;
int
i
;
bool
found
;
/* Allocate space in shared memory */
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 */
segP
->
minMsgNum
=
0
;
...
...
src/backend/storage/lmgr/lock.c
View file @
d75b2ec4
...
...
@@ -8,7 +8,7 @@
*
*
* 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
* Outside modules can create a lock table and acquire/release
...
...
@@ -153,9 +153,11 @@ PROCLOCK_PRINT(const char *where, const PROCLOCK *proclockP)
* map from lock method id to the lock table structure
*/
static
LockMethod
LockMethods
[
MAX_LOCK_METHODS
];
static
HTAB
*
LockMethodLockHash
[
MAX_LOCK_METHODS
];
static
HTAB
*
LockMethodProcLockHash
[
MAX_LOCK_METHODS
];
static
int
NumLockMethods
;
/*
* InitLocks -- Init the lock module. Create a private data
* structure for constructing conflict masks.
...
...
@@ -245,8 +247,9 @@ LockMethodTableInit(char *tabName,
/*
* Lock the LWLock for the table (probably not necessary here)
*/
#ifndef EXEC_BACKEND
LWLockAcquire
(
LockMgrLock
,
LW_EXCLUSIVE
);
#endif
/*
* no zero-th table
*/
...
...
@@ -279,15 +282,15 @@ LockMethodTableInit(char *tabName,
hash_flags
=
(
HASH_ELEM
|
HASH_FUNCTION
);
sprintf
(
shmemName
,
"%s (lock hash)"
,
tabName
);
newLockMethod
->
lockHash
=
ShmemInitHash
(
shmemName
,
LockMethodLockHash
[
NumLockMethods
-
1
]
=
ShmemInitHash
(
shmemName
,
init_table_size
,
max_table_size
,
&
info
,
hash_flags
);
if
(
!
newLockMethod
->
lockHash
)
if
(
!
LockMethodLockHash
[
NumLockMethods
-
1
]
)
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
...
...
@@ -299,20 +302,21 @@ LockMethodTableInit(char *tabName,
hash_flags
=
(
HASH_ELEM
|
HASH_FUNCTION
);
sprintf
(
shmemName
,
"%s (proclock hash)"
,
tabName
);
newLockMethod
->
proclockHash
=
ShmemInitHash
(
shmemName
,
LockMethodProcLockHash
[
NumLockMethods
-
1
]
=
ShmemInitHash
(
shmemName
,
init_table_size
,
max_table_size
,
&
info
,
hash_flags
);
if
(
!
newLockMethod
->
proclockHash
)
if
(
!
LockMethodProcLockHash
[
NumLockMethods
-
1
]
)
elog
(
FATAL
,
"could not initialize lock table
\"
%s
\"
"
,
tabName
);
/* init data structures */
LockMethodInit
(
newLockMethod
,
conflictsP
,
numModes
);
#ifndef EXEC_BACKEND
LWLockRelease
(
LockMgrLock
);
#endif
pfree
(
shmemName
);
return
newLockMethod
->
lockmethodid
;
...
...
@@ -449,8 +453,8 @@ LockAcquire(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
/*
* Find or create a lock with this tag
*/
Assert
(
lockMethodTable
->
lockHash
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
lockMethodTable
->
lockHash
,
Assert
(
LockMethodLockHash
[
lockmethodid
]
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
LockMethodLockHash
[
lockmethodid
]
,
(
void
*
)
locktag
,
HASH_ENTER
,
&
found
);
if
(
!
lock
)
...
...
@@ -497,7 +501,7 @@ LockAcquire(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
/*
* Find or create a proclock entry with this tag
*/
proclockTable
=
lockMethodTable
->
proclockHash
;
proclockTable
=
LockMethodProcLockHash
[
lockmethodid
]
;
proclock
=
(
PROCLOCK
*
)
hash_search
(
proclockTable
,
(
void
*
)
&
proclocktag
,
HASH_ENTER
,
&
found
);
...
...
@@ -988,8 +992,8 @@ LockRelease(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
/*
* Find a lock with this tag
*/
Assert
(
lockMethodTable
->
lockHash
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
lockMethodTable
->
lockHash
,
Assert
(
LockMethodLockHash
[
lockmethodid
]
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
LockMethodLockHash
[
lockmethodid
]
,
(
void
*
)
locktag
,
HASH_FIND
,
NULL
);
...
...
@@ -1014,7 +1018,7 @@ LockRelease(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
proclocktag
.
proc
=
MAKE_OFFSET
(
MyProc
);
TransactionIdStore
(
xid
,
&
proclocktag
.
xid
);
proclockTable
=
lockMethodTable
->
proclockHash
;
proclockTable
=
LockMethodProcLockHash
[
lockmethodid
]
;
proclock
=
(
PROCLOCK
*
)
hash_search
(
proclockTable
,
(
void
*
)
&
proclocktag
,
HASH_FIND_SAVE
,
NULL
);
...
...
@@ -1086,8 +1090,8 @@ LockRelease(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
* if there's no one waiting in the queue, we just released the
* last lock on this object. Delete it from the lock table.
*/
Assert
(
lockMethodTable
->
lockHash
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
lockMethodTable
->
lockHash
,
Assert
(
LockMethodLockHash
[
lockmethodid
]
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
LockMethodLockHash
[
lockmethodid
]
,
(
void
*
)
&
(
lock
->
tag
),
HASH_REMOVE
,
NULL
);
...
...
@@ -1269,7 +1273,7 @@ LockReleaseAll(LOCKMETHODID lockmethodid, PGPROC *proc,
/*
* remove the proclock entry from the hashtable
*/
proclock
=
(
PROCLOCK
*
)
hash_search
(
lockMethodTable
->
proclockHash
,
proclock
=
(
PROCLOCK
*
)
hash_search
(
LockMethodProcLockHash
[
lockmethodid
]
,
(
void
*
)
proclock
,
HASH_REMOVE
,
NULL
);
...
...
@@ -1287,8 +1291,8 @@ LockReleaseAll(LOCKMETHODID lockmethodid, PGPROC *proc,
* lock object.
*/
LOCK_PRINT
(
"LockReleaseAll: deleting"
,
lock
,
0
);
Assert
(
lockMethodTable
->
lockHash
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
lockMethodTable
->
lockHash
,
Assert
(
LockMethodLockHash
[
lockmethodid
]
->
hash
==
tag_hash
);
lock
=
(
LOCK
*
)
hash_search
(
LockMethodLockHash
[
lockmethodid
]
,
(
void
*
)
&
(
lock
->
tag
),
HASH_REMOVE
,
NULL
);
if
(
!
lock
)
...
...
@@ -1367,7 +1371,7 @@ GetLockStatusData(void)
LWLockAcquire
(
LockMgrLock
,
LW_EXCLUSIVE
);
proclockTable
=
LockMethod
s
[
DEFAULT_LOCKMETHOD
]
->
proclockHash
;
proclockTable
=
LockMethod
ProcLockHash
[
DEFAULT_LOCKMETHOD
]
;
data
->
nelements
=
i
=
proclockTable
->
hctl
->
nentries
;
...
...
@@ -1480,7 +1484,7 @@ DumpAllLocks(void)
if
(
!
lockMethodTable
)
return
;
proclockTable
=
lockMethodTable
->
proclockHash
;
proclockTable
=
LockMethodProcLockHash
[
lockmethodid
]
;
if
(
proc
->
waitLock
)
LOCK_PRINT
(
"DumpAllLocks: waiting on"
,
proc
->
waitLock
,
0
);
...
...
src/backend/storage/lmgr/lwlock.c
View file @
d75b2ec4
...
...
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* 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
* the pointer by fork from the postmaster. LWLockIds are indexes into
* the array.
*/
static
LWLock
*
LWLockArray
=
NULL
;
NON_EXEC_STATIC
LWLock
*
LWLockArray
=
NULL
;
/* shared counter for dynamic allocation of LWLockIds */
static
int
*
LWLockCounter
;
...
...
src/backend/storage/lmgr/proc.c
View file @
d75b2ec4
...
...
@@ -8,7 +8,7 @@
*
*
* 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;
* relatively infrequently (only at backend startup or shutdown) and not for
* very long, so a spinlock is okay.
*/
static
slock_t
*
ProcStructLock
=
NULL
;
NON_EXEC_STATIC
slock_t
*
ProcStructLock
=
NULL
;
static
PROC_HDR
*
ProcGlobal
=
NULL
;
...
...
@@ -248,6 +248,7 @@ InitProcess(void)
MyProc
->
waitHolder
=
NULL
;
SHMQueueInit
(
&
(
MyProc
->
procHolders
));
/*
* Arrange to clean up at backend exit.
*/
...
...
src/backend/tcop/postgres.c
View file @
d75b2ec4
...
...
@@ -8,7 +8,7 @@
*
*
* 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
* this is the "main" module of the postgres backend and
...
...
@@ -68,6 +68,10 @@
extern
int
optind
;
extern
char
*
optarg
;
#ifdef EXEC_BACKEND
extern
bool
BackendInit
(
Port
*
);
extern
void
read_backend_variables
(
pid_t
,
Port
*
);
#endif
/* ----------------
* global variables
...
...
@@ -2052,7 +2056,6 @@ PostgresMain(int argc, char *argv[], const char *username)
* initialize globals (already done if under postmaster, but not if
* standalone; cheap enough to do over)
*/
MyProcPid
=
getpid
();
/*
...
...
@@ -2060,7 +2063,7 @@ PostgresMain(int argc, char *argv[], const char *username)
*
* If we are running under the postmaster, this is done already.
*/
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
/* when exec || ExecBackend */
)
MemoryContextInit
();
set_ps_display
(
"startup"
);
...
...
@@ -2268,7 +2271,6 @@ PostgresMain(int argc, char *argv[], const char *username)
break
;
case
'p'
:
/*
* p - special flag passed if backend was forked by a
* postmaster.
...
...
@@ -2276,23 +2278,11 @@ PostgresMain(int argc, char *argv[], const char *username)
if
(
secure
)
{
#ifdef EXEC_BACKEND
char
*
p
;
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
);
IsUnderPostmaster
=
true
;
#else
dbname
=
strdup
(
optarg
);
#endif
secure
=
false
;
/* subsequent switches are NOT
* secure */
ctx
=
PGC_BACKEND
;
...
...
@@ -2477,7 +2467,7 @@ PostgresMain(int argc, char *argv[], const char *username)
SetConfigOption
(
"log_statement_stats"
,
"false"
,
ctx
,
gucsource
);
}
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
||
ExecBackend
)
{
if
(
!
potential_DataDir
)
{
...
...
@@ -2497,10 +2487,27 @@ PostgresMain(int argc, char *argv[], const char *username)
if
(
IsUnderPostmaster
)
{
#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_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
}
else
}
else
ProcessConfigFile
(
PGC_POSTMASTER
);
/*
...
...
@@ -2517,7 +2524,6 @@ PostgresMain(int argc, char *argv[], const char *username)
* course, this isn't an issue for signals that are locally generated,
* such as SIGALRM and SIGPIPE.)
*/
pqsignal
(
SIGHUP
,
SigHupHandler
);
/* set flag to read config file */
pqsignal
(
SIGINT
,
StatementCancelHandler
);
/* cancel current query */
pqsignal
(
SIGTERM
,
die
);
/* cancel current query and exit */
...
...
@@ -2565,10 +2571,12 @@ PostgresMain(int argc, char *argv[], const char *username)
errmsg
(
"invalid command-line arguments for server process"
),
errhint
(
"Try
\"
%s --help
\"
for more information."
,
argv
[
0
])));
}
BaseInit
();
#ifdef EXECBACKEND
#ifdef EXEC_BACKEND
AttachSharedMemoryAndSemaphores
();
#endif
XLOGPathInit
();
BaseInit
();
}
else
{
...
...
@@ -2845,7 +2853,11 @@ PostgresMain(int argc, char *argv[], const char *username)
if
(
got_SIGHUP
)
{
got_SIGHUP
=
false
;
#ifdef EXEC_BACKEND
read_nondefault_variables
();
#else
ProcessConfigFile
(
PGC_SIGHUP
);
#endif
}
/*
...
...
@@ -3199,4 +3211,3 @@ ShowUsage(const char *title)
pfree
(
str
.
data
);
}
src/include/access/xlogdefs.h
View file @
d75b2ec4
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* 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
#define XLOG_DEFS_H
...
...
@@ -33,6 +33,13 @@ typedef struct XLogRecPtr
uint32
xrecoff
;
/* byte offset of location in log file */
}
XLogRecPtr
;
typedef
struct
XLogwrtResult
{
XLogRecPtr
Write
;
/* last byte + 1 written out */
XLogRecPtr
Flush
;
/* last byte + 1 flushed */
}
XLogwrtResult
;
/*
* Macros for comparing XLogRecPtrs
*
...
...
src/include/c.h
View file @
d75b2ec4
...
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* 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);
#define HAVE_STRTOULL 1
#endif
/* EXEC_BACKEND defines */
#ifdef EXEC_BACKEND
#define NON_EXEC_STATIC
#else
#define NON_EXEC_STATIC static
#endif
/* /port compatibility functions */
#include "port.h"
...
...
src/include/libpq/libpq-be.h
View file @
d75b2ec4
...
...
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* 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 @@
#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
* contains all state information needed during this communication before the
...
...
@@ -42,6 +47,7 @@ typedef struct Port
ProtocolVersion
proto
;
/* FE/BE protocol version */
SockAddr
laddr
;
/* local addr (postmaster) */
SockAddr
raddr
;
/* remote addr (client) */
CAC_state
canAcceptConnections
;
/* postmaster connection status */
/*
* Information that needs to be saved from the startup packet and
...
...
src/include/storage/fd.h
View file @
d75b2ec4
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* 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);
extern
int
pg_fsync
(
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 */
src/include/storage/ipc.h
View file @
d75b2ec4
...
...
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* 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);
extern
void
CreateSharedMemoryAndSemaphores
(
bool
makePrivate
,
int
maxBackends
,
int
port
);
#ifdef EXEC_BACKEND
extern
void
AttachSharedMemoryAndSemaphores
(
void
);
#endif
#endif
/* IPC_H */
src/include/storage/lock.h
View file @
d75b2ec4
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* 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;
*/
typedef
struct
LockMethodData
{
HTAB
*
lockHash
;
HTAB
*
proclockHash
;
LOCKMETHODID
lockmethodid
;
int
numLockModes
;
LOCKMASK
conflictTab
[
MAX_LOCKMODES
];
...
...
src/include/storage/lwlock.h
View file @
d75b2ec4
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* 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
LockMgrLock
,
OidGenLock
,
XidGenLock
,
ShmemIndexLock
,
SInvalLock
,
FreeSpaceLock
,
MMCacheLock
,
...
...
src/include/storage/shmem.h
View file @
d75b2ec4
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* 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
}
SHM_QUEUE
;
/* shmem.c */
extern
void
InitShmemAllocation
(
void
*
seghdr
);
extern
void
InitShmemAllocation
(
void
*
seghdr
,
bool
init
);
extern
void
*
ShmemAlloc
(
Size
size
);
extern
bool
ShmemIsValid
(
unsigned
long
addr
);
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