- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit70d38e3
committed
Allow ReadStream to be consumed as raw block numbers.
Commits041b968 and6377e12 changed the interface ofscan_analyze_next_block() to take a ReadStream instead of a BlockNumberand a BufferAccessStrategy, and to return a value to indicate when thestream has run out of blocks.This caused integration problems for at least one known extension thatuses specially encoded BlockNumber values that map to differentunderlying storage, because acquire_sample_rows() sets up the stream sothat read_stream_next_buffer() reads blocks from the main fork of therelation's SMgrRelation.Provide read_stream_next_block(), as a way for such an extension toaccess the stream of raw BlockNumbers directly and forward them to itsown ReadBuffer() calls after decoding, as it could in earlier releases.The new function returns the BlockNumber and BufferAccessStrategy thatwere previously passed directly to scan_analyze_next_block().Alternatively, an extension could wrap the stream of BlockNumbers inanother ReadStream with a callback that performs any decoding requiredto arrive at real storage manager BlockNumber values, so that it couldbenefit from the I/O combining and concurrency provided byread_stream.c.Another class of table access method that does nothing inscan_analyze_next_block() because it is not block-oriented could usethis function to control the number of block sampling loops. It couldmatch the previous behavior with "return read_stream_next_block(stream,&bas) != InvalidBlockNumber".Ongoing work is expected to provide better ANALYZE support for tableaccess methods that don't behave like heapam with respect to storageblocks, but that will be for future releases.Back-patch to 17.Reported-by: Mats Kindahl <mats@timescale.com>Reviewed-by: Mats Kindahl <mats@timescale.com>Discussion:https://postgr.es/m/CA%2B14425%2BCcm07ocG97Fp%2BFrD9xUXqmBKFvecp0p%2BgV2YYR258Q%40mail.gmail.com1 parent918e21d commit70d38e3
File tree
2 files changed
+16
-0
lines changed- src
- backend/storage/aio
- include/storage
2 files changed
+16
-0
lines changedLines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
797 | 797 |
| |
798 | 798 |
| |
799 | 799 |
| |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
800 | 814 |
| |
801 | 815 |
| |
802 | 816 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
| 71 | + | |
| 72 | + | |
71 | 73 |
| |
72 | 74 |
| |
73 | 75 |
| |
|
0 commit comments
Comments
(0)