Skip to content

Commit dc88460

Browse files
committed
Doc: Review for "Optionally prefetch referenced data in recovery."
Typos, corrections and language improvements in the docs, and a few in code comments too. Reported-by: Justin Pryzby <pryzby@telsasoft.com> Discussion: https://postgr.es/m/20210409033703.GP6592%40telsasoft.com
1 parent 49fb4e6 commit dc88460

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

doc/src/sgml/config.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3621,7 +3621,7 @@ include_dir 'conf.d'
36213621
pool after that. However, on file systems with a block size larger
36223622
than
36233623
<productname>PostgreSQL</productname>'s, prefetching can avoid a
3624-
costly read-before-write when a blocks are later written.
3624+
costly read-before-write when blocks are later written.
36253625
The default is off.
36263626
</para>
36273627
</listitem>

doc/src/sgml/wal.sgml

+1-3
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,7 @@
816816
prefetching mechanism is most likely to be effective on systems
817817
with <varname>full_page_writes</varname> set to
818818
<varname>off</varname> (where that is safe), and where the working
819-
set is larger than RAM. By default, prefetching in recovery is enabled
820-
on operating systems that have <function>posix_fadvise</function>
821-
support.
819+
set is larger than RAM. By default, prefetching in recovery is disabled.
822820
</para>
823821
</sect1>
824822

src/backend/access/transam/xlogprefetch.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@
3131
* stall; this is counted with "skip_fpw".
3232
*
3333
* The only way we currently have to know that an I/O initiated with
34-
* PrefetchSharedBuffer() has that recovery will eventually call ReadBuffer(),
35-
* and perform a synchronous read. Therefore, we track the number of
34+
* PrefetchSharedBuffer() has completed is to wait for the corresponding call
35+
* to XLogReadBufferInRedo() to return. Therefore, we track the number of
3636
* potentially in-flight I/Os by using a circular buffer of LSNs. When it's
37-
* full, we have to wait for recovery to replay records so that the queue
38-
* depth can be reduced, before we can do any more prefetching. Ideally, this
39-
* keeps us the right distance ahead to respect maintenance_io_concurrency.
37+
* full, we have to wait for recovery to replay enough records to remove some
38+
* LSNs, and only then can we initiate more prefetching. Ideally, this keeps
39+
* us just the right distance ahead to respect maintenance_io_concurrency,
40+
* though in practice it errs on the side of being too conservative because
41+
* many I/Os complete sooner than we know.
4042
*
4143
*-------------------------------------------------------------------------
4244
*/

src/backend/utils/misc/guc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2774,7 +2774,7 @@ static struct config_int ConfigureNamesInt[] =
27742774
{
27752775
{"wal_decode_buffer_size", PGC_POSTMASTER, WAL_ARCHIVE_RECOVERY,
27762776
gettext_noop("Maximum buffer size for reading ahead in the WAL during recovery."),
2777-
gettext_noop("This controls the maximum distance we can read ahead n the WAL to prefetch referenced blocks."),
2777+
gettext_noop("This controls the maximum distance we can read ahead in the WAL to prefetch referenced blocks."),
27782778
GUC_UNIT_BYTE
27792779
},
27802780
&wal_decode_buffer_size,

0 commit comments

Comments
 (0)