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

Function ltsReadBlock

src/backend/utils/sort/logtape.c:288–304  ·  view source on GitHub ↗

* Read a block-sized buffer from the specified block of the underlying file. * * No need for an error return convention; we ereport() on any error. This * module should never attempt to read a block it doesn't know is there. */

Source from the content-addressed store, hash-verified

286 * module should never attempt to read a block it doesn't know is there.
287 */
288static void
289ltsReadBlock(LogicalTapeSet *lts, long blocknum, void *buffer)
290{
291 size_t nread;
292
293 if (BufFileSeekBlock(lts->pfile, blocknum) != 0)
294 ereport(ERROR,
295 (errcode_for_file_access(),
296 errmsg("could not seek to block %ld of temporary file",
297 blocknum)));
298 nread = BufFileRead(lts->pfile, buffer, BLCKSZ);
299 if (nread != BLCKSZ)
300 ereport(ERROR,
301 (errcode_for_file_access(),
302 errmsg("could not read block %ld of temporary file: read only %zu of %zu bytes",
303 blocknum, nread, (size_t) BLCKSZ)));
304}
305
306/*
307 * Read as many blocks as we can into the per-tape buffer.

Callers 4

ltsReadFillBufferFunction · 0.85
LogicalTapeFreezeFunction · 0.85
LogicalTapeBackspaceFunction · 0.85
LogicalTapeSeekFunction · 0.85

Calls 4

BufFileSeekBlockFunction · 0.85
BufFileReadFunction · 0.85
errcode_for_file_accessFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected