Skip to content

Commit 81a915a

Browse files
committed
Set mq sender before sending signal
1 parent c0f0363 commit 81a915a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pg_query_state.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -747,10 +747,10 @@ static shm_mq_result
747747
shm_mq_receive_with_timeout(shm_mq_handle *mqh,
748748
Size *nbytesp,
749749
void **datap,
750-
long timeout)
750+
int64 timeout)
751751
{
752752
int rc = 0;
753-
long delay = timeout;
753+
int64 delay = timeout;
754754
instr_time start_time;
755755
instr_time cur_time;
756756

@@ -781,7 +781,7 @@ shm_mq_receive_with_timeout(shm_mq_handle *mqh,
781781
INSTR_TIME_SET_CURRENT(cur_time);
782782
INSTR_TIME_SUBTRACT(cur_time, start_time);
783783

784-
delay = timeout - (long) INSTR_TIME_GET_MILLISEC(cur_time);
784+
delay = timeout - (int64) INSTR_TIME_GET_MILLISEC(cur_time);
785785
if (delay <= 0)
786786
return SHM_MQ_WOULD_BLOCK;
787787

@@ -967,6 +967,8 @@ GetRemoteBackendQueryStates(PGPROC *leader,
967967

968968
/* initialize message queue that will transfer query states */
969969
mq = shm_mq_create(mq, QUEUE_SIZE);
970+
shm_mq_set_sender(mq, leader);
971+
shm_mq_set_receiver(mq, MyProc);
970972

971973
/*
972974
* send signal `QueryStatePollReason` to all processes and define all alive
@@ -999,8 +1001,6 @@ GetRemoteBackendQueryStates(PGPROC *leader,
9991001
}
10001002

10011003
/* extract query state from leader process */
1002-
shm_mq_set_sender(mq, leader);
1003-
shm_mq_set_receiver(mq, MyProc);
10041004
mqh = shm_mq_attach(mq, NULL, NULL);
10051005
mq_receive_result = shm_mq_receive(mqh, &len, (void **) &msg, false);
10061006
if (mq_receive_result != SHM_MQ_SUCCESS)

signal_handler.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ SendQueryState(void)
159159
shm_mq_handle *mqh;
160160
instr_time start_time;
161161
instr_time cur_time;
162-
long delay = MAX_SND_TIMEOUT;
162+
int64 delay = MAX_SND_TIMEOUT;
163163

164164
INSTR_TIME_SET_CURRENT(start_time);
165165

@@ -179,7 +179,7 @@ SendQueryState(void)
179179
INSTR_TIME_SET_CURRENT(cur_time);
180180
INSTR_TIME_SUBTRACT(cur_time, start_time);
181181

182-
delay = MAX_SND_TIMEOUT - (long) INSTR_TIME_GET_MILLISEC(cur_time);
182+
delay = MAX_SND_TIMEOUT - (int64) INSTR_TIME_GET_MILLISEC(cur_time);
183183
if (delay <= 0)
184184
{
185185
elog(WARNING, "pg_query_state: failed to receive request from leader");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy