Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit86822df

Browse files
committed
Split walsender.h in public/private headers
This dramatically cuts short the number of headers the public one bringsinto whatever includes it.
1 parent6693c9a commit86822df

File tree

6 files changed

+115
-91
lines changed

6 files changed

+115
-91
lines changed

‎src/backend/replication/basebackup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include"nodes/pg_list.h"
2626
#include"replication/basebackup.h"
2727
#include"replication/walsender.h"
28+
#include"replication/walsender_private.h"
2829
#include"storage/fd.h"
2930
#include"storage/ipc.h"
3031
#include"utils/builtins.h"

‎src/backend/replication/repl_gram.y

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include"nodes/makefuncs.h"
2020
#include"nodes/replnodes.h"
2121
#include"replication/walsender.h"
22+
#include"replication/walsender_private.h"
2223

2324

2425
/* Result of the parsing is returned here*/

‎src/backend/replication/syncrep.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include"miscadmin.h"
5050
#include"replication/syncrep.h"
5151
#include"replication/walsender.h"
52+
#include"replication/walsender_private.h"
5253
#include"storage/pmsignal.h"
5354
#include"storage/proc.h"
5455
#include"tcop/tcopprot.h"

‎src/backend/replication/walsender.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include"replication/walprotocol.h"
5252
#include"replication/walreceiver.h"
5353
#include"replication/walsender.h"
54+
#include"replication/walsender_private.h"
5455
#include"storage/fd.h"
5556
#include"storage/ipc.h"
5657
#include"storage/pmsignal.h"

‎src/include/replication/walsender.h

Lines changed: 2 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -12,84 +12,9 @@
1212
#ifndef_WALSENDER_H
1313
#define_WALSENDER_H
1414

15-
#include"access/xlog.h"
16-
#include"fmgr.h"
17-
#include"nodes/nodes.h"
18-
#include"storage/latch.h"
19-
#include"storage/shmem.h"
20-
#include"storage/spin.h"
21-
22-
typedefenumWalSndState
23-
{
24-
WALSNDSTATE_STARTUP=0,
25-
WALSNDSTATE_BACKUP,
26-
WALSNDSTATE_CATCHUP,
27-
WALSNDSTATE_STREAMING
28-
}WalSndState;
29-
30-
/*
31-
* Each walsender has a WalSnd struct in shared memory.
32-
*/
33-
typedefstructWalSnd
34-
{
35-
pid_tpid;/* this walsender's process id, or 0 */
36-
WalSndStatestate;/* this walsender's state */
37-
XLogRecPtrsentPtr;/* WAL has been sent up to this point */
38-
boolneedreload;/* does currently-open file need to be reloaded? */
39-
40-
/*
41-
* The xlog locations that have been written, flushed, and applied by
42-
* standby-side. These may be invalid if the standby-side has not offered
43-
* values yet.
44-
*/
45-
XLogRecPtrwrite;
46-
XLogRecPtrflush;
47-
XLogRecPtrapply;
48-
49-
/* Protects shared variables shown above. */
50-
slock_tmutex;
51-
52-
/*
53-
* Latch used by backends to wake up this walsender when it has work to
54-
* do.
55-
*/
56-
Latchlatch;
57-
58-
/*
59-
* The priority order of the standby managed by this WALSender, as listed
60-
* in synchronous_standby_names, or 0 if not-listed. Protected by
61-
* SyncRepLock.
62-
*/
63-
intsync_standby_priority;
64-
}WalSnd;
65-
66-
externWalSnd*MyWalSnd;
15+
#include<signal.h>
6716

68-
/* There is one WalSndCtl struct for the whole database cluster */
69-
typedefstruct
70-
{
71-
/*
72-
* Synchronous replication queue. Protected by SyncRepLock.
73-
*/
74-
SHM_QUEUESyncRepQueue;
75-
76-
/*
77-
* Current location of the head of the queue. All waiters should have a
78-
* waitLSN that follows this value. Protected by SyncRepLock.
79-
*/
80-
XLogRecPtrlsn;
81-
82-
/*
83-
* Are any sync standbys defined? Waiting backends can't reload the
84-
* config file safely, so WAL writer updates this value as needed.
85-
* Protected by SyncRepLock.
86-
*/
87-
boolsync_standbys_defined;
88-
89-
WalSndwalsnds[1];/* VARIABLE LENGTH ARRAY */
90-
}WalSndCtlData;
91-
92-
externWalSndCtlData*WalSndCtl;
17+
#include"fmgr.h"
9318

9419
/* global state */
9520
externboolam_walsender;
@@ -106,22 +31,8 @@ extern void WalSndSignals(void);
10631
externSizeWalSndShmemSize(void);
10732
externvoidWalSndShmemInit(void);
10833
externvoidWalSndWakeup(void);
109-
externvoidWalSndSetState(WalSndStatestate);
110-
externvoidXLogRead(char*buf,XLogRecPtrstartptr,Sizecount);
11134
externvoidWalSndRqstFileReload(void);
11235

11336
externDatumpg_stat_get_wal_senders(PG_FUNCTION_ARGS);
11437

115-
/*
116-
* Internal functions for parsing the replication grammar, in repl_gram.y and
117-
* repl_scanner.l
118-
*/
119-
externintreplication_yyparse(void);
120-
externintreplication_yylex(void);
121-
externvoidreplication_yyerror(constchar*str);
122-
externvoidreplication_scanner_init(constchar*query_string);
123-
externvoidreplication_scanner_finish(void);
124-
125-
externNode*replication_parse_result;
126-
12738
#endif/* _WALSENDER_H */
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* walsender_private.h
4+
* Private definitions from replication/walsender.c.
5+
*
6+
* Portions Copyright (c) 2010-2011, PostgreSQL Global Development Group
7+
*
8+
* src/include/replication/walsender_private.h
9+
*
10+
*-------------------------------------------------------------------------
11+
*/
12+
#ifndef_WALSENDER_PRIVATE_H
13+
#define_WALSENDER_PRIVATE_H
14+
15+
#include"access/xlog.h"
16+
#include"nodes/nodes.h"
17+
#include"storage/latch.h"
18+
#include"storage/shmem.h"
19+
#include"storage/spin.h"
20+
21+
typedefenumWalSndState
22+
{
23+
WALSNDSTATE_STARTUP=0,
24+
WALSNDSTATE_BACKUP,
25+
WALSNDSTATE_CATCHUP,
26+
WALSNDSTATE_STREAMING
27+
}WalSndState;
28+
29+
/*
30+
* Each walsender has a WalSnd struct in shared memory.
31+
*/
32+
typedefstructWalSnd
33+
{
34+
pid_tpid;/* this walsender's process id, or 0 */
35+
WalSndStatestate;/* this walsender's state */
36+
XLogRecPtrsentPtr;/* WAL has been sent up to this point */
37+
boolneedreload;/* does currently-open file need to be reloaded? */
38+
39+
/*
40+
* The xlog locations that have been written, flushed, and applied by
41+
* standby-side. These may be invalid if the standby-side has not offered
42+
* values yet.
43+
*/
44+
XLogRecPtrwrite;
45+
XLogRecPtrflush;
46+
XLogRecPtrapply;
47+
48+
/* Protects shared variables shown above. */
49+
slock_tmutex;
50+
51+
/*
52+
* Latch used by backends to wake up this walsender when it has work to
53+
* do.
54+
*/
55+
Latchlatch;
56+
57+
/*
58+
* The priority order of the standby managed by this WALSender, as listed
59+
* in synchronous_standby_names, or 0 if not-listed. Protected by
60+
* SyncRepLock.
61+
*/
62+
intsync_standby_priority;
63+
}WalSnd;
64+
65+
externWalSnd*MyWalSnd;
66+
67+
/* There is one WalSndCtl struct for the whole database cluster */
68+
typedefstruct
69+
{
70+
/*
71+
* Synchronous replication queue. Protected by SyncRepLock.
72+
*/
73+
SHM_QUEUESyncRepQueue;
74+
75+
/*
76+
* Current location of the head of the queue. All waiters should have a
77+
* waitLSN that follows this value. Protected by SyncRepLock.
78+
*/
79+
XLogRecPtrlsn;
80+
81+
/*
82+
* Are any sync standbys defined? Waiting backends can't reload the
83+
* config file safely, so WAL writer updates this value as needed.
84+
* Protected by SyncRepLock.
85+
*/
86+
boolsync_standbys_defined;
87+
88+
WalSndwalsnds[1];/* VARIABLE LENGTH ARRAY */
89+
}WalSndCtlData;
90+
91+
externWalSndCtlData*WalSndCtl;
92+
93+
94+
externvoidWalSndSetState(WalSndStatestate);
95+
externvoidXLogRead(char*buf,XLogRecPtrstartptr,Sizecount);
96+
97+
/*
98+
* Internal functions for parsing the replication grammar, in repl_gram.y and
99+
* repl_scanner.l
100+
*/
101+
externintreplication_yyparse(void);
102+
externintreplication_yylex(void);
103+
externvoidreplication_yyerror(constchar*str);
104+
externvoidreplication_scanner_init(constchar*query_string);
105+
externvoidreplication_scanner_finish(void);
106+
107+
externNode*replication_parse_result;
108+
109+
#endif/* _WALSENDER_PRIVATE_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp