public inbox for [email protected]
help / color / mirror / Atom feedFrom: Peter Eisentraut <[email protected]>
To: Heikki Linnakangas <[email protected]>
To: [email protected]
Subject: Re: pgsql: Make cancel request keys longer
Date: Tue, 8 Apr 2025 19:06:33 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
On 02.04.25 15:43, Heikki Linnakangas wrote:
> Make cancel request keys longer
This patch changed the signature of ProcSignal()
-ProcSignalInit(bool cancel_key_valid, int32 cancel_key)
+ProcSignalInit(char *cancel_key, int cancel_key_len)
but did not update the caller in auxprocess.c:
ProcSignalInit(false, 0);
This gives a warning with clang.
While I was looking at this, I suggest to make the first argument void
*. This is consistent for passing binary data.
Also, I wonder why MyCancelKeyLength is of type uint8 rather than
something more mundane like int. There doesn't seem to be any API
reason for this type.
See attached patch for possible changes.
From 8abe6e66521de7fe5d2132fd5471265ef1bf6b0e Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <[email protected]>
Date: Tue, 8 Apr 2025 19:01:29 +0200
Subject: [PATCH] WIP: Fix cancel key stuff
---
src/backend/postmaster/auxprocess.c | 2 +-
src/backend/storage/ipc/procsignal.c | 2 +-
src/backend/utils/init/globals.c | 2 +-
src/include/miscadmin.h | 2 +-
src/include/storage/procsignal.h | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/backend/postmaster/auxprocess.c b/src/backend/postmaster/auxprocess.c
index 4f6795f7265..a6d3630398f 100644
--- a/src/backend/postmaster/auxprocess.c
+++ b/src/backend/postmaster/auxprocess.c
@@ -66,7 +66,7 @@ AuxiliaryProcessMainCommon(void)
BaseInit();
- ProcSignalInit(false, 0);
+ ProcSignalInit(NULL, 0);
/*
* Auxiliary processes don't run transactions, but they may need a
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index a3c2cd12277..33b1a5be276 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -162,7 +162,7 @@ ProcSignalShmemInit(void)
* Register the current process in the ProcSignal array
*/
void
-ProcSignalInit(char *cancel_key, int cancel_key_len)
+ProcSignalInit(const void *cancel_key, int cancel_key_len)
{
ProcSignalSlot *slot;
uint64 barrier_generation;
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index 92304a1f124..1847e7c85d3 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -51,7 +51,7 @@ TimestampTz MyStartTimestamp;
struct ClientSocket *MyClientSocket;
struct Port *MyProcPort;
char MyCancelKey[MAX_CANCEL_KEY_LENGTH];
-uint8 MyCancelKeyLength = 0;
+int MyCancelKeyLength = 0;
int MyPMChildSlot;
/*
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 58b2496a9cb..72f5655fb34 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -193,7 +193,7 @@ extern PGDLLIMPORT TimestampTz MyStartTimestamp;
extern PGDLLIMPORT struct Port *MyProcPort;
extern PGDLLIMPORT struct Latch *MyLatch;
extern PGDLLIMPORT char MyCancelKey[];
-extern PGDLLIMPORT uint8 MyCancelKeyLength;
+extern PGDLLIMPORT int MyCancelKeyLength;
extern PGDLLIMPORT int MyPMChildSlot;
extern PGDLLIMPORT char OutputFileName[];
diff --git a/src/include/storage/procsignal.h b/src/include/storage/procsignal.h
index cfe14631445..08108a5d7de 100644
--- a/src/include/storage/procsignal.h
+++ b/src/include/storage/procsignal.h
@@ -73,7 +73,7 @@ typedef enum
extern Size ProcSignalShmemSize(void);
extern void ProcSignalShmemInit(void);
-extern void ProcSignalInit(char *cancel_key, int cancel_key_len);
+extern void ProcSignalInit(const void *cancel_key, int cancel_key_len);
extern int SendProcSignal(pid_t pid, ProcSignalReason reason,
ProcNumber procNumber);
extern void SendCancelRequest(int backendPID, char *cancel_key, int cancel_key_len);
--
2.49.0
Attachments:
[text/plain] 0001-WIP-Fix-cancel-key-stuff.patch (2.9K, 2-0001-WIP-Fix-cancel-key-stuff.patch)
download | inline diff:
From 8abe6e66521de7fe5d2132fd5471265ef1bf6b0e Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <[email protected]>
Date: Tue, 8 Apr 2025 19:01:29 +0200
Subject: [PATCH] WIP: Fix cancel key stuff
---
src/backend/postmaster/auxprocess.c | 2 +-
src/backend/storage/ipc/procsignal.c | 2 +-
src/backend/utils/init/globals.c | 2 +-
src/include/miscadmin.h | 2 +-
src/include/storage/procsignal.h | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/backend/postmaster/auxprocess.c b/src/backend/postmaster/auxprocess.c
index 4f6795f7265..a6d3630398f 100644
--- a/src/backend/postmaster/auxprocess.c
+++ b/src/backend/postmaster/auxprocess.c
@@ -66,7 +66,7 @@ AuxiliaryProcessMainCommon(void)
BaseInit();
- ProcSignalInit(false, 0);
+ ProcSignalInit(NULL, 0);
/*
* Auxiliary processes don't run transactions, but they may need a
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index a3c2cd12277..33b1a5be276 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -162,7 +162,7 @@ ProcSignalShmemInit(void)
* Register the current process in the ProcSignal array
*/
void
-ProcSignalInit(char *cancel_key, int cancel_key_len)
+ProcSignalInit(const void *cancel_key, int cancel_key_len)
{
ProcSignalSlot *slot;
uint64 barrier_generation;
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index 92304a1f124..1847e7c85d3 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -51,7 +51,7 @@ TimestampTz MyStartTimestamp;
struct ClientSocket *MyClientSocket;
struct Port *MyProcPort;
char MyCancelKey[MAX_CANCEL_KEY_LENGTH];
-uint8 MyCancelKeyLength = 0;
+int MyCancelKeyLength = 0;
int MyPMChildSlot;
/*
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 58b2496a9cb..72f5655fb34 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -193,7 +193,7 @@ extern PGDLLIMPORT TimestampTz MyStartTimestamp;
extern PGDLLIMPORT struct Port *MyProcPort;
extern PGDLLIMPORT struct Latch *MyLatch;
extern PGDLLIMPORT char MyCancelKey[];
-extern PGDLLIMPORT uint8 MyCancelKeyLength;
+extern PGDLLIMPORT int MyCancelKeyLength;
extern PGDLLIMPORT int MyPMChildSlot;
extern PGDLLIMPORT char OutputFileName[];
diff --git a/src/include/storage/procsignal.h b/src/include/storage/procsignal.h
index cfe14631445..08108a5d7de 100644
--- a/src/include/storage/procsignal.h
+++ b/src/include/storage/procsignal.h
@@ -73,7 +73,7 @@ typedef enum
extern Size ProcSignalShmemSize(void);
extern void ProcSignalShmemInit(void);
-extern void ProcSignalInit(char *cancel_key, int cancel_key_len);
+extern void ProcSignalInit(const void *cancel_key, int cancel_key_len);
extern int SendProcSignal(pid_t pid, ProcSignalReason reason,
ProcNumber procNumber);
extern void SendCancelRequest(int backendPID, char *cancel_key, int cancel_key_len);
--
2.49.0
view thread (11+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: pgsql: Make cancel request keys longer
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox