v.22.2New Feature

Support IF EXISTS Clause for TTL Expression with MOVE TTL Rules on Replicas

Support IF EXISTS clause for TTL expr TO [DISK|VOLUME] [IF EXISTS] 'xxx' feature. Parts will be moved to disk or volume only if it exists on replica, so MOVE TTL rules will be able to behave differently on replicas according to the existing storage policies. Resolves #34455. #34504 (Anton Popov).
Support for the IF EXISTS clause in TTL expr TO [DISK|VOLUME] [IF EXISTS] 'xxx' expressions, allowing conditional movement of parts to disk or volume only if the target exists on the replica.

Why it matters

This feature addresses the need for MOVE TTL rules to behave differently on replicas based on existing storage policies. It prevents errors and inconsistencies by moving parts only when the specified disk or volume exists on the replica, improving replication flexibility and reliability.

How to use it

Add the IF EXISTS clause to your TTL expressions when specifying movement of parts to a disk or volume. For example:

TTL some_column + INTERVAL 7 DAY TO VOLUME IF EXISTS 'volume_name'


This will move parts only if the volume 'volume_name' exists on the replica.