Disallow negative values for max_retention_duration. The subscription option max_retention_duration accepts an integer value representing a timeout in milliseconds, where zero means unlimited retention (no timeout). Negative values have no useful meaning, but were silently accepted and stored in the subscription catalog.
A negative value causes should_stop_conflict_info_retention() to always return true, because TimestampDifferenceExceeds() treats a negative threshold as already exceeded. This stops dead tuple retention immediately rather than honoring the configured timeout. Fix by rejecting negative values for max_retention_duration during CREATE SUBSCRIPTION and ALTER SUBSCRIPTION. Author: Chao Li <[email protected]> Reviewed-by: Hayato Kuroda <[email protected]> Reviewed-by: Amit Kapila <[email protected]> Discussion: https://postgr.es/m/[email protected] Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/987440b33a511482232c59a190cc16ae4feff9aa Modified Files -------------- src/backend/commands/subscriptioncmds.c | 5 +++++ src/test/regress/expected/subscription.out | 6 ++++++ src/test/regress/sql/subscription.sql | 6 ++++++ 3 files changed, 17 insertions(+)
