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

Commitaa9fbed

Browse files
authored
Merge pull request#32 from postgrespro/PGPRO-5278
Add PG 14 support. Temporarily disable TPC-DS test before their stabilization in another task
2 parents8068a40 +4b5b13f commitaa9fbed

File tree

3 files changed

+494
-4
lines changed

3 files changed

+494
-4
lines changed

‎.travis.yml‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ notifications:
2222
on_failure:always
2323

2424
env:
25-
-PG_VERSION=13 LEVEL=hardcore USE_TPCDS=1
25+
-PG_VERSION=14 LEVEL=hardcore USE_TPCDS=0
26+
-PG_VERSION=14
27+
-PG_VERSION=13 LEVEL=hardcore USE_TPCDS=0
2628
-PG_VERSION=13
27-
-PG_VERSION=12 LEVEL=hardcore USE_TPCDS=1
29+
-PG_VERSION=12 LEVEL=hardcore USE_TPCDS=0
2830
-PG_VERSION=12
29-
-PG_VERSION=11 LEVEL=hardcore USE_TPCDS=1
31+
-PG_VERSION=11 LEVEL=hardcore USE_TPCDS=0
3032
-PG_VERSION=11
31-
-PG_VERSION=10 LEVEL=hardcore USE_TPCDS=1
33+
-PG_VERSION=10 LEVEL=hardcore USE_TPCDS=0
3234
-PG_VERSION=10
3335
-PG_VERSION=9.6 LEVEL=hardcore
3436
-PG_VERSION=9.6

‎patches/custom_signals_14.0.patch‎

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
From f2632ea7cd03119c55b8aa0ef60f529380ca2536 Mon Sep 17 00:00:00 2001
2+
From: Kovalenko Anastasia <s2180445@gse.cs.msu.ru>
3+
Date: Tue, 24 Aug 2021 16:22:28 +0300
4+
Subject: [PATCH] custom-signals
5+
6+
---
7+
src/backend/storage/ipc/procsignal.c | 94 ++++++++++++++++++++++++++++
8+
src/backend/tcop/postgres.c | 2 +
9+
src/include/storage/procsignal.h | 17 +++++
10+
3 files changed, 113 insertions(+)
11+
12+
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
13+
index defb75a..4245d28 100644
14+
--- a/src/backend/storage/ipc/procsignal.c
15+
+++ b/src/backend/storage/ipc/procsignal.c
16+
@@ -95,6 +95,13 @@ typedef struct
17+
#define BARRIER_CLEAR_BIT(flags, type) \
18+
((flags) &= ~(((uint32) 1) << (uint32) (type)))
19+
20+
+#define IsCustomProcSignalReason(reason) \
21+
+((reason) >= PROCSIG_CUSTOM_1 && (reason) <= PROCSIG_CUSTOM_N)
22+
+
23+
+static bool CustomSignalPendings[NUM_CUSTOM_PROCSIGNALS];
24+
+static bool CustomSignalProcessing[NUM_CUSTOM_PROCSIGNALS];
25+
+static ProcSignalHandler_type CustomInterruptHandlers[NUM_CUSTOM_PROCSIGNALS];
26+
+
27+
static ProcSignalHeader *ProcSignal = NULL;
28+
static ProcSignalSlot *MyProcSignalSlot = NULL;
29+
30+
@@ -103,6 +110,8 @@ static void CleanupProcSignalState(int status, Datum arg);
31+
static void ResetProcSignalBarrierBits(uint32 flags);
32+
static bool ProcessBarrierPlaceholder(void);
33+
34+
+static void CheckAndSetCustomSignalInterrupts(void);
35+
+
36+
/*
37+
* ProcSignalShmemSize
38+
*Compute space needed for procsignal's shared memory
39+
@@ -246,6 +255,36 @@ CleanupProcSignalState(int status, Datum arg)
40+
slot->pss_pid = 0;
41+
}
42+
43+
+/*
44+
+ * RegisterCustomProcSignalHandler
45+
+ *Assign specific handler of custom process signal with new
46+
+ *ProcSignalReason key.
47+
+ *
48+
+ * This function has to be called in _PG_init function of extensions at the
49+
+ * stage of loading shared preloaded libraries. Otherwise it throws fatal error.
50+
+ *
51+
+ * Return INVALID_PROCSIGNAL if all slots for custom signals are occupied.
52+
+ */
53+
+ProcSignalReason
54+
+RegisterCustomProcSignalHandler(ProcSignalHandler_type handler)
55+
+{
56+
+ProcSignalReason reason;
57+
+
58+
+if (!process_shared_preload_libraries_in_progress)
59+
+ereport(FATAL, (errcode(ERRCODE_INTERNAL_ERROR),
60+
+errmsg("cannot register custom signal after startup")));
61+
+
62+
+/* Iterate through custom signal slots to find a free one */
63+
+for (reason = PROCSIG_CUSTOM_1; reason <= PROCSIG_CUSTOM_N; reason++)
64+
+if (!CustomInterruptHandlers[reason - PROCSIG_CUSTOM_1])
65+
+{
66+
+CustomInterruptHandlers[reason - PROCSIG_CUSTOM_1] = handler;
67+
+return reason;
68+
+}
69+
+
70+
+return INVALID_PROCSIGNAL;
71+
+}
72+
+
73+
/*
74+
* SendProcSignal
75+
*Send a signal to a Postgres process
76+
@@ -679,7 +718,62 @@ procsignal_sigusr1_handler(SIGNAL_ARGS)
77+
if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN))
78+
RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN);
79+
80+
+CheckAndSetCustomSignalInterrupts();
81+
+
82+
SetLatch(MyLatch);
83+
84+
errno = save_errno;
85+
}
86+
+
87+
+/*
88+
+ * Handle receipt of an interrupt indicating any of custom process signals.
89+
+ */
90+
+static void
91+
+CheckAndSetCustomSignalInterrupts()
92+
+{
93+
+ProcSignalReasonreason;
94+
+
95+
+for (reason = PROCSIG_CUSTOM_1; reason <= PROCSIG_CUSTOM_N; reason++)
96+
+{
97+
+if (CheckProcSignal(reason))
98+
+{
99+
+
100+
+/* set interrupt flags */
101+
+InterruptPending = true;
102+
+CustomSignalPendings[reason - PROCSIG_CUSTOM_1] = true;
103+
+}
104+
+}
105+
+
106+
+SetLatch(MyLatch);
107+
+}
108+
+
109+
+/*
110+
+ * CheckAndHandleCustomSignals
111+
+ *Check custom signal flags and call handler assigned to that signal
112+
+ *if it is not NULL
113+
+ *
114+
+ * This function is called within CHECK_FOR_INTERRUPTS if interrupt occurred.
115+
+ */
116+
+void
117+
+CheckAndHandleCustomSignals(void)
118+
+{
119+
+int i;
120+
+
121+
+/* Check on expiring of custom signals and call its handlers if exist */
122+
+for (i = 0; i < NUM_CUSTOM_PROCSIGNALS; i++)
123+
+{
124+
+if (!CustomSignalProcessing[i] && CustomSignalPendings[i])
125+
+{
126+
+ProcSignalHandler_type handler;
127+
+
128+
+CustomSignalPendings[i] = false;
129+
+handler = CustomInterruptHandlers[i];
130+
+if (handler != NULL)
131+
+{
132+
+CustomSignalProcessing[i] = true;
133+
+handler();
134+
+CustomSignalProcessing[i] = false;
135+
+}
136+
+}
137+
+}
138+
+}
139+
\ No newline at end of file
140+
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
141+
index 8cea10c..dd77c98 100644
142+
--- a/src/backend/tcop/postgres.c
143+
+++ b/src/backend/tcop/postgres.c
144+
@@ -3364,6 +3364,8 @@ ProcessInterrupts(void)
145+
if (ParallelMessagePending)
146+
HandleParallelMessages();
147+
148+
+CheckAndHandleCustomSignals();
149+
+
150+
if (LogMemoryContextPending)
151+
ProcessLogMemoryContextInterrupt();
152+
}
153+
diff --git a/src/include/storage/procsignal.h b/src/include/storage/procsignal.h
154+
index eec186b..74af186 100644
155+
--- a/src/include/storage/procsignal.h
156+
+++ b/src/include/storage/procsignal.h
157+
@@ -17,6 +17,8 @@
158+
#include "storage/backendid.h"
159+
160+
161+
+#define NUM_CUSTOM_PROCSIGNALS 64
162+
+
163+
/*
164+
* Reasons for signaling a Postgres child process (a backend or an auxiliary
165+
* process, like checkpointer). We can cope with concurrent signals for different
166+
@@ -29,6 +31,8 @@
167+
*/
168+
typedef enum
169+
{
170+
+INVALID_PROCSIGNAL = -1,/* Must be first */
171+
+
172+
PROCSIG_CATCHUP_INTERRUPT,/* sinval catchup interrupt */
173+
PROCSIG_NOTIFY_INTERRUPT,/* listen/notify interrupt */
174+
PROCSIG_PARALLEL_MESSAGE,/* message from cooperating parallel backend */
175+
@@ -44,6 +48,14 @@ typedef enum
176+
PROCSIG_RECOVERY_CONFLICT_BUFFERPIN,
177+
PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK,
178+
179+
+PROCSIG_CUSTOM_1,
180+
+/*
181+
+ * PROCSIG_CUSTOM_2,
182+
+ * ...,
183+
+ * PROCSIG_CUSTOM_N-1,
184+
+ */
185+
+PROCSIG_CUSTOM_N = PROCSIG_CUSTOM_1 + NUM_CUSTOM_PROCSIGNALS - 1,
186+
+
187+
NUM_PROCSIGNALS/* Must be last! */
188+
} ProcSignalReason;
189+
190+
@@ -56,6 +68,8 @@ typedef enum
191+
*/
192+
PROCSIGNAL_BARRIER_PLACEHOLDER = 0
193+
} ProcSignalBarrierType;
194+
+/* Handler of custom process signal */
195+
+typedef void (*ProcSignalHandler_type) (void);
196+
197+
/*
198+
* prototypes for functions in procsignal.c
199+
@@ -64,12 +78,15 @@ extern Size ProcSignalShmemSize(void);
200+
extern void ProcSignalShmemInit(void);
201+
202+
extern void ProcSignalInit(int pss_idx);
203+
+extern ProcSignalReason
204+
+RegisterCustomProcSignalHandler(ProcSignalHandler_type handler);
205+
extern intSendProcSignal(pid_t pid, ProcSignalReason reason,
206+
BackendId backendId);
207+
208+
extern uint64 EmitProcSignalBarrier(ProcSignalBarrierType type);
209+
extern void WaitForProcSignalBarrier(uint64 generation);
210+
extern void ProcessProcSignalBarrier(void);
211+
+extern void CheckAndHandleCustomSignals(void);
212+
213+
extern void procsignal_sigusr1_handler(SIGNAL_ARGS);
214+
215+
--
216+
2.25.1
217+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp