You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/04/13 02:47:33 UTC

[GitHub] [iotdb] SzyWilliam opened a new pull request, #5497: [IOTDB-2848] Consensus snapshot interface

SzyWilliam opened a new pull request, #5497:
URL: https://github.com/apache/iotdb/pull/5497

   ## Description
   In this PR, I add snapshot related interface to `IStateMachine`
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] OneSizeFitsQuorum commented on a diff in pull request #5497: [IOTDB-2848] Consensus snapshot interface

Posted by GitBox <gi...@apache.org>.
OneSizeFitsQuorum commented on code in PR #5497:
URL: https://github.com/apache/iotdb/pull/5497#discussion_r852557518


##########
consensus/src/main/java/org/apache/iotdb/consensus/statemachine/IStateMachine.java:
##########
@@ -34,7 +37,50 @@ interface Registry extends Function<ConsensusGroupId, IStateMachine> {}
 
   void stop();
 
+  /**
+   * apply a write-request from user
+   *
+   * @param IConsensusRequest write request
+   */
   TSStatus write(IConsensusRequest IConsensusRequest);
 
+  /**
+   * read local data and return
+   *
+   * @param IConsensusRequest read request
+   */
   DataSet read(IConsensusRequest IConsensusRequest);
+
+  /**
+   * IConsensus will periodically take the snapshot on both log and statemachine Data
+   *
+   * @param metadata the metadata IConsensus want IStateMachine to preserve

Review Comment:
   Javadoc states that the updated snapshot should have lexicographically larger metadata, which needs to be supported by various consensus algorithm implementations



-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] SzyWilliam commented on a diff in pull request #5497: [IOTDB-2848] Consensus snapshot interface

Posted by GitBox <gi...@apache.org>.
SzyWilliam commented on code in PR #5497:
URL: https://github.com/apache/iotdb/pull/5497#discussion_r852533977


##########
consensus/src/main/java/org/apache/iotdb/consensus/statemachine/IStateMachine.java:
##########
@@ -37,4 +40,12 @@ interface Registry extends Function<ConsensusGroupId, IStateMachine> {}
   TSStatus write(IConsensusRequest IConsensusRequest);
 
   DataSet read(IConsensusRequest IConsensusRequest);
+
+  void takeSnapshot(ByteBuffer metadata, File snapshotDir);

Review Comment:
   done



-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] qiaojialin commented on a diff in pull request #5497: [IOTDB-2848] Consensus snapshot interface

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on code in PR #5497:
URL: https://github.com/apache/iotdb/pull/5497#discussion_r851960740


##########
consensus/src/main/java/org/apache/iotdb/consensus/statemachine/IStateMachine.java:
##########
@@ -37,4 +40,12 @@ interface Registry extends Function<ConsensusGroupId, IStateMachine> {}
   TSStatus write(IConsensusRequest IConsensusRequest);
 
   DataSet read(IConsensusRequest IConsensusRequest);
+
+  void takeSnapshot(ByteBuffer metadata, File snapshotDir);

Review Comment:
   add javadoc for method behavior and parameter



-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] SzyWilliam commented on a diff in pull request #5497: [IOTDB-2848] Consensus snapshot interface

Posted by GitBox <gi...@apache.org>.
SzyWilliam commented on code in PR #5497:
URL: https://github.com/apache/iotdb/pull/5497#discussion_r852560673


##########
consensus/src/main/java/org/apache/iotdb/consensus/statemachine/IStateMachine.java:
##########
@@ -34,7 +37,50 @@ interface Registry extends Function<ConsensusGroupId, IStateMachine> {}
 
   void stop();
 
+  /**
+   * apply a write-request from user
+   *
+   * @param IConsensusRequest write request
+   */
   TSStatus write(IConsensusRequest IConsensusRequest);
 
+  /**
+   * read local data and return
+   *
+   * @param IConsensusRequest read request
+   */
   DataSet read(IConsensusRequest IConsensusRequest);
+
+  /**
+   * IConsensus will periodically take the snapshot on both log and statemachine Data
+   *
+   * @param metadata the metadata IConsensus want IStateMachine to preserve

Review Comment:
   done



-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] qiaojialin merged pull request #5497: [IOTDB-2848] Consensus snapshot interface

Posted by GitBox <gi...@apache.org>.
qiaojialin merged PR #5497:
URL: https://github.com/apache/iotdb/pull/5497


-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] SzyWilliam commented on a diff in pull request #5497: [IOTDB-2848] Consensus snapshot interface

Posted by GitBox <gi...@apache.org>.
SzyWilliam commented on code in PR #5497:
URL: https://github.com/apache/iotdb/pull/5497#discussion_r852561383


##########
consensus/src/main/java/org/apache/iotdb/consensus/common/SnapshotMeta.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.iotdb.consensus.common;
+
+import java.io.File;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+public class SnapshotMeta {
+  private ByteBuffer metadata;
+  private List<File> snapshotFiles;
+
+  public SnapshotMeta(ByteBuffer metadata, List<File> snapshotFiles) {
+    this.metadata = metadata;

Review Comment:
   Done. In Ratis, metadata will contain ${term}_${index}. Other IConsensus implementation may vary. The guarantee here is that more updated snapshot will have lexicographically larger metadata.



-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] wangchao316 commented on a diff in pull request #5497: [IOTDB-2848] Consensus snapshot interface

Posted by GitBox <gi...@apache.org>.
wangchao316 commented on code in PR #5497:
URL: https://github.com/apache/iotdb/pull/5497#discussion_r852555864


##########
consensus/src/main/java/org/apache/iotdb/consensus/common/SnapshotMeta.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.iotdb.consensus.common;
+
+import java.io.File;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+public class SnapshotMeta {
+  private ByteBuffer metadata;
+  private List<File> snapshotFiles;
+
+  public SnapshotMeta(ByteBuffer metadata, List<File> snapshotFiles) {
+    this.metadata = metadata;

Review Comment:
   what does metadata contains ? add doc



-- 
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: reviews-unsubscribe@iotdb.apache.org

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