From b166a3778d7ae41f4c53c0d0e25497c13089a294 Mon Sep 17 00:00:00 2001 From: "Anton A. Melnikov" Date: Sun, 24 Oct 2021 18:53:01 +0300 Subject: [PATCH 1/2] [PGPRO-5703] Run installcheck against an existing installation. Tags: pg_query_state --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e017e60..ca9faab 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,11 @@ ISOLATIONCHECKS = corner_cases check: isolationcheck -installcheck: isolationcheck +installcheck: submake-isolation + $(MKDIR_P) isolation_output + $(pg_isolation_regress_installcheck) \ + --outputdir=isolation_output \ + $(ISOLATIONCHECKS) isolationcheck: | submake-isolation temp-install $(MKDIR_P) isolation_output From a9168b94ba446f46471143922bc4b1414f74be86 Mon Sep 17 00:00:00 2001 From: "Anton A. Melnikov" Date: Wed, 27 Oct 2021 10:36:41 +0300 Subject: [PATCH 2/2] [PGPRO-5703] Place setting of n_peers after the exit on permission denied. Previously setting of n_peers before error exit leds to a warning: pg_query_state: last request was interrupted and MAX_RCV_TIMEOUT pause at second function call. Tags: pg_query_state --- pg_query_state.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pg_query_state.c b/pg_query_state.c index a4a7d1b..935fbf8 100644 --- a/pg_query_state.c +++ b/pg_query_state.c @@ -541,14 +541,18 @@ pg_query_state(PG_FUNCTION_ARGS) break; } } - pg_atomic_write_u32(&counterpart_userid->n_peers, 1); - params->reqid = ++reqid; - pg_write_barrier(); counterpart_user_id = GetRemoteBackendUserId(proc); if (!(superuser() || GetUserId() == counterpart_user_id)) + { + UnlockShmem(&tag); ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("permission denied"))); + } + + pg_atomic_write_u32(&counterpart_userid->n_peers, 1); + params->reqid = ++reqid; + pg_write_barrier(); bg_worker_procs = GetRemoteBackendWorkers(proc);