Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.9k
[fix](metric) Change partition near-limit metrics from counters to gauges#61845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -128,6 +128,8 @@ protected void runAfterCatalogReady() { | ||
| long tabletCount = 0L; | ||
| long partitionCount = 0L; | ||
| long tableCount = 0L; | ||
| long autoPartitionNearLimitCount = 0L; | ||
| long dynamicPartitionNearLimitCount = 0L; | ||
| List<Long> dbIds = Env.getCurrentInternalCatalog().getDbIds(); | ||
| for (Long dbId : dbIds) { | ||
| Database db = Env.getCurrentInternalCatalog().getDbNullable(dbId); | ||
| @@ -162,7 +164,24 @@ protected void runAfterCatalogReady() { | ||
| } | ||
| try { | ||
| List<Partition> allPartitions = olapTable.getAllPartitions(); | ||
| // Use getPartitionNum() (excludes temp partitions) for limit check, | ||
| // consistent with how partition limits are enforced elsewhere. | ||
| int nonTempPartitionNum = olapTable.getPartitionNum(); | ||
| partitionCount += allPartitions.size(); | ||
| // Check if this table's partition count is near the limit (>80%) | ||
| if (olapTable.getPartitionInfo().enableAutomaticPartition()) { | ||
| int limit = Config.max_auto_partition_num; | ||
| if (nonTempPartitionNum > limit * 8L / 10) { | ||
| autoPartitionNearLimitCount++; | ||
| } | ||
| } | ||
| if (olapTable.dynamicPartitionExists() | ||
| && olapTable.getTableProperty().getDynamicPartitionProperty().getEnable()) { | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Semantic mismatch for dynamic partition near-limit check. The original metric in
However, the new code here compares
Consider comparing the configured span ( DynamicPartitionPropertydpProp = olapTable.getTableProperty().getDynamicPartitionProperty();
longspan = (long) dpProp.getEnd() - dpProp.getStart();
intlimit = Config.max_dynamic_partition_num;
if (span > limit * 8L / 10) {
dynamicPartitionNearLimitCount++;
}This would make the gauge semantically consistent with the enforcement in Note: The auto-partition check above is correct — | ||
| int limit = Config.max_dynamic_partition_num; | ||
| if (nonTempPartitionNum > limit * 8L / 10) { | ||
| dynamicPartitionNearLimitCount++; | ||
| } | ||
| } | ||
| for (Partition partition : allPartitions) { | ||
| long partitionDataSize = 0L; | ||
| long version = partition.getVisibleVersion(); | ||
| @@ -295,6 +314,8 @@ protected void runAfterCatalogReady() { | ||
| // avoid ArithmeticException: / by zero | ||
| long avgTabletSize = totalTableSize / Math.max(1, tabletCount); | ||
| MetricRepo.GAUGE_AVG_TABLET_SIZE_BYTES.setValue(avgTabletSize); | ||
| MetricRepo.GAUGE_AUTO_PARTITION_NEAR_LIMIT.setValue(autoPartitionNearLimitCount); | ||
| MetricRepo.GAUGE_DYNAMIC_PARTITION_NEAR_LIMIT.setValue(dynamicPartitionNearLimitCount); | ||
| LOG.info("OlapTable num=" + tableCount | ||
| + ", partition num=" + partitionCount + ", tablet num=" + tabletCount | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -256,9 +256,9 @@ public final class MetricRepo { | ||
| public static GaugeMetricImpl<Long> GAUGE_AVG_PARTITION_SIZE_BYTES; | ||
| public static GaugeMetricImpl<Long> GAUGE_AVG_TABLET_SIZE_BYTES; | ||
| // Partition near-limit warnings | ||
| public static LongCounterMetric COUNTER_AUTO_PARTITION_NEAR_LIMIT; | ||
| public static LongCounterMetric COUNTER_DYNAMIC_PARTITION_NEAR_LIMIT; | ||
| // Partition near-limit warnings (gauges: current number of tables near the partition limit) | ||
| public static GaugeMetricImpl<Long> GAUGE_AUTO_PARTITION_NEAR_LIMIT; | ||
| public static GaugeMetricImpl<Long> GAUGE_DYNAMIC_PARTITION_NEAR_LIMIT; | ||
| // Agent task | ||
| public static LongCounterMetric COUNTER_AGENT_TASK_REQUEST_TOTAL; | ||
| @@ -1044,15 +1044,16 @@ public Integer getValue() { | ||
| GAUGE_AVG_TABLET_SIZE_BYTES = new GaugeMetricImpl<>("avg_tablet_size_bytes", MetricUnit.BYTES, "", 0L); | ||
| DORIS_METRIC_REGISTER.addMetrics(GAUGE_AVG_TABLET_SIZE_BYTES); | ||
| // Partition near-limit warning counters | ||
| COUNTER_AUTO_PARTITION_NEAR_LIMIT = new LongCounterMetric("auto_partition_near_limit_count", | ||
| // Partition near-limit warning gauges (updated by TabletStatMgr periodic scan) | ||
| GAUGE_AUTO_PARTITION_NEAR_LIMIT = new GaugeMetricImpl<>("auto_partition_near_limit_count", | ||
| MetricUnit.NOUNIT, | ||
| "number of times auto partition count exceeded 80% of max_auto_partition_num"); | ||
| DORIS_METRIC_REGISTER.addMetrics(COUNTER_AUTO_PARTITION_NEAR_LIMIT); | ||
| COUNTER_DYNAMIC_PARTITION_NEAR_LIMIT = new LongCounterMetric("dynamic_partition_near_limit_count", | ||
| "number of auto partition tables where partition count exceeded 80% of max_auto_partition_num", 0L); | ||
| DORIS_METRIC_REGISTER.addMetrics(GAUGE_AUTO_PARTITION_NEAR_LIMIT); | ||
| GAUGE_DYNAMIC_PARTITION_NEAR_LIMIT = new GaugeMetricImpl<>("dynamic_partition_near_limit_count", | ||
| MetricUnit.NOUNIT, | ||
| "number of times dynamic partition count exceeded 80% of max_dynamic_partition_num"); | ||
| DORIS_METRIC_REGISTER.addMetrics(COUNTER_DYNAMIC_PARTITION_NEAR_LIMIT); | ||
| "number of dynamic partition tables where partition count exceeded 80% of max_dynamic_partition_num", | ||
| 0L); | ||
| DORIS_METRIC_REGISTER.addMetrics(GAUGE_DYNAMIC_PARTITION_NEAR_LIMIT); | ||
dataroaring marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| COUNTER_AGENT_TASK_REQUEST_TOTAL = new LongCounterMetric("agent_task_request_total", MetricUnit.NOUNIT, | ||
| "total agent batch task request send to BE"); | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same semantic mismatch as in
TabletStatMgr.java— the dynamic partition near-limit check should compare the configured span (end - start) againstmax_dynamic_partition_num, not the total partition count. See the detailed comment on theTabletStatMgr.javacounterpart.