Fix defects in PrepareForIncrementalBackup.

Swap the arguments to TimestampDifferenceMilliseconds so that we get
a positive answer instead of zero.

Then use the result of that computation instead of ignoring it.

Per reports from Alexander Lakhin.

Discussion: http://postgr.es/m/8b686764-7ac1-74c3-70f9-b64685a2535f@gmail.com
This commit is contained in:
Robert Haas 2024-01-03 09:59:46 -05:00
parent 8ce5aef2e6
commit dffde5bf16

View File

@ -436,12 +436,12 @@ PrepareForIncrementalBackup(IncrementalBackupInfo *ib,
* drifting to something that is not a multiple of ten.
*/
timeout_in_ms -=
TimestampDifferenceMilliseconds(current_time, initial_time) %
TimestampDifferenceMilliseconds(initial_time, current_time) %
timeout_in_ms;
/* Wait for up to 10 seconds. */
summarized_lsn = WaitForWalSummarization(backup_state->startpoint,
10000, &pending_lsn);
timeout_in_ms, &pending_lsn);
/* If WAL summarization has progressed sufficiently, stop waiting. */
if (summarized_lsn >= backup_state->startpoint)