@@ -422,23 +422,10 @@ sts_read_tuple(SharedTuplestoreAccessor *accessor, void *meta_data)
422
422
*/
423
423
if (accessor -> sts -> meta_data_size > 0 )
424
424
{
425
- if (BufFileRead (accessor -> read_file ,
426
- meta_data ,
427
- accessor -> sts -> meta_data_size ) !=
428
- accessor -> sts -> meta_data_size )
429
- ereport (ERROR ,
430
- (errcode_for_file_access (),
431
- errmsg ("could not read from shared tuplestore temporary file" ),
432
- errdetail_internal ("Short read while reading meta-data." )));
425
+ BufFileReadExact (accessor -> read_file , meta_data , accessor -> sts -> meta_data_size );
433
426
accessor -> read_bytes += accessor -> sts -> meta_data_size ;
434
427
}
435
- if (BufFileRead (accessor -> read_file ,
436
- & size ,
437
- sizeof (size )) != sizeof (size ))
438
- ereport (ERROR ,
439
- (errcode_for_file_access (),
440
- errmsg ("could not read from shared tuplestore temporary file" ),
441
- errdetail_internal ("Short read while reading size." )));
428
+ BufFileReadExact (accessor -> read_file , & size , sizeof (size ));
442
429
accessor -> read_bytes += sizeof (size );
443
430
if (size > accessor -> read_buffer_size )
444
431
{
@@ -455,13 +442,7 @@ sts_read_tuple(SharedTuplestoreAccessor *accessor, void *meta_data)
455
442
this_chunk_size = Min (remaining_size ,
456
443
BLCKSZ * STS_CHUNK_PAGES - accessor -> read_bytes );
457
444
destination = accessor -> read_buffer + sizeof (uint32 );
458
- if (BufFileRead (accessor -> read_file ,
459
- destination ,
460
- this_chunk_size ) != this_chunk_size )
461
- ereport (ERROR ,
462
- (errcode_for_file_access (),
463
- errmsg ("could not read from shared tuplestore temporary file" ),
464
- errdetail_internal ("Short read while reading tuple." )));
445
+ BufFileReadExact (accessor -> read_file , destination , this_chunk_size );
465
446
accessor -> read_bytes += this_chunk_size ;
466
447
remaining_size -= this_chunk_size ;
467
448
destination += this_chunk_size ;
@@ -473,12 +454,7 @@ sts_read_tuple(SharedTuplestoreAccessor *accessor, void *meta_data)
473
454
/* We are now positioned at the start of an overflow chunk. */
474
455
SharedTuplestoreChunk chunk_header ;
475
456
476
- if (BufFileRead (accessor -> read_file , & chunk_header , STS_CHUNK_HEADER_SIZE ) !=
477
- STS_CHUNK_HEADER_SIZE )
478
- ereport (ERROR ,
479
- (errcode_for_file_access (),
480
- errmsg ("could not read from shared tuplestore temporary file" ),
481
- errdetail_internal ("Short read while reading overflow chunk header." )));
457
+ BufFileReadExact (accessor -> read_file , & chunk_header , STS_CHUNK_HEADER_SIZE );
482
458
accessor -> read_bytes = STS_CHUNK_HEADER_SIZE ;
483
459
if (chunk_header .overflow == 0 )
484
460
ereport (ERROR ,
@@ -489,13 +465,7 @@ sts_read_tuple(SharedTuplestoreAccessor *accessor, void *meta_data)
489
465
this_chunk_size = Min (remaining_size ,
490
466
BLCKSZ * STS_CHUNK_PAGES -
491
467
STS_CHUNK_HEADER_SIZE );
492
- if (BufFileRead (accessor -> read_file ,
493
- destination ,
494
- this_chunk_size ) != this_chunk_size )
495
- ereport (ERROR ,
496
- (errcode_for_file_access (),
497
- errmsg ("could not read from shared tuplestore temporary file" ),
498
- errdetail_internal ("Short read while reading tuple." )));
468
+ BufFileReadExact (accessor -> read_file , destination , this_chunk_size );
499
469
accessor -> read_bytes += this_chunk_size ;
500
470
remaining_size -= this_chunk_size ;
501
471
destination += this_chunk_size ;
@@ -551,7 +521,6 @@ sts_parallel_scan_next(SharedTuplestoreAccessor *accessor, void *meta_data)
551
521
if (!eof )
552
522
{
553
523
SharedTuplestoreChunk chunk_header ;
554
- size_t nread ;
555
524
556
525
/* Make sure we have the file open. */
557
526
if (accessor -> read_file == NULL )
@@ -570,13 +539,7 @@ sts_parallel_scan_next(SharedTuplestoreAccessor *accessor, void *meta_data)
570
539
(errcode_for_file_access (),
571
540
errmsg ("could not seek to block %u in shared tuplestore temporary file" ,
572
541
read_page )));
573
- nread = BufFileRead (accessor -> read_file , & chunk_header ,
574
- STS_CHUNK_HEADER_SIZE );
575
- if (nread != STS_CHUNK_HEADER_SIZE )
576
- ereport (ERROR ,
577
- (errcode_for_file_access (),
578
- errmsg ("could not read from shared tuplestore temporary file: read only %zu of %zu bytes" ,
579
- nread , STS_CHUNK_HEADER_SIZE )));
542
+ BufFileReadExact (accessor -> read_file , & chunk_header , STS_CHUNK_HEADER_SIZE );
580
543
581
544
/*
582
545
* If this is an overflow chunk, we skip it and any following
0 commit comments