173 void *callback_private_data,
174 void *per_buffer_data)
245 if (!suppress_advice &&
257 &stream->
buffers[buffer_index],
289 overflow = (buffer_index + nblocks) - stream->
queue_size;
293 sizeof(stream->
buffers[0]) * overflow);
296 buffer_index += nblocks;
299 Assert(buffer_index >= 0 && buffer_index < stream->queue_size);
315 void *per_buffer_data;
320 suppress_advice =
false;
332 Assert(buffer_index >= 0 && buffer_index < stream->queue_size);
354 suppress_advice =
false;
402 void *callback_private_data,
403 size_t per_buffer_data_size)
409 int strategy_pin_limit;
410 uint32 max_pinned_buffers;
447 max_pinned_buffers =
Min(max_pinned_buffers,
452 max_pinned_buffers =
Min(strategy_pin_limit, max_pinned_buffers);
459 Assert(max_pinned_buffers > 0);
467 queue_size = max_pinned_buffers + 1;
480 size += per_buffer_data_size * queue_size;
481 size += MAXIMUM_ALIGNOF * 2;
483 memset(stream, 0, offsetof(
ReadStream, buffers));
486 if (per_buffer_data_size > 0)
535 for (
int i = 0;
i < max_ios; ++
i)
557 void *callback_private_data,
558 size_t per_buffer_data_size)
564 rel->
rd_rel->relpersistence,
567 callback_private_data,
568 per_buffer_data_size);
579 char smgr_persistence,
582 void *callback_private_data,
583 size_t per_buffer_data_size)
592 callback_private_data,
593 per_buffer_data_size);
609 int16 oldest_buffer_index;
611 #ifndef READ_STREAM_DISABLE_FAST_PATH
634 buffer = stream->
buffers[oldest_buffer_index];
649 &stream->
buffers[oldest_buffer_index],
705 Assert(oldest_buffer_index >= 0 &&
706 oldest_buffer_index < stream->queue_size);
707 buffer = stream->
buffers[oldest_buffer_index];
722 &stream->
buffers[oldest_buffer_index]);
755 #ifdef CLOBBER_FREED_MEMORY
767 oldest_buffer_index == 0 ?
769 oldest_buffer_index - 1),
785 #ifndef READ_STREAM_DISABLE_FAST_PATH
#define InvalidBlockNumber
bool StartReadBuffers(ReadBuffersOperation *operation, Buffer *buffers, BlockNumber blockNum, int *nblocks, int flags)
void ReleaseBuffer(Buffer buffer)
void WaitReadBuffers(ReadBuffersOperation *operation)
void LimitAdditionalPins(uint32 *additional_pins)
int effective_io_concurrency
bool StartReadBuffer(ReadBuffersOperation *operation, Buffer *buffer, BlockNumber blocknum, int flags)
#define READ_BUFFERS_ISSUE_ADVICE
static bool BufferIsValid(Buffer bufnum)
#define Assert(condition)
#define FLEXIBLE_ARRAY_MEMBER
#define OidIsValid(objectId)
bool IsCatalogRelation(Relation relation)
bool IsCatalogRelationOid(Oid relid)
int GetAccessStrategyPinLimit(BufferAccessStrategy strategy)
if(TABLE==NULL||TABLE_index==NULL)
void LimitAdditionalLocalPins(uint32 *additional_pins)
void pfree(void *pointer)
static void * get_per_buffer_data(ReadStream *stream, int16 buffer_index)
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)
static void read_stream_look_ahead(ReadStream *stream, bool suppress_advice)
BlockNumber read_stream_next_block(ReadStream *stream, BufferAccessStrategy *strategy)
void read_stream_reset(ReadStream *stream)
Buffer read_stream_next_buffer(ReadStream *stream, void **per_buffer_data)
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)
struct InProgressIO InProgressIO
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)
void read_stream_end(ReadStream *stream)
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)
#define READ_STREAM_MAINTENANCE
BlockNumber(* ReadStreamBlockNumberCB)(ReadStream *stream, void *callback_private_data, void *per_buffer_data)
#define READ_STREAM_SEQUENTIAL
static SMgrRelation RelationGetSmgr(Relation rel)
static pg_noinline void Size size
int get_tablespace_io_concurrency(Oid spcid)
int get_tablespace_maintenance_io_concurrency(Oid spcid)
BlockNumber last_exclusive
BlockNumber current_blocknum
BufferAccessStrategy strategy
struct SMgrRelationData * smgr
int16 oldest_buffer_index
BlockNumber pending_read_blocknum
BlockNumber buffered_blocknum
size_t per_buffer_data_size
ReadStreamBlockNumberCB callback
int16 pending_read_nblocks
void * callback_private_data
Buffer buffers[FLEXIBLE_ARRAY_MEMBER]
RelFileLocatorBackend smgr_rlocator
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)