Component(s)
exporter/clickhouse
Is your feature request related to a problem? Please describe.
Please correct me if any of this is incorrect.
Currently the TTL only applies if you use create_schema: true, otherwise it's essentially ignored. Also, if the value is changed, then it won't be reflected on the DB.
Describe the solution you'd like
I would like to suggest either we:
- Update the code to run an
ALTER TABLE ... ON CLUSTER .... when the collector comes up against the cluster to ensure the TTL is respected.
- Update the config to reflect the fact that the ttl is a bootstrap setting.
If a user looks at the config they would assume that all those settings would carry over rather than being silently ignored.
Describe alternatives you've considered
No response
Additional context
A few more notes, according to the docs The query is executed locally on the host and then the query is written by the host to ZK. I believe this should be fairly safe but you might run into the same SQL being executed multiple times. Alternatively you could run something like:
Disclaimer, AI assisted and needs further validation.
-- Step 1: Suppress full rewrite during the ALTER
ALTER TABLE my_table ON CLUSTER my_cluster
MODIFY SETTING materialize_ttl_recalculate_only = 1;
-- Step 2: Apply the TTL change (lightweight, only updates ttl.txt)
ALTER TABLE my_table ON CLUSTER my_cluster
MODIFY TTL event_time + INTERVAL 90 DAY;
-- Step 3: Reset the setting back to default
ALTER TABLE my_table ON CLUSTER my_cluster
RESET SETTING materialize_ttl_recalculate_only;
--OR
-- Step 3:
ALTER TABLE my_table ON CLUSTER my_cluster
MODIFY SETTING materialize_ttl_recalculate_only = 0;
-- Step 4: NOW actually apply TTL to existing data
ALTER TABLE my_table ON CLUSTER my_cluster
MATERIALIZE TTL;
Where existing data is not updated (heavy operation) and only the meta data is updated which is a very easy and light operation.
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Component(s)
exporter/clickhouse
Is your feature request related to a problem? Please describe.
Please correct me if any of this is incorrect.
Currently the TTL only applies if you use create_schema: true, otherwise it's essentially ignored. Also, if the value is changed, then it won't be reflected on the DB.
Describe the solution you'd like
I would like to suggest either we:
ALTER TABLE ... ON CLUSTER ....when the collector comes up against the cluster to ensure the TTL is respected.If a user looks at the config they would assume that all those settings would carry over rather than being silently ignored.
Describe alternatives you've considered
No response
Additional context
A few more notes, according to the docs The query is executed locally on the host and then the query is written by the host to ZK. I believe this should be fairly safe but you might run into the same SQL being executed multiple times. Alternatively you could run something like:
Disclaimer, AI assisted and needs further validation.
Where existing data is not updated (heavy operation) and only the meta data is updated which is a very easy and light operation.
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.