recoveryStopsAfter is not usable when recovery_target_inclusive is false - Mailing list pgsql-hackers

From Hayato Kuroda (Fujitsu)
Subject recoveryStopsAfter is not usable when recovery_target_inclusive is false
Date
Msg-id OSCPR01MB14966AAAEF5C5D67C4DBDCB2CF55FA@OSCPR01MB14966.jpnprd01.prod.outlook.com
Whole thread Raw
Responses Re: recoveryStopsAfter is not usable when recovery_target_inclusive is false
List pgsql-hackers
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


Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Question on any plans to use the User Server/User Mapping to provide Logical Replication Subscriptions the user/password in an encrypted manner
Next
From: TAKATSUKA Haruka
Date:
Subject: Re: [Buildfarm:84] Re: stats.sql might fail due to shared buffers also used by parallel tests