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

Commit26158b8

Browse files
committed
Use ExtendBufferedRelTo() in XLogReadBufferExtended()
Instead of extending the relation block-by-block, use ExtendBufferedRelTo(),introduced in31966b1. This is faster and simpler.This also somewhat reduces the danger that disconnected segments pose (whichcan be "discovered" once the previous segment reaches SEGSIZE), asExtendBufferedRelTo() won't extend past the block it has been asked. However,the risk of the content of such a disconnected segment being invalidremains.Discussion:https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.deDiscussion:https://postgr.es/m/20230223010147.32oir7sb66slqnjk@awork3.anarazel.de
1 parentae78cae commit26158b8

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

‎src/backend/access/transam/xlogutils.c

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -524,28 +524,13 @@ XLogReadBufferExtended(RelFileLocator rlocator, ForkNumber forknum,
524524
/* OK to extend the file */
525525
/* we do this in recovery only - no rel-extension lock needed */
526526
Assert(InRecovery);
527-
buffer=InvalidBuffer;
528-
do
529-
{
530-
if (buffer!=InvalidBuffer)
531-
{
532-
if (mode==RBM_ZERO_AND_LOCK||mode==RBM_ZERO_AND_CLEANUP_LOCK)
533-
LockBuffer(buffer,BUFFER_LOCK_UNLOCK);
534-
ReleaseBuffer(buffer);
535-
}
536-
buffer=ReadBufferWithoutRelcache(rlocator,forknum,
537-
P_NEW,mode,NULL, true);
538-
}
539-
while (BufferGetBlockNumber(buffer)<blkno);
540-
/* Handle the corner case that P_NEW returns non-consecutive pages */
541-
if (BufferGetBlockNumber(buffer)!=blkno)
542-
{
543-
if (mode==RBM_ZERO_AND_LOCK||mode==RBM_ZERO_AND_CLEANUP_LOCK)
544-
LockBuffer(buffer,BUFFER_LOCK_UNLOCK);
545-
ReleaseBuffer(buffer);
546-
buffer=ReadBufferWithoutRelcache(rlocator,forknum,blkno,
547-
mode,NULL, true);
548-
}
527+
buffer=ExtendBufferedRelTo(EB_SMGR(smgr,RELPERSISTENCE_PERMANENT),
528+
forknum,
529+
NULL,
530+
EB_PERFORMING_RECOVERY |
531+
EB_SKIP_EXTENSION_LOCK,
532+
blkno+1,
533+
mode);
549534
}
550535

551536
recent_buffer_fast_path:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp