8000 [PGPRO-7010] - Revision of docker tests for pg_query_state under vers… · postgrespro/pg_query_state@93afc91 · GitHub
[go: up one dir, main page]

Skip to content

Commit 93afc91

Browse files
committed
[PGPRO-7010] - Revision of docker tests for pg_query_state under version 15
tags: pg_query_state
1 parent 445dd4c commit 93afc91

File tree

4 files changed

+46
-35
lines changed

4 files changed

+46
-35
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ notifications:
2222
on_failure: always
2323

2424
env:
25+
- PG_VERSION=15 LEVEL=hardcore USE_TPCDS=0
26+
- PG_VERSION=15
2527
- PG_VERSION=14 LEVEL=hardcore USE_TPCDS=0
2628
- PG_VERSION=14
2729
- PG_VERSION=13 LEVEL=hardcore USE_TPCDS=0

patches/custom_signals_15.0.patch

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/proc
22
index defb75a..4245d28 100644
33
--- a/src/backend/storage/ipc/procsignal.c
44
+++ b/src/backend/storage/ipc/procsignal.c
5-
@@ -95,6 +95,13 @@ typedef struct
5+
@@ -96,6 +96,13 @@ typedef struct
66
#define BARRIER_CLEAR_BIT(flags, type) \
77
((flags) &= ~(((uint32) 1) << (uint32) (type)))
8-
8+
99
+#define IsCustomProcSignalReason(reason) \
1010
+ ((reason) >= PROCSIG_CUSTOM_1 && (reason) <= PROCSIG_CUSTOM_N)
1111
+
@@ -15,20 +15,20 @@ index defb75a..4245d28 100644
1515
+
1616
static ProcSignalHeader *ProcSignal = NULL;
1717
static ProcSignalSlot *MyProcSignalSlot = NULL;
18-
19-
@@ -103,6 +110,8 @@ static void CleanupProcSignalState(int status, Datum arg);
18+
19+
@@ -103,6 +110,8 @@ static bool CheckProcSignal(ProcSignalReason reason);
20+
static void CleanupProcSignalState(int status, Datum arg);
2021
static void ResetProcSignalBarrierBits(uint32 flags);
21-
static bool ProcessBarrierPlaceholder(void);
22-
22+
2323
+static void CheckAndSetCustomSignalInterrupts(void);
2424
+
2525
/*
2626
* ProcSignalShmemSize
27-
* Compute space needed for procsignal's shared memory
27+
* Compute space needed for ProcSignal's shared memory
2828
@@ -246,6 +255,36 @@ CleanupProcSignalState(int status, Datum arg)
2929
slot->pss_pid = 0;
3030
}
31-
31+
3232
+/*
3333
+ * RegisterCustomProcSignalHandler
3434
+ * Assign specific handler of custom process signal with new
@@ -62,7 +62,7 @@ index defb75a..4245d28 100644
6262
/*
6363
* SendProcSignal
6464
* Send a signal to a Postgres process
65-
@@ -679,7 +718,62 @@ procsignal_sigusr1_handler(SIGNAL_ARGS)
65+
@@ -675,7 +714,72 @@ procsignal_sigusr1_handler(SIGNAL_ARGS)
6666
if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN))
6767
RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN);
6868

@@ -135,12 +135,12 @@ index defb75a..4245d28 100644
135135
+
136136
+ RESUME_INTERRUPTS();
137137
+}
138-
\ No newline at end of file
138+
+
139139
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
140140
index 8cea10c..dd77c98 100644
141141
--- a/src/backend/tcop/postgres.c
142142
+++ b/src/backend/tcop/postgres.c
143-
@@ -3364,6 +3364,8 @@ ProcessInterrupts(void)
143+
@@ -3402,6 +3402,8 @@ ProcessInterrupts(void)
144144
if (ParallelMessagePending)
145145
HandleParallelMessages();
146146

@@ -186,16 +186,17 @@ index eec186b..74af186 100644
186186
NUM_PROCSIGNALS /* Must be last! */
187187
} ProcSignalReason;
188188

189-
@@ -56,6 +68,8 @@ typedef enum
190-
*/
191-
PROCSIGNAL_BARRIER_PLACEHOLDER = 0
189+
@@ -51,6 +63,9 @@ typedef enum
190+
{
191+
PROCSIGNAL_BARRIER_SMGRRELEASE /* ask smgr to close files */
192192
} ProcSignalBarrierType;
193+
+
193194
+/* Handler of custom process signal */
194195
+typedef void (*ProcSignalHandler_type) (void);
195196

196197
/*
197198
* prototypes for functions in procsignal.c
198-
@@ -64,12 +78,15 @@ extern Size ProcSignalShmemSize(void);
199+
@@ -59,12 +74,15 @@ extern Size ProcSignalShmemSize(void);
199200
extern void ProcSignalShmemInit(void);
200201

201202
extern void ProcSignalInit(int pss_idx);

patches/runtime_explain_15.0.patch

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
22
index 10644dfac4..7106ed4257 100644
33
--- a/src/backend/commands/explain.c
44
+++ b/src/backend/commands/explain.c
5-
@@ -984,14 +984,36 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
5+
@@ -990,14 +990,36 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
66
char *relname;
77
char *conname = NULL;
88

@@ -40,7 +40,7 @@ index 10644dfac4..7106ed4257 100644
4040
continue;
4141

4242
ExplainOpenGroup("Trigger", NULL, true, es);
43-
@@ -1017,9 +1039,9 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
43+
@@ -1023,9 +1045,9 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
4444
appendStringInfo(es->str, " on %s", relname);
4545
if (es->timing)
4646
appendStringInfo(es->str, ": time=%.3f calls=%.0f\n",
@@ -52,7 +52,7 @@ index 10644dfac4..7106ed4257 100644
5252
}
5353
else
5454
{
55-
@@ -1028,9 +1050,8 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
55+
@@ -1034,9 +1056,8 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
5656
ExplainPropertyText("Constraint Name", conname, es);
5757
ExplainPropertyText("Relation", relname, es);
5858
if (es->timing)
@@ -64,7 +64,7 @@ index 10644dfac4..7106ed4257 100644
6464
}
6565

6666
if (conname)
67-
@@ -1600,8 +1621,11 @@ ExplainNode(PlanState *planstate, List *ancestors,
67+
@@ -1609,8 +1630,11 @@ ExplainNode(PlanState *planstate, List *ancestors,
6868
* instrumentation results the user didn't ask for. But we do the
6969
* InstrEndLoop call anyway, if possible, to reduce the number of cases
7070
* auto_explain has to contend with.
@@ -77,7 +77,7 @@ index 10644dfac4..7106ed4257 100644
7777
InstrEndLoop(planstate->instrument);
7878

7979
if (es->analyze &&
80-
@@ -1636,7 +1660,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
80+
@@ -1645,7 +1669,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
8181
ExplainPropertyFloat("Actual Loops", NULL, nloops, 0, es);
8282
}
8383
}
@@ -86,7 +86,7 @@ index 10644dfac4..7106ed4257 100644
8686
{
8787
if (es->format == EXPLAIN_FORMAT_TEXT)
8888
appendStringInfoString(es->str, " (never executed)");
89-
@@ -1652,6 +1676,75 @@ ExplainNode(PlanState *planstate, List *ancestors,
89+
@@ -1661,6 +1685,75 @@ ExplainNode(PlanState *planstate, List *ancestors,
9090
}
9191
}
9292

@@ -162,7 +162,7 @@ index 10644dfac4..7106ed4257 100644
162162
/* in text format, first line ends here */
163163
if (es->format == EXPLAIN_FORMAT_TEXT)
164164
appendStringInfoChar(es->str, '\n');
165-
@@ -2051,6 +2144,9 @@ ExplainNode(PlanState *planstate, List *ancestors,
165+
@@ -2068,6 +2161,9 @@ ExplainNode(PlanState *planstate, List *ancestors,
166166

167167
/* Prepare per-worker buffer/WAL usage */
168168
if (es->workers_state && (es->buffers || es->wal) && es->verbose)
@@ -172,7 +172,7 @@ index 10644dfac4..7106ed4257 100644
172172
{
173173
WorkerInstrumentation *w = planstate->worker_instrument;
174174

175-
@@ -3015,6 +3111,11 @@ show_hash_info(HashState *hashstate, ExplainState *es)
175+
@@ -3032,6 +3128,11 @@ show_hash_info(HashState *hashstate, ExplainState *es)
176176
memcpy(&hinstrument, hashstate->hinstrument,
177177
sizeof(HashInstrumentation));
178178

@@ -184,7 +184,7 @@ index 10644dfac4..7106ed4257 100644
184184
/*
185185
* Merge results from workers. In the parallel-oblivious case, the
186186
* results from all participants should be identical, except where
187-
@@ -3392,20 +3493,16 @@ show_instrumentation_count(const char *qlabel, int which,
187+
@@ -3412,20 +3513,16 @@ show_instrumentation_count(const char *qlabel, int which,
188188
if (!es->analyze || !planstate->instrument)
189189
return;
190190

@@ -209,7 +209,7 @@ index 10644dfac4..7106ed4257 100644
209209
}
210210

211211
/*
212-
@@ -3977,15 +4074,27 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors,
212+
@@ -4028,15 +4125,27 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors,
213213
double insert_path;
214214
double other_path;
215215

tests/test_cases.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff lin 10000 e change
@@ -45,7 +45,7 @@ def test_simple_query(config):
4545
acon1, acon2 = common.n_async_connect(config, 2)
4646
query = 'select count(*) from foo join bar on foo.c1=bar.c1 and unlock_if_eq_1(foo.c1)=bar.c1'
4747
expected = r"""Aggregate \(Current loop: actual rows=\d+, loop number=1\)
48-
-> Hash Join \(Current loop: actual rows=62473, loop number=1\)
48+
-> Hash Join \(Current loop: actual rows=\d+, loop number=1\)
4949
Hash Cond: \(foo.c1 = bar.c1\)
5050
Join Filter: \(unlock_if_eq_1\(foo.c1\) = bar.c1\)
5151
-> Seq Scan on foo \(Current loop: actual rows=\d+, loop number=1\)
@@ -111,10 +111,10 @@ def test_nested_call(config):
111111
expected_nested = r"""Result \(Current loop: actual rows=0, loop number=1\)
112112
InitPlan 1 \(returns \$0\)
113113
-> Aggregate \(Current loop: actual rows=0, loop number=1\)
114-
-> Hash Join \(Current loop: actual rows=62473, loop number=1\)
114+
-> Hash Join \(Current loop: actual rows=\d+, loop number=1\)
115115
Hash Cond: \(foo.c1 = bar.c1\)
116116
Join Filter: \(unlock_if_eq_1\(foo.c1\) = bar.c1\)
117-
-> Seq Scan on foo \(Current loop: actual rows=1000000, loop number=1\)
117+
-> Seq Scan on foo \(Current loop: actual rows=\d+, loop number=1\)
118118
-> Hash \(Current loop: actual rows=500000, loop number=1\)
119119
Buckets: \d+ Batches: \d+ Memory Usage: \d+kB
120120
-> Seq Scan on bar \(Current loop: actual rows=\d+, loop number=1\)"""
@@ -232,7 +232,7 @@ def test_costs(config):
232232
-> Hash Join \(cost=\d+.\d+..\d+.\d+ rows=\d+ width=0\) \(Current loop: actual rows=\d+, loop number=1\)
233233
Hash Cond: \(foo.c1 = bar.c1\)
234234
Join Filter: \(unlock_if_eq_1\(foo.c1\) = bar.c1\)
235-
-> Seq Scan on foo \(cost=0.00..\d+.\d+ rows=\d+ width=4\) \(Current loop: actual rows=1000000, loop number=1\)
235+
-> Seq Scan on foo \(cost=0.00..\d+.\d+ rows=\d+ width=4\) \(Current loop: actual rows=\d+, loop number=1\)
236236
-> Hash \(cost=\d+.\d+..\d+.\d+ rows=\d+ width=4\) \(Current loop: actual rows=500000, loop number=1\)
237237
Buckets: \d+ Batches: \d+ Memory Usage: \d+kB
238238
-> Seq Scan on bar \(cost=0.00..\d+.\d+ rows=\d+ width=4\) \(Current loop: actual rows=\d+, loop number=1\)"""
@@ -249,25 +249,33 @@ def test_buffers(config):
249249

250250
acon1, acon2 = common.n_async_connect(config, 2)
251251
query = 'select count(*) from foo join bar on foo.c1=bar.c1 and unlock_if_eq_1(foo.c1)=bar.c1'
252-
expected = r"""Aggregate \(Current loop: actual rows=0, loop number=1\)
252+
temporary = r"""Aggregate \(Current loop: actual rows=0, loop number=1\)
253253
-> Hash Join \(Current loop: actual rows=\d+, loop number=1\)
254254
Hash Cond: \(foo.c1 = bar.c1\)
255-
Join Filter: \(unlock_if_eq_1\(foo.c1\) = bar.c1\)
256-
Buffers: shared hit=\d+, temp read=\d+ written=\d+
257-
-> Seq Scan on foo \(Current loop: actual rows=1000000, loop number=1\)
255+
Join Filter: \(unlock_if_eq_1\(foo.c1\) = bar.c1\)"""
256+
expected = temporary
257+
expected_15 = temporary
258+
expected += r"""
259+
Buffers: shared hit=\d+, temp read=\d+ written=\d+"""
260+
expected_15 += r"""
261+
Buffers: shared hit=\d+, temp written=\d+"""
262+
temporary = r"""
263+
-> Seq Scan on foo \(Current loop: actual rows=\d+, loop number=1\)
258264
Buffers: [^\n]*
259265
-> Hash \(Current loop: actual rows=500000, loop number=1\)
260266
Buckets: \d+ Batches: \d+ Memory Usage: \d+kB
261267
Buffers: shared hit=\d+, temp written=\d+
262268
-> Seq Scan on bar \(Current loop: actual rows=\d+, loop number=1\)
263269
Buffers: .*"""
270+
expected += temporary
271+
expected_15 += temporary
264272

265273
common.set_guc(acon1, 'pg_query_state.enable_buffers', 'on')
266274

267275
qs, notices = common.onetime_query_state_locks(config, acon1, acon2, query, {'buffers': True})
268276

269277
assert len(qs) == 2
270-
assert re.match(expected, qs[0][3])
278+
assert (re.match(expected, qs[0][3]) or re.match(expected_15, qs[0][3]))
271279
assert len(notices) == 0
272280

273281
common.n_close((acon1, acon2))
@@ -282,7 +290,7 @@ def test_timing(config):
282290
-> Hash Join \(Current loop: actual time=\d+.\d+..\d+.\d+ rows=\d+, loop number=1\)
283291
Hash Cond: \(foo.c1 = bar.c1\)
284292
Join Filter: \(unlock_if_eq_1\(foo.c1\) = bar.c1\)
285-
-> Seq Scan on foo \(Current loop: actual time=\d+.\d+..\d+.\d+ rows=1000000, loop number=1\)
293+
-> Seq Scan on foo \(Current loop: actual time=\d+.\d+..\d+.\d+ rows=\d+, loop number=1\)
286294
-> Hash \(Current loop: actual time=\d+.\d+..\d+.\d+ rows=500000, loop number=1\)
287295
Buckets: \d+ Batches: \d+ Memory Usage: \d+kB
288296
-> Seq Scan on bar \(Current loop: actual time=\d+.\d+..\d+.\d+ rows=\d+, loop number=1\)"""

0 commit comments

Comments
 (0)
0