On Mon, Mar 31, 2025 at 12:27 PM Nazir Bilal Yavuz <byavu...@gmail.com> wrote: > > I worked on an alternative approach, I refactored code a bit. It does > not traverse the list two times and I think the code is more suitable > to use read streams now. I simply get how many blocks are processed by > read streams and move the list forward by this number, so the actual > loop skips these blocks. This approach is attached with 'alternative' > prefix.
I am leaning toward the refactored approach because I don't think we want to go through the array twice and I think it is hard to get it right with incrementing p.pos in both places and being sure we correctly close the relation etc. Looking at your alternative approach, I don't see how the innermost while loop in autoprewarm_database_main() is correct /* Check whether blocknum is valid and within fork file size. */ while (cur_filenumber == blk->filenumber && blk->blocknum >= nblocks_in_fork) { /* Move to next forknum. */ pos++; continue; } Won't this just infinitely loop? - Melanie