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

Commit64638cc

Browse files
committed
Report waiting via PS while recovery is waiting for buffer pin in hot standby.
Previously while the startup process was waiting for the recovery conflictwith snapshot, tablespace or lock to be resolved, waiting was reported inPS display, but not in the case of recovery conflict with buffer pin.This commit makes the startup process in hot standby report waiting via PSwhile waiting for the conflicts with other backends holding buffer pins tobe resolved.Author: Masahiko SawadaReviewed-by: Fujii MasaoDiscussion:https://postgr.es/m/CA+fd4k4mXWTwfQLS3RPwGr4xnfAEs1ysFfgYHvmmoUgv6Zxvmg@mail.gmail.com
1 parent246f136 commit64638cc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include"storage/proc.h"
5050
#include"storage/smgr.h"
5151
#include"storage/standby.h"
52+
#include"utils/ps_status.h"
5253
#include"utils/rel.h"
5354
#include"utils/resowner_private.h"
5455
#include"utils/timestamp.h"
@@ -3616,6 +3617,7 @@ void
36163617
LockBufferForCleanup(Bufferbuffer)
36173618
{
36183619
BufferDesc*bufHdr;
3620+
char*new_status=NULL;
36193621

36203622
Assert(BufferIsValid(buffer));
36213623
Assert(PinCountWaitBuf==NULL);
@@ -3650,6 +3652,13 @@ LockBufferForCleanup(Buffer buffer)
36503652
{
36513653
/* Successfully acquired exclusive lock with pincount 1 */
36523654
UnlockBufHdr(bufHdr,buf_state);
3655+
3656+
/* Report change to non-waiting status */
3657+
if (new_status)
3658+
{
3659+
set_ps_display(new_status);
3660+
pfree(new_status);
3661+
}
36533662
return;
36543663
}
36553664
/* Failed, so mark myself as waiting for pincount 1 */
@@ -3668,6 +3677,20 @@ LockBufferForCleanup(Buffer buffer)
36683677
/* Wait to be signaled by UnpinBuffer() */
36693678
if (InHotStandby)
36703679
{
3680+
/* Report change to waiting status */
3681+
if (update_process_title&&new_status==NULL)
3682+
{
3683+
constchar*old_status;
3684+
intlen;
3685+
3686+
old_status=get_ps_display(&len);
3687+
new_status= (char*)palloc(len+8+1);
3688+
memcpy(new_status,old_status,len);
3689+
strcpy(new_status+len," waiting");
3690+
set_ps_display(new_status);
3691+
new_status[len]='\0';/* truncate off " waiting" */
3692+
}
3693+
36713694
/* Publish the bufid that Startup process waits on */
36723695
SetStartupBufferPinWaitBufId(buffer-1);
36733696
/* Set alarm and then wait to be signaled by UnpinBuffer() */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp