Hi hackers,
While working on [1] I found the point. When recovery_target_lsn is specified and
recovery_target_inclusive is false, recoveryStopsAfter() cannot return true.
```
/* Check if the target LSN has been reached */
if (recoveryTarget == RECOVERY_TARGET_LSN &&
recoveryTargetInclusive &&
record->ReadRecPtr >= recoveryTargetLSN)
```
In this case the recovery can stop when next record is read. This normally works
well but if the next record has not been generated yet, startup process will wait
till new one will come then exit from the apply loop.
I feel the process can exit bit earliyer, by comparing with the end point of the
applied record and recovery_target_lsn.
Attached patch roughly implemented the idea.
I read the old discussions, but I cannot find the reason of current style.
Do you have any thoughts for it?
[1]: https://www.postgresql.org/message-id/flat/18897-d3db67535860dddb%40postgresql.org
Best regards,
Hayato Kuroda
FUJITSU LIMITED