This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a1aee3886 [fix](load) exclude canceled  job when canceling load 
(#19268)
1a1aee3886 is described below

commit 1a1aee3886b114e8ec1fd4825106d196e0531f13
Author: 奕冷 <[email protected]>
AuthorDate: Fri May 5 10:31:16 2023 +0800

    [fix](load) exclude canceled  job when canceling load (#19268)
---
 .../org/apache/doris/load/loadv2/LoadManager.java  | 50 ++++++++++++----------
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java 
b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
index a54b9f98e3..e63bce7c12 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
@@ -238,23 +238,29 @@ public class LoadManager implements Writable {
         String state = stmt.getState();
         PatternMatcher matcher = 
PatternMatcherWrapper.createMysqlPattern(label,
                 CaseSensibility.LABEL.getCaseSensibility());
-        matchLoadJobs.addAll(loadJobs.stream().filter(job -> {
-            if (stmt.getOperator() != null) {
-                // compound
-                boolean labelFilter =
-                        label.contains("%") ? matcher.match(job.getLabel()) : 
job.getLabel().equalsIgnoreCase(label);
-                boolean stateFilter = 
job.getState().name().equalsIgnoreCase(state);
-                return Operator.AND.equals(stmt.getOperator()) ? labelFilter 
&& stateFilter :
-                        labelFilter || stateFilter;
-            }
-            if (StringUtils.isNotEmpty(label)) {
-                return label.contains("%") ? matcher.match(job.getLabel()) : 
job.getLabel().equalsIgnoreCase(label);
-            }
-            if (StringUtils.isNotEmpty(state)) {
-                return job.getState().name().equalsIgnoreCase(state);
-            }
-            return false;
-        }).collect(Collectors.toList()));
+        matchLoadJobs.addAll(
+                loadJobs.stream()
+                        .filter(job -> job.getState() != JobState.CANCELLED)
+                        .filter(job -> {
+                            if (stmt.getOperator() != null) {
+                                // compound
+                                boolean labelFilter =
+                                        label.contains("%") ? 
matcher.match(job.getLabel())
+                                                : 
job.getLabel().equalsIgnoreCase(label);
+                                boolean stateFilter = 
job.getState().name().equalsIgnoreCase(state);
+                                return Operator.AND.equals(stmt.getOperator()) 
? labelFilter && stateFilter :
+                                        labelFilter || stateFilter;
+                            }
+                            if (StringUtils.isNotEmpty(label)) {
+                                return label.contains("%") ? 
matcher.match(job.getLabel())
+                                        : 
job.getLabel().equalsIgnoreCase(label);
+                            }
+                            if (StringUtils.isNotEmpty(state)) {
+                                return 
job.getState().name().equalsIgnoreCase(state);
+                            }
+                            return false;
+                        }).collect(Collectors.toList())
+        );
     }
 
     /**
@@ -492,13 +498,13 @@ public class LoadManager implements Writable {
     /**
      * This method will return the jobs info which can meet the condition of 
input param.
      *
-     * @param dbId          used to filter jobs which belong to this db
-     * @param labelValue    used to filter jobs which's label is or like 
labelValue.
+     * @param dbId used to filter jobs which belong to this db
+     * @param labelValue used to filter jobs which's label is or like 
labelValue.
      * @param accurateMatch true: filter jobs which's label is labelValue. 
false: filter jobs which's label like itself.
-     * @param statesValue   used to filter jobs which's state within the 
statesValue set.
+     * @param statesValue used to filter jobs which's state within the 
statesValue set.
      * @return The result is the list of jobInfo.
-     *         JobInfo is a list which includes the comparable object: jobId, 
label, state etc.
-     *         The result is unordered.
+     * JobInfo is a list which includes the comparable object: jobId, label, 
state etc.
+     * The result is unordered.
      */
     public List<List<Comparable>> getLoadJobInfosByDb(long dbId, String 
labelValue, boolean accurateMatch,
             Set<String> statesValue) throws AnalysisException {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to