SWJTU-ZhangLei commented on code in PR #18746:
URL: https://github.com/apache/doris/pull/18746#discussion_r1168538015


##########
fe/fe-core/src/main/java/org/apache/doris/alter/AlterLSCHelper.java:
##########
@@ -79,7 +80,16 @@ public void enableLightSchemaChange() throws DdlException {
         final Map<Long, PFetchColIdsRequest> params = initParams();
         final PFetchColIdsResponse response = callForColumnIds(params);
         updateTableMeta(response);
-        modifyTableProperty();
+        writeEditLog(response);

Review Comment:
   It is unnecessary add a function `writeEditLog()` here



##########
fe/fe-core/src/main/java/org/apache/doris/persist/AlterLSCOperationLog.java:
##########
@@ -0,0 +1,102 @@
+// 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.persist;
+
+import org.apache.doris.common.io.Text;
+import org.apache.doris.common.io.Writable;
+import org.apache.doris.persist.gson.GsonUtils;
+import org.apache.doris.proto.InternalService.PFetchColIdsResponse;
+import org.apache.doris.proto.InternalService.PFetchColIdsResponse.Builder;
+import 
org.apache.doris.proto.InternalService.PFetchColIdsResponse.PFetchColIdsResultEntry;
+
+import com.google.common.base.Preconditions;
+import com.google.gson.annotations.SerializedName;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class AlterLSCOperationLog implements Writable {
+
+    @SerializedName(value = "dbId")
+    private Long dbId;
+
+    @SerializedName(value = "tableId")
+    private Long tableId;
+
+    @SerializedName(value = "indexIds")
+    private List<Long> indexIds;
+
+    @SerializedName(value = "colNameToIds")

Review Comment:
   how about  put  `indexIds` and `colNameToIds` into a map? don't use 
PFetchColIdsResponse here



##########
fe/fe-core/src/main/java/org/apache/doris/persist/AlterLSCOperationLog.java:
##########
@@ -0,0 +1,102 @@
+// 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.persist;
+
+import org.apache.doris.common.io.Text;
+import org.apache.doris.common.io.Writable;
+import org.apache.doris.persist.gson.GsonUtils;
+import org.apache.doris.proto.InternalService.PFetchColIdsResponse;
+import org.apache.doris.proto.InternalService.PFetchColIdsResponse.Builder;
+import 
org.apache.doris.proto.InternalService.PFetchColIdsResponse.PFetchColIdsResultEntry;
+
+import com.google.common.base.Preconditions;
+import com.google.gson.annotations.SerializedName;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class AlterLSCOperationLog implements Writable {

Review Comment:
   Don't use the abbreviation `LSC`,  it's not CamelCase style in java 



##########
fe/fe-core/src/main/java/org/apache/doris/alter/AlterLSCHelper.java:
##########
@@ -79,7 +80,16 @@ public void enableLightSchemaChange() throws DdlException {
         final Map<Long, PFetchColIdsRequest> params = initParams();
         final PFetchColIdsResponse response = callForColumnIds(params);
         updateTableMeta(response);

Review Comment:
   1、make `updateTableMeta(response)`  like this 
updateTableMeta(AlterLightSchemaChangeInfo info) so that it can be reused in 
replay



##########
fe/fe-core/src/main/java/org/apache/doris/alter/AlterLSCHelper.java:
##########
@@ -79,7 +80,16 @@ public void enableLightSchemaChange() throws DdlException {
         final Map<Long, PFetchColIdsRequest> params = initParams();
         final PFetchColIdsResponse response = callForColumnIds(params);
         updateTableMeta(response);
-        modifyTableProperty();
+        writeEditLog(response);
+    }
+
+    /**
+     * replay logic for alter LSC
+     *
+     * @param response will be set in edit log
+     */
+    public void replayAlterLSC(PFetchColIdsResponse response) throws 
DdlException {

Review Comment:
   It is unnecessary add a function replayAlterLSC here



##########
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java:
##########
@@ -1894,6 +1895,20 @@ private void enableLightSchemaChange(Database db, 
OlapTable olapTable) throws Dd
         alterLSCHelper.enableLightSchemaChange();
     }
 
+    public void replayAlterLSC(AlterLSCOperationLog info) throws 
MetaNotFoundException {

Review Comment:
   `replayAlterLSC` -> `replayAlterLightSchemaChange`,   the abbreviation `LSC 
` is not CamelCase



##########
fe/fe-core/src/main/java/org/apache/doris/alter/AlterLSCHelper.java:
##########
@@ -238,14 +248,14 @@ private void updateTableMeta(PFetchColIdsResponse 
response) throws DdlException
         } catch (IOException e) {
             throw new DdlException("fail to reset index schema", e);
         }
-    }
-
-    private void modifyTableProperty() {
         // write table property
         olapTable.setEnableLightSchemaChange(true);
+    }
+
+    private void writeEditLog(PFetchColIdsResponse response) {
         //write edit log
-        ModifyTablePropertyOperationLog info = new 
ModifyTablePropertyOperationLog(db.getId(), olapTable.getId(),
-                olapTable.getTableProperty().getProperties());
-        Env.getCurrentEnv().getEditLog().logAlterLightSchemaChange(info);
+        final AlterLSCOperationLog operationLog = new AlterLSCOperationLog(

Review Comment:
   AlterLSCOperationLog operationLog -> AlterLightSchemaChangeInfo info



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