diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index 29d0c9a6e45..3df1828e755 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -4546,8 +4546,8 @@ wait_for_publisher_status(RetainDeadTuplesData *rdt_data, return; /* - * Stop retaining conflict information if required (See - * should_stop_conflict_info_retention() for details). + * We don't need to maintain oldest_nonremovable_xid if we decide + * to stop retaining conflict information for this worker. */ if (should_stop_conflict_info_retention(rdt_data)) return; @@ -4650,8 +4650,8 @@ wait_for_local_flush(RetainDeadTuplesData *rdt_data) } /* - * Stop retaining conflict information if required (See - * should_stop_conflict_info_retention() for details). + * We don't need to maintain oldest_nonremovable_xid if we decide + * to stop retaining conflict information for this worker. */ if (should_stop_conflict_info_retention(rdt_data)) return; @@ -4771,16 +4771,16 @@ reset_retention_data_fields(RetainDeadTuplesData *rdt_data) } /* - * Check whether conflict information retention should be stopped because the - * wait time has exceeded the maximum limit (max_conflict_retention_duration). + * Check whether conflict information retention should be stopped due to + * exceeding the maximum wait time (max_conflict_retention_duration). * - * If retention should be stopped, proceed to the + * If retention should be stopped, transition to the * RDT_STOP_CONFLICT_INFO_RETENTION phase and return true. Otherwise, return * false. * - * Currently, the retention will not resume automatically unless user manually - * disables retain_dead_tuples and re-enables it after confirming that the - * replication slot has been dropped. + * Note: Retention won't be resumed automatically. The user must manually + * disable retain_dead_tuples and re-enable it after confirming that the + * replication slot maintained by the launcher has been dropped. */ static bool should_stop_conflict_info_retention(RetainDeadTuplesData *rdt_data) @@ -4802,9 +4802,10 @@ should_stop_conflict_info_retention(RetainDeadTuplesData *rdt_data) now = rdt_data->last_recv_time ? rdt_data->last_recv_time : GetCurrentTimestamp(); /* - * Return if the wait time has not exceeded the maximum limit - * (max_conflict_retention_duration). The time spent waiting for table - * synchronization is not counted, as it's an infrequent operation. + * Return early if the wait time has not exceeded the configured maximum + * (max_conflict_retention_duration). Time spent waiting for table + * synchronization is excluded from this calculation, as it occurs + * infrequently. */ if (!TimestampDifferenceExceeds(rdt_data->candidate_xid_time, now, MySubscription->maxconflretention + diff --git a/src/include/replication/worker_internal.h b/src/include/replication/worker_internal.h index b86c759394f..62ea1a00580 100644 --- a/src/include/replication/worker_internal.h +++ b/src/include/replication/worker_internal.h @@ -95,8 +95,8 @@ typedef struct LogicalRepWorker * named "pg_conflict_detection". It asynchronously collects this ID to * decide when to advance the xmin value of the slot. * - * This ID would be set to InvalidTransactionId if the apply worker has - * stopped retaining information useful for conflict detection. + * This ID is set to InvalidTransactionId when the apply worker stops + * retaining information needed for conflict detection. */ TransactionId oldest_nonremovable_xid;