You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/08/11 03:42:07 UTC

[GitHub] [incubator-seatunnel] ashulin commented on a diff in pull request #2391: [New-Engine]Checkpoint storage

ashulin commented on code in PR #2391:
URL: https://github.com/apache/incubator-seatunnel/pull/2391#discussion_r943070205


##########
seatunnel-engine/seatunnel-check-point/check-point-storage-api/src/main/java/org/apache/seatunnel/engine/checkpoint/storage/api/CheckPointStorage.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.seatunnel.engine.checkpoint.storage.api;
+
+import org.apache.seatunnel.engine.checkpoint.storage.PipelineState;
+import org.apache.seatunnel.engine.checkpoint.storage.exception.CheckPointStorageException;
+
+import java.util.List;
+import java.util.Map;
+
+public interface CheckPointStorage {
+
+    /**
+     * init storage and create parent directory if not exists
+     *
+     * @param configuration configuration storage system config params
+     * @throws CheckPointStorageException if init failed
+     */
+    void initStorage(Map<String, String> configuration) throws CheckPointStorageException;
+
+    /**
+     * save checkpoint to storage
+     *
+     * @param state PipelineState
+     * @throws CheckPointStorageException if save checkpoint failed
+     */
+    String storeCheckPoint(PipelineState state) throws CheckPointStorageException;
+
+    /**
+     * get all checkpoint from storage
+     *
+     * @param jobId job id
+     * @return All job's checkpoint data from storage
+     * @throws CheckPointStorageException if get checkpoint failed
+     */
+    List<PipelineState> getAllCheckpoints(String jobId);
+
+    /**
+     * get latest checkpoint from storage
+     *
+     * @param jobId job id
+     * @return latest checkpoint data from storage
+     * @throws CheckPointStorageException if get checkpoint failed
+     */
+    PipelineState getLatestCheckpoint(String jobId) throws CheckPointStorageException;

Review Comment:
   ```suggestion
       List<PipelineState> getLatestCheckpoint(String jobId) throws CheckPointStorageException;
   ```
   A job has multiple pipelines. When the entire job restarts, it needs to obtain the latest checkpoint of all pipelines.



##########
seatunnel-engine/seatunnel-check-point/check-point-storage-api/src/main/java/org/apache/seatunnel/engine/checkpoint/storage/api/CheckPointStorage.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.seatunnel.engine.checkpoint.storage.api;
+
+import org.apache.seatunnel.engine.checkpoint.storage.PipelineState;
+import org.apache.seatunnel.engine.checkpoint.storage.exception.CheckPointStorageException;
+
+import java.util.List;
+import java.util.Map;
+
+public interface CheckPointStorage {

Review Comment:
   We need a uniform name, `checkpoint` is a word.



##########
seatunnel-engine/pom.xml:
##########
@@ -30,5 +30,6 @@
         <module>seatunnel-engine-common</module>
         <module>seatunnel-engine-server</module>
         <module>seatunnel-engine-core</module>
+        <module>seatunnel-check-point</module>

Review Comment:
   I don't think a module is needed for checkpoint because checkpoint is part of the server;
   I think this module can be changed to storage to support multiple storages, store data such as checkpoints, conf files, etc.
   ```suggestion
           <module>seatunnel-storage</module>
   ```
   And submodules will not be prefixed with checkpoint.



-- 
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-unsubscribe@seatunnel.apache.org

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