Thread: Question about read_stream_look_ahead()

Question about read_stream_look_ahead()

From
Dilip Kumar
Date:
Hi,

I was looking into this function, especially this block of code[1], so
what I have noticed is that we always try to combine the sequential
block when the lookahead blocknum is higher than the
pending_read_blocknum, that's fine for ForwardScan.  My question is
should we do something for backward scanning as well?  I mean if we
haven't yet started the I/O then shouldn't we try to merge blocknum
which are smaller than pending_read_blocknum  which would be the
normal case in backward scan.  I mean we would need to change the
start block number in this case though.


[1]
/* Can we merge it with the pending read? */
if (stream->pending_read_nblocks > 0 &&
stream->pending_read_blocknum + stream->pending_read_nblocks == blocknum)
{
stream->pending_read_nblocks++;
continue;
}

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com