yiguolei commented on a change in pull request #8030:
URL: https://github.com/apache/incubator-doris/pull/8030#discussion_r805173914



##########
File path: fe/fe-core/src/main/java/org/apache/doris/alter/AlterJobV2.java
##########
@@ -61,7 +61,7 @@ public boolean isFinalState() {
     }
 
     public enum JobType {
-        ROLLUP, SCHEMA_CHANGE
+        ROLLUP, SCHEMA_CHANGE, DECOMMISSION_BACKEND

Review comment:
       Yes, for example in decommission clause, it will use the enum.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
##########
@@ -2160,43 +2128,19 @@ public long saveAlterJob(CountingDataOutputStream dos, 
long checksum) throws IOE
     }
 
     public long saveAlterJob(CountingDataOutputStream dos, long checksum, 
JobType type) throws IOException {
-        Map<Long, AlterJob> alterJobs = null;
-        ConcurrentLinkedQueue<AlterJob> finishedOrCancelledAlterJobs = null;
         Map<Long, AlterJobV2> alterJobsV2 = Maps.newHashMap();
-        if (type == JobType.ROLLUP) {
-            alterJobs = this.getRollupHandler().unprotectedGetAlterJobs();
-            finishedOrCancelledAlterJobs = 
this.getRollupHandler().unprotectedGetFinishedOrCancelledAlterJobs();
-            alterJobsV2 = this.getRollupHandler().getAlterJobsV2();
-        } else if (type == JobType.SCHEMA_CHANGE) {
-            alterJobs = 
this.getSchemaChangeHandler().unprotectedGetAlterJobs();
-            finishedOrCancelledAlterJobs = 
this.getSchemaChangeHandler().unprotectedGetFinishedOrCancelledAlterJobs();
-            alterJobsV2 = this.getSchemaChangeHandler().getAlterJobsV2();
-        } else if (type == JobType.DECOMMISSION_BACKEND) {
-            alterJobs = this.getClusterHandler().unprotectedGetAlterJobs();
-            finishedOrCancelledAlterJobs = 
this.getClusterHandler().unprotectedGetFinishedOrCancelledAlterJobs();
-        }
 
-        // alter jobs
-        int size = alterJobs.size();
+        // alter jobs == 0
+        // If the FE version upgrade from old version, if it have alter jobs, 
the FE will failed during start process
+        // the number of old version alter jobs has to be 0
+        int size = 0;

Review comment:
       Need write size. 
   When use this fe version to replace old fe version, the old fe version does 
not have any old alter jobs, so that the size == 0. And the new fe version will 
load size and find it is 0, so that it will skip to load old alter jobs.
   If not write size = 0, the new fe version dump the image and try to restart 
it will fail because it will load size...

##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
##########
@@ -2160,43 +2128,19 @@ public long saveAlterJob(CountingDataOutputStream dos, 
long checksum) throws IOE
     }
 
     public long saveAlterJob(CountingDataOutputStream dos, long checksum, 
JobType type) throws IOException {
-        Map<Long, AlterJob> alterJobs = null;
-        ConcurrentLinkedQueue<AlterJob> finishedOrCancelledAlterJobs = null;
         Map<Long, AlterJobV2> alterJobsV2 = Maps.newHashMap();
-        if (type == JobType.ROLLUP) {
-            alterJobs = this.getRollupHandler().unprotectedGetAlterJobs();
-            finishedOrCancelledAlterJobs = 
this.getRollupHandler().unprotectedGetFinishedOrCancelledAlterJobs();
-            alterJobsV2 = this.getRollupHandler().getAlterJobsV2();
-        } else if (type == JobType.SCHEMA_CHANGE) {
-            alterJobs = 
this.getSchemaChangeHandler().unprotectedGetAlterJobs();
-            finishedOrCancelledAlterJobs = 
this.getSchemaChangeHandler().unprotectedGetFinishedOrCancelledAlterJobs();
-            alterJobsV2 = this.getSchemaChangeHandler().getAlterJobsV2();
-        } else if (type == JobType.DECOMMISSION_BACKEND) {
-            alterJobs = this.getClusterHandler().unprotectedGetAlterJobs();
-            finishedOrCancelledAlterJobs = 
this.getClusterHandler().unprotectedGetFinishedOrCancelledAlterJobs();
-        }
 
-        // alter jobs
-        int size = alterJobs.size();
+        // alter jobs == 0
+        // If the FE version upgrade from old version, if it have alter jobs, 
the FE will failed during start process
+        // the number of old version alter jobs has to be 0
+        int size = 0;
         checksum ^= size;
         dos.writeInt(size);
-        for (Entry<Long, AlterJob> entry : alterJobs.entrySet()) {
-            long tableId = entry.getKey();
-            checksum ^= tableId;
-            dos.writeLong(tableId);
-            entry.getValue().write(dos);
-        }
 
         // finished or cancelled jobs
-        size = finishedOrCancelledAlterJobs.size();
+        size = 0;

Review comment:
       Need write size.
   When use this fe version to replace old fe version, the old fe version does 
not have any old alter jobs, so that the size == 0. And the new fe version will 
load size and find it is 0, so that it will skip to load old alter jobs.
   If not write size = 0, the new fe version dump the image and try to restart 
it will fail because it will load size...

##########
File path: fe/fe-core/src/main/java/org/apache/doris/alter/DecommissionType.java
##########
@@ -0,0 +1,23 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.alter;
+
+public enum DecommissionType {
+    SystemDecommission, // after finished system decommission, the backend 
will be removed from Palo.
+    ClusterDecommission // after finished cluster decommission, the backend 
will be removed from cluster.

Review comment:
       It is used in cluster management clause.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/alter/SystemHandler.java
##########
@@ -71,26 +67,12 @@ public SystemHandler() {
         super("cluster");
     }
 
-    @Override

Review comment:
       It is used by alter cluster related clause. I will refactor this during 
refactor cluster management code.




-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to