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

Commit9ecbf54

Browse files
committed
Add assert to WALReadFromBuffers().
Per suggestion from Andres.Discussion:https://postgr.es/m/20240214025508.6mcblauossthvaw3@awork3.anarazel.de
1 parent5497daf commit9ecbf54

File tree

1 file changed

+6
-18
lines changed
  • src/backend/access/transam

1 file changed

+6
-18
lines changed

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

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,12 +1710,13 @@ GetXLogBuffer(XLogRecPtr ptr, TimeLineID tli)
17101710
* of bytes read successfully.
17111711
*
17121712
* Fewer than 'count' bytes may be read if some of the requested WAL data has
1713-
* already been evicted from the WAL buffers, or if the caller requests data
1714-
* that is not yet available.
1713+
* already been evicted.
17151714
*
17161715
* No locks are taken.
17171716
*
1718-
* The 'tli' argument is only used as a convenient safety check so that
1717+
* Caller should ensure that it reads no further than LogwrtResult.Write
1718+
* (which should have been updated by the caller when determining how far to
1719+
* read). The 'tli' argument is only used as a convenient safety check so that
17191720
* callers do not read from WAL buffers on a historical timeline.
17201721
*/
17211722
Size
@@ -1724,26 +1725,13 @@ WALReadFromBuffers(char *dstbuf, XLogRecPtr startptr, Size count,
17241725
{
17251726
char*pdst=dstbuf;
17261727
XLogRecPtrrecptr=startptr;
1727-
XLogRecPtrupto;
1728-
Sizenbytes;
1728+
Sizenbytes=count;
17291729

17301730
if (RecoveryInProgress()||tli!=GetWALInsertionTimeLine())
17311731
return0;
17321732

17331733
Assert(!XLogRecPtrIsInvalid(startptr));
1734-
1735-
/*
1736-
* Don't read past the available WAL data.
1737-
*
1738-
* Check using local copy of LogwrtResult. Ordinarily it's been updated by
1739-
* the caller when determining how far to read; but if not, it just means
1740-
* we'll read less data.
1741-
*
1742-
* XXX: the available WAL could be extended to the WAL insert pointer by
1743-
* calling WaitXLogInsertionsToFinish().
1744-
*/
1745-
upto=Min(startptr+count,LogwrtResult.Write);
1746-
nbytes=upto-startptr;
1734+
Assert(startptr+count <=LogwrtResult.Write);
17471735

17481736
/*
17491737
* Loop through the buffers without a lock. For each buffer, atomically

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp