github-actions[bot] commented on code in PR #61845:
URL: https://github.com/apache/doris/pull/61845#discussion_r3007423574
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/TabletStatMgr.java:
##########
@@ -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()) {
Review Comment:
**Semantic mismatch for dynamic partition near-limit check.**
The original metric in `DynamicPartitionUtil` compared
`expectCreatePartitionNum` (which is `end - start`, the configured partition
span/window) against `Config.max_dynamic_partition_num`. Per the config's own
Javadoc:
> *Used to limit the maximum number of partitions that can be **created**
when creating a dynamic partition table [...] The number is determined by
"start" and "end" in the dynamic partition parameters.*
However, the new code here compares `nonTempPartitionNum` (total current
partition count on the table) against `max_dynamic_partition_num`. These are
semantically different:
- A table with `start=-5, end=3` (span=8) but 17,000 manually-added
partitions would trigger this gauge even though the dynamic partition config is
well within the limit.
- Conversely, a table with `start=-15000, end=5000` (span=20,000) but only
100 currently-existing partitions would NOT trigger the gauge, even though the
dynamic partition span already hits the hard limit.
Consider comparing the configured span (`end - start`) instead:
```java
DynamicPartitionProperty dpProp =
olapTable.getTableProperty().getDynamicPartitionProperty();
long span = (long) dpProp.getEnd() - dpProp.getStart();
int limit = Config.max_dynamic_partition_num;
if (span > limit * 8L / 10) {
dynamicPartitionNearLimitCount++;
}
```
This would make the gauge semantically consistent with the enforcement in
`DynamicPartitionUtil`.
Note: The auto-partition check above is correct —
`FrontendServiceImpl.createPartition()` does compare total partition count
against `max_auto_partition_num`.
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CloudTabletStatMgr.java:
##########
@@ -333,7 +335,24 @@ private void updateStatInfo(List<Long> dbIds) {
OlapTable.Statistics tableStats;
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()) {
Review Comment:
Same semantic mismatch as in `TabletStatMgr.java` — the dynamic partition
near-limit check should compare the configured span (`end - start`) against
`max_dynamic_partition_num`, not the total partition count. See the detailed
comment on the `TabletStatMgr.java` counterpart.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]