- The downstream changefeed sink is unavailable. Protected timestamps will protect changes until you either cancel the changefeed or the sink becomes available once again.
- ( deprecated ) You pause a changefeed with the
protect_data_from_gc_on_pauseoption enabled. Or, a changefeed withprotect_data_from_gc_on_pausepauses from a retryable error. Protected timestamps will protect changes until you resume the changefeed.
Prevent garbage accumulation
To prevent an accumulation of protected changes that could impact performance, consider defining an expiration duration:changefeed.protect_timestamp.max_age: a cluster setting to define a protected timestamp expiration for all changefeeds on a cluster.gc_protect_expires_after: a changefeed option to define a protected timestamp expiration for a changefeed.
changefeed.protect_timestamp.max_age or gc_protect_expires_after should reflect how much time the changefeed may remain paused before it is canceled.
changefeed.protect_timestamp.max_age
New in v23.2: By default, the changefeed.protect_timestamp.max_age cluster setting sets the maximum time that changefeeds making no forward progress will hold protected timestamp records. Once the changefeed.protect_timestamp.max_age duration is reached, the changefeed will fail with a permanent error. As a result, it is critical to monitor for changefeed failures because changefeeds will eventually fail with an unrecoverable error if they cannot progress before the duration is reached.
This cluster setting is enabled by default to 4 days. To disable expiration of protected timestamp records, you can set changefeed.protect_timestamp.max_age to 0; however, Cockroach Labs recommends implementing an expiration.
changefeed.protect_timestamp.max_age is a cluster-wide setting affecting all changefeeds.
changefeed.protect_timestamp.max_age applies only to newly created changefeeds in v23.2.If you are upgrading to v23.2, we recommend setting protect_data_from_gc_on_pause on any existing changefeeds to ensure that it does not enter a situation of infinite retries, which could prevent garbage collection. You can use the ALTER CHANGEFEED statement to add protect_data_from_gc_on_pause to existing changefeeds.gc_protect_expires_after
The gc_protect_expires_after option automatically expires the protected timestamp records that are older than the defined duration and cancels a changefeed job.
For example:
gc_protect_expires_after is an option applied to a single changefeed. To enable an expiration for protected timestamp records across changefeeds on the cluster, use the changefeed.protect_timestamp.max_age cluster setting.
Release protected timestamp records
To release the protected timestamps manually and allow garbage collection to resume, you can: We recommend monitoring storage and the number of running changefeeds. If a changefeed is not advancing and is retrying, it will (without limit) accumulate garbage while it retries to run up to the settings outlined in Prevent garbage accumulation. The only ways for changefeeds to not protect data are:- You cancel the changefeed.
- The changefeed fails without
on_error=pauseset.

