@ -422,23 +422,10 @@ sts_read_tuple(SharedTuplestoreAccessor *accessor, void *meta_data)
*/
if ( accessor - > sts - > meta_data_size > 0 )
{
if ( BufFileRead ( accessor - > read_file ,
meta_data ,
accessor - > sts - > meta_data_size ) ! =
accessor - > sts - > meta_data_size )
ereport ( ERROR ,
( errcode_for_file_access ( ) ,
errmsg ( " could not read from shared tuplestore temporary file " ) ,
errdetail_internal ( " Short read while reading meta-data. " ) ) ) ;
BufFileReadExact ( accessor - > read_file , meta_data , accessor - > sts - > meta_data_size ) ;
accessor - > read_bytes + = accessor - > sts - > meta_data_size ;
}
if ( BufFileRead ( accessor - > read_file ,
& size ,
sizeof ( size ) ) ! = sizeof ( size ) )
ereport ( ERROR ,
( errcode_for_file_access ( ) ,
errmsg ( " could not read from shared tuplestore temporary file " ) ,
errdetail_internal ( " Short read while reading size. " ) ) ) ;
BufFileReadExact ( accessor - > read_file , & size , sizeof ( size ) ) ;
accessor - > read_bytes + = sizeof ( size ) ;
if ( size > accessor - > read_buffer_size )
{
@ -455,13 +442,7 @@ sts_read_tuple(SharedTuplestoreAccessor *accessor, void *meta_data)
this_chunk_size = Min ( remaining_size ,
BLCKSZ * STS_CHUNK_PAGES - accessor - > read_bytes ) ;
destination = accessor - > read_buffer + sizeof ( uint32 ) ;
if ( BufFileRead ( accessor - > read_file ,
destination ,
this_chunk_size ) ! = this_chunk_size )
ereport ( ERROR ,
( errcode_for_file_access ( ) ,
errmsg ( " could not read from shared tuplestore temporary file " ) ,
errdetail_internal ( " Short read while reading tuple. " ) ) ) ;
BufFileReadExact ( accessor - > read_file , destination , this_chunk_size ) ;
accessor - > read_bytes + = this_chunk_size ;
remaining_size - = this_chunk_size ;
destination + = this_chunk_size ;
@ -473,12 +454,7 @@ sts_read_tuple(SharedTuplestoreAccessor *accessor, void *meta_data)
/* We are now positioned at the start of an overflow chunk. */
SharedTuplestoreChunk chunk_header ;
if ( BufFileRead ( accessor - > read_file , & chunk_header , STS_CHUNK_HEADER_SIZE ) ! =
STS_CHUNK_HEADER_SIZE )
ereport ( ERROR ,
( errcode_for_file_access ( ) ,
errmsg ( " could not read from shared tuplestore temporary file " ) ,
errdetail_internal ( " Short read while reading overflow chunk header. " ) ) ) ;
BufFileReadExact ( accessor - > read_file , & chunk_header , STS_CHUNK_HEADER_SIZE ) ;
accessor - > read_bytes = STS_CHUNK_HEADER_SIZE ;
if ( chunk_header . overflow = = 0 )
ereport ( ERROR ,
@ -489,13 +465,7 @@ sts_read_tuple(SharedTuplestoreAccessor *accessor, void *meta_data)
this_chunk_size = Min ( remaining_size ,
BLCKSZ * STS_CHUNK_PAGES -
STS_CHUNK_HEADER_SIZE ) ;
if ( BufFileRead ( accessor - > read_file ,
destination ,
this_chunk_size ) ! = this_chunk_size )
ereport ( ERROR ,
( errcode_for_file_access ( ) ,
errmsg ( " could not read from shared tuplestore temporary file " ) ,
errdetail_internal ( " Short read while reading tuple. " ) ) ) ;
BufFileReadExact ( accessor - > read_file , destination , this_chunk_size ) ;
accessor - > read_bytes + = this_chunk_size ;
remaining_size - = this_chunk_size ;
destination + = this_chunk_size ;
@ -551,7 +521,6 @@ sts_parallel_scan_next(SharedTuplestoreAccessor *accessor, void *meta_data)
if ( ! eof )
{
SharedTuplestoreChunk chunk_header ;
size_t nread ;
/* Make sure we have the file open. */
if ( accessor - > read_file = = NULL )
@ -570,13 +539,7 @@ sts_parallel_scan_next(SharedTuplestoreAccessor *accessor, void *meta_data)
( errcode_for_file_access ( ) ,
errmsg ( " could not seek to block %u in shared tuplestore temporary file " ,
read_page ) ) ) ;
nread = BufFileRead ( accessor - > read_file , & chunk_header ,
STS_CHUNK_HEADER_SIZE ) ;
if ( nread ! = STS_CHUNK_HEADER_SIZE )
ereport ( ERROR ,
( errcode_for_file_access ( ) ,
errmsg ( " could not read from shared tuplestore temporary file: read only %zu of %zu bytes " ,
nread , STS_CHUNK_HEADER_SIZE ) ) ) ;
BufFileReadExact ( accessor - > read_file , & chunk_header , STS_CHUNK_HEADER_SIZE ) ;
/*
* If this is an overflow chunk , we skip it and any following