You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/12/14 17:01:21 UTC

[GitHub] [ozone] errose28 commented on a change in pull request #1692: HDDS-4564. Prepare client should check every OM individually for the prepared check based on Txn ID.

errose28 commented on a change in pull request #1692:
URL: https://github.com/apache/ozone/pull/1692#discussion_r542503880



##########
File path: hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
##########
@@ -1091,6 +1094,23 @@ message PrepareResponse {
     required uint64 txnID = 1;
 }
 
+message PrepareStatusRequest {
+    required uint64 txnID = 1;
+}
+
+message PrepareStatusResponse {
+    enum PrepareStatus {
+        // TODO
+        // HDDS-4569 may introduce new states here, like marker file found
+        // but with different txn id. We can add them as make sense.
+        PREPARE_NOT_STARTED = 1;
+        PREPARE_IN_PROGRESS = 2;
+        PREPARE_COMPLETED = 3;
+    }
+    required PrepareStatus status = 1;
+    optional uint64 currentTxnIndex = 2;

Review comment:
       I'm a bit confused on the currentTxnIndex field. If this is really the current transaction index of the system, that will always exist, so why would that be optional? If it is instead being used as the prepare index, it makes sense that it would be optional and omitted if the OM is not prepared, but in that case we should probably change the name to `preparedIndex` or something like that.
   
   Assuming this is the prepare index, we should probably document what is expected of this field in relation to the different prepareStatuses. This was my thought but let me know what you think:
   - PREPARE_NOT_STARTED -> prepare index empty
   - PREPARE_IN_PROGRESS -> prepare index present, but this is the index we are waiting to be prepared on (index of the prepare request)
   - PREPARE_COMPLETED -> OM is prepared at the prepare index.

##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerRequestHandler.java
##########
@@ -623,6 +633,24 @@ private FinalizeUpgradeProgressResponse reportUpgradeProgress(
         .build();
   }
 
+  private PrepareStatusResponse getPrepareStatus(PrepareStatusRequest request)
+      throws IOException {
+    // TODO After HDDS-4569,
+    // When there is a global "prepared" state in OM, we can return
+    // PREPARE_NOT_STARTED instead of PREPARE_IN_PROGRESS appropriately.
+    PrepareStatus prepareStatus = null;
+    long txnID = request.getTxnID();
+    long ratisSnapshotIndex = impl.getRatisSnapshotIndex();
+    if (ratisSnapshotIndex != txnID) {
+      LOG.info("Last Txn Index = {}", ratisSnapshotIndex);
+      prepareStatus =  PREPARE_IN_PROGRESS;

Review comment:
       Just for clarification as I am working on HDDS-4569, is this the expected interpretations of status?
   flag on && (txn index == snapshot index) -> PREPARE_COMPLETED
   flag on && (txn index != snapshot index) -> PREPARE_IN_PROGRESS
   flag off  -> PREPARE_NOT_STARTED

##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerRequestHandler.java
##########
@@ -623,6 +633,24 @@ private FinalizeUpgradeProgressResponse reportUpgradeProgress(
         .build();
   }
 
+  private PrepareStatusResponse getPrepareStatus(PrepareStatusRequest request)
+      throws IOException {
+    // TODO After HDDS-4569,
+    // When there is a global "prepared" state in OM, we can return
+    // PREPARE_NOT_STARTED instead of PREPARE_IN_PROGRESS appropriately.
+    PrepareStatus prepareStatus = null;
+    long txnID = request.getTxnID();
+    long ratisSnapshotIndex = impl.getRatisSnapshotIndex();
+    if (ratisSnapshotIndex != txnID) {
+      LOG.info("Last Txn Index = {}", ratisSnapshotIndex);

Review comment:
       I think that should be `!=` in the log message. Also can we add some more context to this message, like "Received prepare status request while last txn index \<index> != last snapshot index \<snapshot index>".




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org