PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "miscadmin.h"
#include "storage/fd.h"
#include "storage/smgr.h"
#include "storage/read_stream.h"
#include "utils/memdebug.h"
#include "utils/rel.h"
#include "utils/spccache.h"
Go to the source code of this file.
Data Structures | |
struct | InProgressIO |
struct | ReadStream |
Typedefs | |
typedef struct InProgressIO | InProgressIO |
Functions | |
static void * | get_per_buffer_data (ReadStream *stream, int16 buffer_index) |
BlockNumber | block_range_read_stream_cb (ReadStream *stream, void *callback_private_data, void *per_buffer_data) |
static BlockNumber | read_stream_get_block (ReadStream *stream, void *per_buffer_data) |
static void | read_stream_unget_block (ReadStream *stream, BlockNumber blocknum) |
static void | read_stream_start_pending_read (ReadStream *stream, bool suppress_advice) |
static void | read_stream_look_ahead (ReadStream *stream, bool suppress_advice) |
static ReadStream * | read_stream_begin_impl (int flags, BufferAccessStrategy strategy, Relation rel, SMgrRelation smgr, char persistence, ForkNumber forknum, ReadStreamBlockNumberCB callback, void *callback_private_data, size_t per_buffer_data_size) |
ReadStream * | read_stream_begin_relation (int flags, BufferAccessStrategy strategy, Relation rel, ForkNumber forknum, ReadStreamBlockNumberCB callback, void *callback_private_data, size_t per_buffer_data_size) |
ReadStream * | read_stream_begin_smgr_relation (int flags, BufferAccessStrategy strategy, SMgrRelation smgr, char smgr_persistence, ForkNumber forknum, ReadStreamBlockNumberCB callback, void *callback_private_data, size_t per_buffer_data_size) |
Buffer | read_stream_next_buffer (ReadStream *stream, void **per_buffer_data) |
BlockNumber | read_stream_next_block (ReadStream *stream, BufferAccessStrategy *strategy) |
void | read_stream_reset (ReadStream *stream) |
void | read_stream_end (ReadStream *stream) |
typedef struct InProgressIO InProgressIO |
BlockNumber block_range_read_stream_cb | ( | ReadStream * | stream, |
void * | callback_private_data, | ||
void * | per_buffer_data | ||
) |
Definition at line 171 of file read_stream.c.
References BlockRangeReadStreamPrivate::current_blocknum, InvalidBlockNumber, and BlockRangeReadStreamPrivate::last_exclusive.
Referenced by collect_visibility_data(), pg_prewarm(), and RelationCopyStorageUsingBuffer().
|
inlinestatic |
Definition at line 160 of file read_stream.c.
References ReadStream::per_buffer_data, and ReadStream::per_buffer_data_size.
Referenced by read_stream_look_ahead(), and read_stream_next_buffer().
|
static |
Definition at line 394 of file read_stream.c.
References ReadStream::advice_enabled, Assert, ReadStream::buffered_blocknum, ReadStream::buffers, ReadStream::callback, callback(), ReadStream::callback_private_data, ReadStream::distance, effective_io_concurrency, ReadBuffersOperation::forknum, get_tablespace_io_concurrency(), get_tablespace_maintenance_io_concurrency(), GetAccessStrategyPinLimit(), i, InvalidBlockNumber, io_combine_limit, IO_DIRECT_DATA, io_direct_flags, ReadStream::ios, IsCatalogRelation(), IsCatalogRelationOid(), LimitAdditionalLocalPins(), LimitAdditionalPins(), RelFileLocatorBackend::locator, Max, ReadStream::max_ios, ReadStream::max_pinned_buffers, MAXALIGN, Min, MyDatabaseId, OidIsValid, InProgressIO::op, palloc(), ReadStream::per_buffer_data, ReadStream::per_buffer_data_size, ReadBuffersOperation::persistence, PG_INT16_MAX, ReadStream::queue_size, READ_STREAM_FULL, READ_STREAM_MAINTENANCE, READ_STREAM_SEQUENTIAL, ReadBuffersOperation::rel, RelFileLocator::relNumber, size, ReadBuffersOperation::smgr, SMgrRelationData::smgr_rlocator, SmgrIsTemp, RelFileLocator::spcOid, and ReadBuffersOperation::strategy.
Referenced by read_stream_begin_relation(), and read_stream_begin_smgr_relation().
ReadStream* read_stream_begin_relation | ( | int | flags, |
BufferAccessStrategy | strategy, | ||
Relation | rel, | ||
ForkNumber | forknum, | ||
ReadStreamBlockNumberCB | callback, | ||
void * | callback_private_data, | ||
size_t | per_buffer_data_size | ||
) |
Definition at line 551 of file read_stream.c.
References callback(), RelationData::rd_rel, read_stream_begin_impl(), and RelationGetSmgr().
Referenced by acquire_sample_rows(), collect_corrupt_items(), collect_visibility_data(), heap_beginscan(), and pg_prewarm().
ReadStream* read_stream_begin_smgr_relation | ( | int | flags, |
BufferAccessStrategy | strategy, | ||
SMgrRelation | smgr, | ||
char | smgr_persistence, | ||
ForkNumber | forknum, | ||
ReadStreamBlockNumberCB | callback, | ||
void * | callback_private_data, | ||
size_t | per_buffer_data_size | ||
) |
Definition at line 575 of file read_stream.c.
References callback(), and read_stream_begin_impl().
Referenced by RelationCopyStorageUsingBuffer().
void read_stream_end | ( | ReadStream * | stream | ) |
Definition at line 846 of file read_stream.c.
References pfree(), and read_stream_reset().
Referenced by acquire_sample_rows(), collect_corrupt_items(), collect_visibility_data(), heap_endscan(), pg_prewarm(), and RelationCopyStorageUsingBuffer().
|
inlinestatic |
Definition at line 188 of file read_stream.c.
References ReadStream::buffered_blocknum, ReadStream::callback, ReadStream::callback_private_data, and InvalidBlockNumber.
Referenced by read_stream_look_ahead(), read_stream_next_block(), and read_stream_next_buffer().
|
static |
Definition at line 307 of file read_stream.c.
References Assert, ReadStream::distance, get_per_buffer_data(), InvalidBlockNumber, io_combine_limit, ReadStream::ios_in_progress, ReadStream::max_ios, ReadStream::next_buffer_index, ReadStream::pending_read_blocknum, ReadStream::pending_read_nblocks, ReadStream::pinned_buffers, ReadStream::queue_size, read_stream_get_block(), read_stream_start_pending_read(), and read_stream_unget_block().
Referenced by read_stream_next_buffer().
BlockNumber read_stream_next_block | ( | ReadStream * | stream, |
BufferAccessStrategy * | strategy | ||
) |
Definition at line 807 of file read_stream.c.
References ReadStream::ios, InProgressIO::op, read_stream_get_block(), and ReadBuffersOperation::strategy.
Buffer read_stream_next_buffer | ( | ReadStream * | stream, |
void ** | per_buffer_data | ||
) |
Definition at line 605 of file read_stream.c.
References ReadStream::advice_enabled, Assert, InProgressIO::buffer_index, BufferIsValid(), ReadStream::buffers, ReadBuffersOperation::buffers, ReadStream::distance, ReadStream::fast_path, ReadBuffersOperation::flags, get_per_buffer_data(), InvalidBlockNumber, InvalidBuffer, io_combine_limit, ReadStream::ios, ReadStream::ios_in_progress, likely, ReadStream::max_ios, ReadStream::max_pinned_buffers, Min, ReadStream::next_buffer_index, ReadStream::next_io_index, ReadStream::oldest_buffer_index, ReadStream::oldest_io_index, InProgressIO::op, ReadStream::pending_read_nblocks, ReadStream::per_buffer_data, ReadStream::per_buffer_data_size, ReadStream::pinned_buffers, ReadStream::queue_size, READ_BUFFERS_ISSUE_ADVICE, read_stream_get_block(), read_stream_look_ahead(), ReadStream::seq_blocknum, StartReadBuffer(), unlikely, and WaitReadBuffers().
Referenced by collect_corrupt_items(), collect_visibility_data(), heap_fetch_next_buffer(), heapam_scan_analyze_next_block(), pg_prewarm(), read_stream_reset(), and RelationCopyStorageUsingBuffer().
void read_stream_reset | ( | ReadStream * | stream | ) |
Definition at line 820 of file read_stream.c.
References Assert, ReadStream::buffered_blocknum, ReadStream::distance, ReadStream::fast_path, InvalidBlockNumber, InvalidBuffer, ReadStream::ios_in_progress, ReadStream::pinned_buffers, read_stream_next_buffer(), and ReleaseBuffer().
Referenced by heap_fetch_next_buffer(), heap_rescan(), and read_stream_end().
|
static |
Definition at line 217 of file read_stream.c.
References ReadStream::advice_enabled, Assert, InProgressIO::buffer_index, ReadStream::buffers, ReadStream::distance, if(), io_combine_limit, ReadStream::ios, ReadStream::ios_in_progress, ReadStream::max_ios, ReadStream::max_pinned_buffers, ReadStream::next_buffer_index, ReadStream::next_io_index, ReadStream::oldest_buffer_index, InProgressIO::op, ReadStream::pending_read_blocknum, ReadStream::pending_read_nblocks, ReadStream::pinned_buffers, ReadStream::queue_size, READ_BUFFERS_ISSUE_ADVICE, ReadStream::seq_blocknum, and StartReadBuffers().
Referenced by read_stream_look_ahead().
|
inlinestatic |
Definition at line 208 of file read_stream.c.
References Assert, ReadStream::buffered_blocknum, and InvalidBlockNumber.
Referenced by read_stream_look_ahead().