yuzhaojing commented on code in PR #5926:
URL: https://github.com/apache/hudi/pull/5926#discussion_r1091520367


##########
hudi-platform-service/hudi-table-service-manager/src/main/java/org/apache/hudi/table/service/manager/store/impl/InstanceService.java:
##########
@@ -0,0 +1,155 @@
+/*
+ * 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.hudi.table.service.manager.store.impl;
+
+import org.apache.hudi.table.service.manager.common.ServiceContext;
+import org.apache.hudi.table.service.manager.entity.AssistQueryEntity;
+import org.apache.hudi.table.service.manager.entity.Instance;
+import org.apache.hudi.table.service.manager.entity.InstanceStatus;
+
+import org.apache.hudi.table.service.manager.store.jdbc.JdbcMapper;
+
+import org.apache.ibatis.session.RowBounds;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+public class InstanceService {
+
+  private static Logger LOG = LogManager.getLogger(InstanceService.class);
+
+  private JdbcMapper jdbcMapper = ServiceContext.getJdbcMapper();
+
+  private static final String NAMESPACE = "Instance";
+
+  public void createInstance() {
+    try {
+      jdbcMapper.updateObject(statement(NAMESPACE, "createInstance"), null);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  public void saveInstance(Instance instance) {
+    try {
+      jdbcMapper.saveObject(statement(NAMESPACE, "saveInstance"), instance);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  public void updateStatus(Instance instance) {
+    try {
+      int ret = jdbcMapper.updateObject(statement(NAMESPACE, 
getUpdateStatusSqlId(instance)), instance);
+      if (ret != 1) {
+        LOG.error("Fail update status instance: " + instance);
+        throw new RuntimeException("Fail update status instance: " + 
instance.getIdentifier());
+      }
+      LOG.info("Success update status instance: " + instance.getIdentifier());
+    } catch (Exception e) {
+      LOG.error("Fail update status, instance: " + instance.getIdentifier() + 
", errMsg: ", e);
+      throw new RuntimeException(e);
+    }
+  }
+
+  public void updateExecutionInfo(Instance instance) {
+    int retryNum = 0;
+    try {
+      while (retryNum++ < 3) {

Review Comment:
   Will update it.



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

Reply via email to