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
a7fd03e1
Commit
a7fd03e1
authored
May 03, 2003
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle clog structure in shared memory in exec() case, for Win32.
parent
36fa2974
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
90 additions
and
29 deletions
+90
-29
src/backend/access/transam/clog.c
src/backend/access/transam/clog.c
+47
-21
src/backend/bootstrap/bootstrap.c
src/backend/bootstrap/bootstrap.c
+6
-1
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+13
-2
src/backend/storage/ipc/ipci.c
src/backend/storage/ipc/ipci.c
+14
-1
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+6
-2
src/include/miscadmin.h
src/include/miscadmin.h
+2
-1
src/include/storage/ipc.h
src/include/storage/ipc.h
+2
-1
No files found.
src/backend/access/transam/clog.c
View file @
a7fd03e1
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Header: /cvsroot/pgsql/src/backend/access/transam/clog.c,v 1.1
4 2003/05/02 21:59:31
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/clog.c,v 1.1
5 2003/05/03 03:52:07
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -157,7 +157,7 @@ static ClogCtlData *ClogCtl = NULL;
...
@@ -157,7 +157,7 @@ static ClogCtlData *ClogCtl = NULL;
* The value is automatically inherited by backends via fork, and
* The value is automatically inherited by backends via fork, and
* doesn't need to be in shared memory.
* doesn't need to be in shared memory.
*/
*/
static
LWLockId
ClogBufferLocks
[
NUM_CLOG_BUFFERS
]
;
/* Per-buffer I/O locks */
static
LWLockId
*
ClogBufferLocks
;
/* Per-buffer I/O locks */
/*
/*
* ClogDir is set during CLOGShmemInit and does not change thereafter.
* ClogDir is set during CLOGShmemInit and does not change thereafter.
...
@@ -271,41 +271,67 @@ TransactionIdGetStatus(TransactionId xid)
...
@@ -271,41 +271,67 @@ TransactionIdGetStatus(TransactionId xid)
/*
/*
* Initialization of shared memory for CLOG
* Initialization of shared memory for CLOG
*/
*/
int
int
CLOGShmemSize
(
void
)
CLOGShmemSize
(
void
)
{
{
return
MAXALIGN
(
sizeof
(
ClogCtlData
)
+
CLOG_BLCKSZ
*
NUM_CLOG_BUFFERS
);
return
MAXALIGN
(
sizeof
(
ClogCtlData
)
+
CLOG_BLCKSZ
*
NUM_CLOG_BUFFERS
)
#ifdef EXEC_BACKEND
+
MAXALIGN
(
NUM_CLOG_BUFFERS
*
sizeof
(
LWLockId
))
#endif
;
}
}
void
void
CLOGShmemInit
(
void
)
CLOGShmemInit
(
void
)
{
{
bool
found
;
bool
found
;
char
*
bufptr
;
int
slotno
;
int
slotno
;
/* Handle ClogCtl */
/* this must agree with space requested by CLOGShmemSize() */
/* this must agree with space requested by CLOGShmemSize() */
ClogCtl
=
(
ClogCtlData
*
)
ClogCtl
=
(
ClogCtlData
*
)
ShmemInitStruct
(
"CLOG Ctl"
,
ShmemInitStruct
(
"CLOG Ctl"
,
MAXALIGN
(
sizeof
(
ClogCtlData
)
+
MAXALIGN
(
sizeof
(
ClogCtlData
)
+
CLOG_BLCKSZ
*
NUM_CLOG_BUFFERS
),
&
found
);
CLOG_BLCKSZ
*
NUM_CLOG_BUFFERS
),
&
found
);
Assert
(
!
found
);
memset
(
ClogCtl
,
0
,
sizeof
(
ClogCtlData
));
if
(
!
IsUnderPostmaster
)
/* Initialize ClogCtl shared memory area */
{
char
*
bufptr
;
bufptr
=
((
char
*
)
ClogCtl
)
+
sizeof
(
ClogCtlData
);
Assert
(
!
found
);
for
(
slotno
=
0
;
slotno
<
NUM_CLOG_BUFFERS
;
slotno
++
)
memset
(
ClogCtl
,
0
,
sizeof
(
ClogCtlData
));
{
ClogCtl
->
page_buffer
[
slotno
]
=
bufptr
;
bufptr
=
(
char
*
)
ClogCtl
+
sizeof
(
ClogCtlData
);
ClogCtl
->
page_status
[
slotno
]
=
CLOG_PAGE_EMPTY
;
ClogBufferLocks
[
slotno
]
=
LWLockAssign
();
for
(
slotno
=
0
;
slotno
<
NUM_CLOG_BUFFERS
;
slotno
++
)
bufptr
+=
CLOG_BLCKSZ
;
{
}
ClogCtl
->
page_buffer
[
slotno
]
=
bufptr
;
ClogCtl
->
page_status
[
slotno
]
=
CLOG_PAGE_EMPTY
;
bufptr
+=
CLOG_BLCKSZ
;
}
/* ClogCtl->latest_page_number will be set later */
/* ClogCtl->latest_page_number will be set later */
}
else
Assert
(
found
);
/* Handle ClogBufferLocks */
#ifdef EXEC_BACKEND
ClogBufferLocks
=
(
LWLockId
*
)
ShmemInitStruct
(
"CLOG Buffer Locks"
,
NUM_CLOG_BUFFERS
*
sizeof
(
LWLockId
),
&
found
);
Assert
((
!
found
&&
!
IsUnderPostmaster
)
||
(
found
&&
IsUnderPostmaster
));
#else
ClogBufferLocks
=
malloc
(
NUM_CLOG_BUFFERS
*
sizeof
(
LWLockId
));
Assert
(
ClogBufferLocks
);
#endif
if
(
!
IsUnderPostmaster
)
for
(
slotno
=
0
;
slotno
<
NUM_CLOG_BUFFERS
;
slotno
++
)
ClogBufferLocks
[
slotno
]
=
LWLockAssign
();
/* Init CLOG directory path */
/* Init CLOG directory path */
snprintf
(
ClogDir
,
MAXPGPATH
,
"%s/pg_clog"
,
DataDir
);
snprintf
(
ClogDir
,
MAXPGPATH
,
"%s/pg_clog"
,
DataDir
);
...
...
src/backend/bootstrap/bootstrap.c
View file @
a7fd03e1
...
@@ -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
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.15
0 2003/05/02 21:59:31
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.15
1 2003/05/03 03:52:07
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -301,6 +301,11 @@ BootstrapMain(int argc, char *argv[])
...
@@ -301,6 +301,11 @@ BootstrapMain(int argc, char *argv[])
Assert
(
dbName
);
Assert
(
dbName
);
if
(
IsUnderPostmaster
&&
ExecBackend
&&
MyProc
/* ordinary backend */
)
{
AttachSharedMemoryAndSemaphores
();
}
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
)
{
{
if
(
!
potential_DataDir
)
if
(
!
potential_DataDir
)
...
...
src/backend/postmaster/postmaster.c
View file @
a7fd03e1
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.3
19 2003/05/02 22:02:4
7 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.3
20 2003/05/03 03:52:0
7 momjian Exp $
*
*
* NOTES
* NOTES
*
*
...
@@ -172,6 +172,13 @@ static int ServerSock_INET = INVALID_SOCK; /* stream socket server */
...
@@ -172,6 +172,13 @@ static int ServerSock_INET = INVALID_SOCK; /* stream socket server */
static
int
ServerSock_UNIX
=
INVALID_SOCK
;
/* stream socket server */
static
int
ServerSock_UNIX
=
INVALID_SOCK
;
/* stream socket server */
#endif
#endif
/* Used to reduce macros tests */
#ifdef EXEC_BACKEND
const
bool
ExecBackend
=
true
;
#else
const
bool
ExecBackend
=
false
;
#endif
/*
/*
* Set by the -o option
* Set by the -o option
*/
*/
...
@@ -1407,7 +1414,11 @@ processCancelRequest(Port *port, void *pkt)
...
@@ -1407,7 +1414,11 @@ processCancelRequest(Port *port, void *pkt)
elog
(
DEBUG1
,
"processCancelRequest: CheckPointPID in cancel request for process %d"
,
backendPID
);
elog
(
DEBUG1
,
"processCancelRequest: CheckPointPID in cancel request for process %d"
,
backendPID
);
return
;
return
;
}
}
else
if
(
ExecBackend
)
{
AttachSharedMemoryAndSemaphores
();
}
/* See if we have a matching backend */
/* See if we have a matching backend */
for
(
curr
=
DLGetHead
(
BackendList
);
curr
;
curr
=
DLGetSucc
(
curr
))
for
(
curr
=
DLGetHead
(
BackendList
);
curr
;
curr
=
DLGetSucc
(
curr
))
...
...
src/backend/storage/ipc/ipci.c
View file @
a7fd03e1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.5
1 2003/05/02 21:59:31
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.5
2 2003/05/03 03:52:07
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -134,3 +134,16 @@ CreateSharedMemoryAndSemaphores(bool makePrivate,
...
@@ -134,3 +134,16 @@ CreateSharedMemoryAndSemaphores(bool makePrivate,
*/
*/
PMSignalInit
();
PMSignalInit
();
}
}
/*
* AttachSharedMemoryAndSemaphores
* Attaches to the existing shared resources when exec()'d off
* by the postmaster.
*/
void
AttachSharedMemoryAndSemaphores
(
void
)
{
CLOGShmemInit
();
}
src/backend/tcop/postgres.c
View file @
a7fd03e1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.3
29 2003/05/02 21:59:31
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.3
30 2003/05/03 03:52:07
momjian Exp $
*
*
* NOTES
* NOTES
* this is the "main" module of the postgres backend and
* this is the "main" module of the postgres backend and
...
@@ -1453,6 +1453,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1453,6 +1453,7 @@ PostgresMain(int argc, char *argv[], const char *username)
break
;
break
;
}
}
/*
/*
* -d is not the same as setting
* -d is not the same as setting
* log_min_messages because it enables other
* log_min_messages because it enables other
...
@@ -1577,6 +1578,9 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1577,6 +1578,9 @@ PostgresMain(int argc, char *argv[], const char *username)
* restart... */
* restart... */
}
}
BaseInit
();
BaseInit
();
#ifdef EXECBACKEND
AttachSharedMemoryAndSemaphores
();
#endif
}
}
else
else
{
{
...
@@ -1672,7 +1676,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1672,7 +1676,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
)
{
{
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"$Revision: 1.3
29 $ $Date: 2003/05/02 21:59:31
$
\n
"
);
puts
(
"$Revision: 1.3
30 $ $Date: 2003/05/03 03:52:07
$
\n
"
);
}
}
/*
/*
...
...
src/include/miscadmin.h
View file @
a7fd03e1
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: miscadmin.h,v 1.12
0 2003/05/02 21:59:31
momjian Exp $
* $Id: miscadmin.h,v 1.12
1 2003/05/03 03:52:07
momjian Exp $
*
*
* NOTES
* NOTES
* some of the information in this file should be moved to
* some of the information in this file should be moved to
...
@@ -106,6 +106,7 @@ extern void ProcessInterrupts(void);
...
@@ -106,6 +106,7 @@ extern void ProcessInterrupts(void);
*/
*/
extern
bool
IsUnderPostmaster
;
extern
bool
IsUnderPostmaster
;
extern
bool
ClientAuthInProgress
;
extern
bool
ClientAuthInProgress
;
extern
const
bool
ExecBackend
;
extern
int
PostmasterMain
(
int
argc
,
char
*
argv
[]);
extern
int
PostmasterMain
(
int
argc
,
char
*
argv
[]);
extern
void
ClosePostmasterPorts
(
bool
pgstat_too
);
extern
void
ClosePostmasterPorts
(
bool
pgstat_too
);
...
...
src/include/storage/ipc.h
View file @
a7fd03e1
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: ipc.h,v 1.
59 2003/05/02 21:59:31
momjian Exp $
* $Id: ipc.h,v 1.
60 2003/05/03 03:52:07
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -32,5 +32,6 @@ extern void on_exit_reset(void);
...
@@ -32,5 +32,6 @@ extern void on_exit_reset(void);
extern
void
CreateSharedMemoryAndSemaphores
(
bool
makePrivate
,
extern
void
CreateSharedMemoryAndSemaphores
(
bool
makePrivate
,
int
maxBackends
,
int
maxBackends
,
int
port
);
int
port
);
extern
void
AttachSharedMemoryAndSemaphores
(
void
);
#endif
/* IPC_H */
#endif
/* IPC_H */
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