!3183 【资源池化】对于LockBuffer中多次重试,增加sleep时间
Merge pull request !3183 from 董宁/dn_fix13_up
This commit is contained in:
@ -884,3 +884,12 @@ void SSMarkBufferDirtyForERTO(RedoBufferInfo* bufferinfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int ss_buf_retry_threshold = 5;
|
||||
long SSGetBufSleepTime(int retry_times)
|
||||
{
|
||||
if (retry_times < ss_buf_retry_threshold) {
|
||||
return 5000L * retry_times;
|
||||
}
|
||||
return 1000L * 1000 * 60;
|
||||
}
|
||||
|
||||
@ -5858,6 +5858,7 @@ void LockBuffer(Buffer buffer, int mode)
|
||||
{
|
||||
volatile BufferDesc *buf = NULL;
|
||||
bool need_update_lockid = false;
|
||||
int dms_retry_times = 0;
|
||||
|
||||
Assert(BufferIsValid(buffer));
|
||||
if (BufferIsLocal(buffer)) {
|
||||
@ -5912,7 +5913,8 @@ retry:
|
||||
|
||||
LWLockRelease(buf->content_lock);
|
||||
|
||||
pg_usleep(5000L);
|
||||
dms_retry_times++;
|
||||
pg_usleep(SSGetBufSleepTime(dms_retry_times));
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
@ -5984,6 +5986,7 @@ bool TryLockBuffer(Buffer buffer, int mode, bool must_wait)
|
||||
bool ConditionalLockBuffer(Buffer buffer)
|
||||
{
|
||||
volatile BufferDesc *buf = NULL;
|
||||
int dms_retry_times = 0;
|
||||
|
||||
Assert(BufferIsValid(buffer));
|
||||
if (BufferIsLocal(buffer)) {
|
||||
@ -6015,7 +6018,8 @@ retry:
|
||||
}
|
||||
LWLockRelease(buf->content_lock);
|
||||
|
||||
pg_usleep(5000L);
|
||||
dms_retry_times++;
|
||||
pg_usleep(SSGetBufSleepTime(dms_retry_times));
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,5 +80,6 @@ bool SSSegRead(SMgrRelation reln, ForkNumber forknum, char *buffer);
|
||||
bool DmsCheckBufAccessible();
|
||||
bool SSHelpFlushBufferIfNeed(BufferDesc* buf_desc);
|
||||
void SSMarkBufferDirtyForERTO(RedoBufferInfo* bufferinfo);
|
||||
long SSGetBufSleepTime(int retry_times);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user