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

Commitb9defe0

Browse files
committed
Marginal code cleanup for streaming replication.
There is no reason that proc.c should have to get involved in this dirty hackfor letting the postmaster know which children are walsenders. Revert thatfile to the way it was, and confine the kluge to pmsignal.c and postmaster.c.
1 parente57cd39 commitb9defe0

File tree

3 files changed

+9
-30
lines changed

3 files changed

+9
-30
lines changed

‎src/backend/storage/ipc/pmsignal.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/ipc/pmsignal.c,v 1.30 2010/01/15 09:19:03 heikki Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/ipc/pmsignal.c,v 1.31 2010/08/23 17:20:01 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -19,6 +19,7 @@
1919

2020
#include"miscadmin.h"
2121
#include"postmaster/postmaster.h"
22+
#include"replication/walsender.h"
2223
#include"storage/pmsignal.h"
2324
#include"storage/shmem.h"
2425

@@ -46,8 +47,8 @@
4647
* child processes at random, and postmaster.c is responsible for tracking
4748
* which one goes with which PID.
4849
*
49-
*Thefourth state, WALSENDER,is just like ACTIVE, but carries the extra
50-
* information that the child is a WAL sender.
50+
*Actually there is afourth state, WALSENDER. Thisis just like ACTIVE,
51+
*but carries the extrainformation that the child is a WAL sender.
5152
*/
5253

5354
#definePM_CHILD_UNUSED0/* these values must fit in sig_atomic_t */
@@ -224,23 +225,8 @@ MarkPostmasterChildActive(void)
224225
Assert(slot>0&&slot <=PMSignalState->num_child_flags);
225226
slot--;
226227
Assert(PMSignalState->PMChildFlags[slot]==PM_CHILD_ASSIGNED);
227-
PMSignalState->PMChildFlags[slot]=PM_CHILD_ACTIVE;
228-
}
229-
230-
/*
231-
* MarkPostmasterChildWalSender - like MarkPostmasterChildActive(), but
232-
* marks the postmaster child as a WAL sender instead of a regular backend.
233-
* This is called in the child process.
234-
*/
235-
void
236-
MarkPostmasterChildWalSender(void)
237-
{
238-
intslot=MyPMChildSlot;
239-
240-
Assert(slot>0&&slot <=PMSignalState->num_child_flags);
241-
slot--;
242-
Assert(PMSignalState->PMChildFlags[slot]==PM_CHILD_ASSIGNED);
243-
PMSignalState->PMChildFlags[slot]=PM_CHILD_WALSENDER;
228+
PMSignalState->PMChildFlags[slot]=
229+
(am_walsender ?PM_CHILD_WALSENDER :PM_CHILD_ACTIVE);
244230
}
245231

246232
/*

‎src/backend/storage/lmgr/proc.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.221 2010/07/06 19:18:57 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.222 2010/08/23 17:20:01 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -39,7 +39,6 @@
3939
#include"access/xact.h"
4040
#include"miscadmin.h"
4141
#include"postmaster/autovacuum.h"
42-
#include"replication/walsender.h"
4342
#include"storage/ipc.h"
4443
#include"storage/lmgr.h"
4544
#include"storage/pmsignal.h"
@@ -297,12 +296,7 @@ InitProcess(void)
297296
* this; it probably should.)
298297
*/
299298
if (IsUnderPostmaster&& !IsAutoVacuumLauncherProcess())
300-
{
301-
if (am_walsender)
302-
MarkPostmasterChildWalSender();
303-
else
304-
MarkPostmasterChildActive();
305-
}
299+
MarkPostmasterChildActive();
306300

307301
/*
308302
* Initialize all fields of MyProc, except for the semaphore which was

‎src/include/storage/pmsignal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/storage/pmsignal.h,v 1.32 2010/07/06 19:19:00 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/storage/pmsignal.h,v 1.33 2010/08/23 17:20:01 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -47,7 +47,6 @@ extern intAssignPostmasterChildSlot(void);
4747
externboolReleasePostmasterChildSlot(intslot);
4848
externboolIsPostmasterChildWalSender(intslot);
4949
externvoidMarkPostmasterChildActive(void);
50-
externvoidMarkPostmasterChildWalSender(void);
5150
externvoidMarkPostmasterChildInactive(void);
5251
externboolPostmasterIsAlive(boolamDirectChild);
5352

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp