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

Commitb9e5249

Browse files
committed
Fix using injection points at backend startup in EXEC_BACKEND mode
Commit86db52a changed the locking of injection points to use onlyatomic ops and spinlocks, to make it possible to define injectionpoints in processes that don't have a PGPROC entry (yet). However, itdidn't work in EXEC_BACKEND mode, because the pointer to shared memoryarea was not initialized until the process "attaches" to all theshared memory structs. To fix, pass the pointer to the child processalong with other global variables that need to be set up early.Backpatch-through: 17
1 parentc95d215 commitb9e5249

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

‎src/backend/postmaster/launch_backend.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include"utils/builtins.h"
6464
#include"utils/datetime.h"
6565
#include"utils/guc.h"
66+
#include"utils/injection_point.h"
6667
#include"utils/memutils.h"
6768
#include"utils/timestamp.h"
6869

@@ -104,6 +105,9 @@ typedef struct
104105
void*UsedShmemSegAddr;
105106
slock_t*ShmemLock;
106107
structbkend*ShmemBackendArray;
108+
#ifdefUSE_INJECTION_POINTS
109+
structInjectionPointsCtl*ActiveInjectionPoints;
110+
#endif
107111
#ifndefHAVE_SPINLOCKS
108112
PGSemaphore*SpinlockSemaArray;
109113
#endif
@@ -710,6 +714,10 @@ save_backend_variables(BackendParameters *param, ClientSocket *client_sock,
710714
param->ShmemLock=ShmemLock;
711715
param->ShmemBackendArray=ShmemBackendArray;
712716

717+
#ifdefUSE_INJECTION_POINTS
718+
param->ActiveInjectionPoints=ActiveInjectionPoints;
719+
#endif
720+
713721
#ifndefHAVE_SPINLOCKS
714722
param->SpinlockSemaArray=SpinlockSemaArray;
715723
#endif
@@ -969,6 +977,10 @@ restore_backend_variables(BackendParameters *param)
969977
ShmemLock=param->ShmemLock;
970978
ShmemBackendArray=param->ShmemBackendArray;
971979

980+
#ifdefUSE_INJECTION_POINTS
981+
ActiveInjectionPoints=param->ActiveInjectionPoints;
982+
#endif
983+
972984
#ifndefHAVE_SPINLOCKS
973985
SpinlockSemaArray=param->SpinlockSemaArray;
974986
#endif

‎src/backend/utils/misc/injection_point.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ typedef struct InjectionPointsCtl
8585
InjectionPointEntryentries[MAX_INJECTION_POINTS];
8686
}InjectionPointsCtl;
8787

88-
staticInjectionPointsCtl*ActiveInjectionPoints;
88+
NON_EXEC_STATICInjectionPointsCtl*ActiveInjectionPoints;
8989

9090
/*
9191
* Backend local cache of injection callbacks already loaded, stored in

‎src/include/utils/injection_point.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@ extern void InjectionPointRun(const char *name);
4343
externvoidInjectionPointCached(constchar*name);
4444
externboolInjectionPointDetach(constchar*name);
4545

46+
#ifdefEXEC_BACKEND
47+
externPGDLLIMPORTstructInjectionPointsCtl*ActiveInjectionPoints;
48+
#endif
49+
4650
#endif/* INJECTION_POINT_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp