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

Commit2daa422

Browse files
maksm90akorotkov
authored andcommitted
Add detach after unsuccessful receives and checks on their after sends
1 parent46e09bc commit2daa422

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

‎collector.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,25 @@ send_history(History *observations, shm_mq_handle *mqh)
210210
{
211211
Sizecount,
212212
i;
213+
shm_mq_resultmq_result;
213214

214215
if (observations->wraparound)
215216
count=observations->count;
216217
else
217218
count=observations->index;
218219

219-
shm_mq_send(mqh,sizeof(count),&count, false);
220+
mq_result=shm_mq_send(mqh,sizeof(count),&count, false);
221+
if (mq_result==SHM_MQ_DETACHED)
222+
return;
220223
for (i=0;i<count;i++)
221-
shm_mq_send(mqh,sizeof(HistoryItem),&observations->items[i], false);
224+
{
225+
mq_result=shm_mq_send(mqh,
226+
sizeof(HistoryItem),
227+
&observations->items[i],
228+
false);
229+
if (mq_result==SHM_MQ_DETACHED)
230+
return;
231+
}
222232
}
223233

224234
/*

‎pg_wait_sampling.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,14 @@ receive_array(SHMRequest request, Size item_size, Size *count)
540540
{
541541
res=shm_mq_receive(mqh,&len,&data, false);
542542
if (res!=SHM_MQ_SUCCESS||len!=item_size)
543+
{
544+
#ifPG_VERSION_NUM >=100000
545+
shm_mq_detach(mqh);
546+
#else
547+
shm_mq_detach(mq);
548+
#endif
543549
elog(ERROR,"Error reading mq.");
550+
}
544551
memcpy(ptr,data,item_size);
545552
ptr+=item_size;
546553
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp