dataroaring commented on code in PR #53317:
URL: https://github.com/apache/doris/pull/53317#discussion_r2228317709


##########
fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java:
##########
@@ -413,15 +417,31 @@ private ArrayList<AddPartitionClause> 
getAddPartitionClause(Database db, OlapTab
         return addPartitionClauses;
     }
 
-    private void checkAutoBucketCalcNumIsValid(int calcNum, int 
previousPartitionBucketsNum) {
+    private int checkAndFixAutoBucketCalcNumIsValid(int 
currentPartitionNumBuckets, int previousPartitionNumBuckets) {
         // previousPartitionBucketsNum == 0, some abnormal case, ignore it
-        if (previousPartitionBucketsNum != 0
-                && (calcNum > previousPartitionBucketsNum * (1 + 
Config.autobucket_out_of_bounds_percent_threshold))
-                || (calcNum < previousPartitionBucketsNum * (1 - 
Config.autobucket_out_of_bounds_percent_threshold))) {
-            LOG.warn("auto bucket calc num may be err, plz check. "
-                    + "calc bucket num {}, previous partition bucket num {}, 
percent {}",
-                    calcNum, previousPartitionBucketsNum, 
Config.autobucket_out_of_bounds_percent_threshold);
+        if (currentPartitionNumBuckets != 0) {
+            // currentPartitionNumBuckets can be too big
+            if (currentPartitionNumBuckets
+                    > previousPartitionNumBuckets * (1 + 
Config.autobucket_out_of_bounds_percent_threshold)) {
+                LOG.warn("auto bucket calc num may be err, bigger than 
previous too much, plz check. "
+                        + "calc bucket num {}, previous partition bucket num 
{}, percent {}",
+                        currentPartitionNumBuckets, 
previousPartitionNumBuckets,
+                        Config.autobucket_out_of_bounds_percent_threshold);
+                return currentPartitionNumBuckets;
+            }
+            // currentPartitionNumBuckets not too small.
+            // If it is too small, the program will intervene. use 
previousPartitionNumBuckets
+            if (currentPartitionNumBuckets
+                    < previousPartitionNumBuckets * (1 - 
Config.autobucket_out_of_bounds_percent_threshold)) {
+                LOG.warn("auto bucket calc num may be err, smaller than 
previous too much, plz check. "
+                        + "calc bucket num {}, previous partition bucket num 
{}, percent {}",
+                        currentPartitionNumBuckets, 
previousPartitionNumBuckets,
+                        Config.autobucket_out_of_bounds_percent_threshold);
+                return previousPartitionNumBuckets;
+            }
         }
+        LOG.info("previousPartitionBucketsNum eq 0, check before log");
+        return -1;

Review Comment:
   log table id  and partition id?



-- 
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]

Reply via email to