- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitb5a9b18
committed
Provide API for streaming relation data.
Introduce an abstraction allowing relation data to be accessed as astream of buffers, with an implementation that is more efficient thanthe equivalent sequence of ReadBuffer() calls.Client code supplies a callback that can say which block number it wantsnext, and then consumes individual buffers one at a time from thestream. This division puts read_stream.c in control of how far ahead itcan see and allows it to read clusters of neighboring blocks withStartReadBuffers(). It also issues POSIX_FADV_WILLNEED advice ahead oftime when random access is detected.Other variants of I/O stream will be proposed in future work (forexample to support recovery, whose LsnReadQueue device inxlogprefetcher.c is a distant cousin of this code and should eventuallybe replaced by this), but this basic API is sufficient for many commonexecutor usage patterns involving predictable access to a single fork ofa single relation.Several patches using this API are proposed separately.This stream concept is loosely based on ideas from Andres Freund on howwe should pave the way for later work on asynchronous I/O.Author: Thomas Munro <thomas.munro@gmail.com>Author: Heikki Linnakangas <hlinnaka@iki.fi> (contributions)Author: Melanie Plageman <melanieplageman@gmail.com> (contributions)Suggested-by: Andres Freund <andres@anarazel.de>Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>Reviewed-by: Andres Freund <andres@anarazel.de>Tested-by: Tomas Vondra <tomas.vondra@enterprisedb.com>Discussion:https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com1 parent210622c commitb5a9b18
File tree
7 files changed
+898
-1
lines changed- src
- backend/storage
- aio
- include/storage
- tools/pgindent
7 files changed
+898
-1
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + |
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + |
0 commit comments
Comments
(0)