starrocks icon indicating copy to clipboard operation
starrocks copied to clipboard

The materialized view partition ttl property has being lost after restarting fe

Open guanxianchun opened this issue 1 year ago • 2 comments

  1. create materialized view CREATE MATERIALIZED VIEW mv_hive_order (dt, product_id, gmv) PARTITION BY (str2date(dt, '%Y-%m-%d')) DISTRIBUTED BY HASH(product_id) REFRESH MANUAL PROPERTIES ( "replicated_storage" = "true", "partition_refresh_number" = "1", "session.enable_spill" = "true", "replication_num" = "1", "session.query_timeout" = "3600", "partition_ttl" = "2 DAY", "storage_medium" = "HDD" ) AS SELECT hive_order.dt, hive_order.product_id, sum(hive_order.price) AS gmv FROM hive_hms_catalog.ods.hive_order

  2. restart fe

  3. show create materialized view | mv_hive_order | CREATE MATERIALIZED VIEW mv_hive_order (dt, product_id, gmv) PARTITION BY (str2date(dt, '%Y-%m-%d')) DISTRIBUTED BY HASH(product_id) REFRESH MANUAL PROPERTIES ( "replicated_storage" = "true", "partition_refresh_number" = "1", "session.enable_spill" = "true", "replication_num" = "1", "session.query_timeout" = "3600", "storage_medium" = "HDD" ) AS SELECT hive_order.dt, hive_order.product_id, sum(hive_order.price) AS gmv FROM hive_hms_catalog.ods.hive_order GROUP BY hive_order.dt, hive_order.product_id;

fix partition ttl lost url : https://github.com/StarRocks/starrocks/pull/51194 It was removed when calling the PropertyAnalyzer.analyzePartitionTTL method. Therefore, the properties need to be copied before calling the method and the copied object is used as a parameter. such code : Map<String, String> props = new HashMap(properties); Pair<String, PeriodDuration> ttlDuration = PropertyAnalyzer.analyzePartitionTTL(props);

guanxianchun avatar Oct 18 '24 07:10 guanxianchun

@guanxianchun this is fixed as part of PR https://github.com/StarRocks/starrocks/pull/51028 it seems your version does not have the fix.

rohitrs1983 avatar Oct 20 '24 07:10 rohitrs1983

@guanxianchun this is fixed as part of PR #51028 it seems your version does not have the fix.

I am using the latest code from branch 3.1, which already includes the bug fix code. This is a new issue that arose after using the analyzePartitionTTL method.

It was removed when calling the PropertyAnalyzer.analyzePartitionTTL method:

public static Pair<String, PeriodDuration> analyzePartitionTTL(Map<String, String> properties) { if (properties != null && properties.containsKey(PROPERTIES_PARTITION_TTL)) { String ttlStr = properties.get(PROPERTIES_PARTITION_TTL); PeriodDuration duration; try { duration = TimeUtils.parseHumanReadablePeriodOrDuration(ttlStr); } catch (NumberFormatException e) { throw new SemanticException(String.format("illegal %s: %s", PROPERTIES_PARTITION_TTL, e.getMessage())); } properties.remove(PROPERTIES_PARTITION_TTL); return Pair.create(ttlStr, duration); } return Pair.create(null, PeriodDuration.ZERO); }

In the analyzePartitionTTL method, the PROPERTIES_PARTITION_TTL property was removed from properties. the code as follow:

properties.remove(PROPERTIES_PARTITION_TTL);

guanxianchun avatar Oct 21 '24 01:10 guanxianchun

mv partition ttl

guanxianchun avatar Jan 04 '25 03:01 guanxianchun

@rohitrs1983 dddd

guanxianchun avatar Jan 04 '25 03:01 guanxianchun

We have marked this issue as stale because it has been inactive for 6 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to StarRocks!

github-actions[bot] avatar Jul 07 '25 11:07 github-actions[bot]