MCPcopy Create free account
hub / github.com/apache/cloudberry / ReadBufferExtended

Function ReadBufferExtended

src/backend/storage/buffer/bufmgr.c:827–857  ·  view source on GitHub ↗

* ReadBufferExtended -- returns a buffer containing the requested * block of the requested relation. If the blknum * requested is P_NEW, extend the relation file and * allocate a new block. (Caller is responsible for * ensuring that only one backend tries to extend a * relation at the same time!) * * Returns: the buffer number for the buffer containing * the block read. The return

Source from the content-addressed store, hash-verified

825 * See buffer/README for details.
826 */
827Buffer
828ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum,
829 ReadBufferMode mode, BufferAccessStrategy strategy)
830{
831 bool hit;
832 Buffer buf;
833
834 /* Open it at the smgr level if not already done */
835 RelationOpenSmgr(reln);
836
837 /*
838 * Reject attempts to read non-local temporary relations; we would be
839 * likely to get wrong data since we have no visibility into the owning
840 * session's local buffers.
841 */
842 if (RelationUsesLocalBuffers(reln) && RELATION_IS_OTHER_TEMP(reln))
843 ereport(ERROR,
844 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
845 errmsg("cannot access temporary tables of other sessions")));
846
847 /*
848 * Read the buffer, and update pgstat counters to reflect a cache hit or
849 * miss.
850 */
851 pgstat_count_buffer_read(reln);
852 buf = ReadBuffer_common(reln->rd_smgr, reln->rd_rel->relpersistence,
853 forkNum, blockNum, mode, strategy, &hit);
854 if (hit)
855 pgstat_count_buffer_hit(reln);
856 return buf;
857}
858
859
860/*

Callers 15

collect_visibility_dataFunction · 0.85
collect_corrupt_itemsFunction · 0.85
verify_heapamFunction · 0.85
bt_recheck_sibling_linksFunction · 0.85
palloc_btree_pageFunction · 0.85
get_raw_page_internalFunction · 0.85
pgstat_heapFunction · 0.85
pgstat_btree_pageFunction · 0.85
pgstat_gist_pageFunction · 0.85
pgstatindex_implFunction · 0.85
pgstathashindexFunction · 0.85
statapprox_heapFunction · 0.85

Calls 3

ReadBuffer_commonFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected