[PATCH] Account for failed recovery prefetch advice
Hi,
While looking at recovery prefetch failure handling, I noticed that
mdprefetch() discards the errno-style result returned by
FilePrefetch(). As a result, an operating-system read-ahead advice
failure is counted as a successful recovery prefetch and treated as
in-flight prefetch I/O, even though no read-ahead request was issued.
The attached patch propagates the advice result through smgr and the
buffer manager. It preserves smgrprefetch()'s existing boolean result,
which is used during recovery to report a missing relation segment,
and adds an optional error result for the read-ahead operation.
When advice fails, xlogprefetcher now increments a new prefetch_failed
statistic, does not increment the successful prefetch count, and
returns LRQ_NEXT_NO_IO. Consequently, the failed request does not
consume logical I/O depth, and recovery reads the block normally when
redo reaches it. The failure remains nonfatal because prefetch advice
is best-effort.
The patch also adds an injection point and a recovery TAP test that
verifies failure accounting, successful replay after advice failures,
and statistics reset.
Feedback is welcome, particularly on the optional error-result API.
Best Regards,
Nitin Jadhav
Microsoft