adoroszlai commented on a change in pull request #2376:
URL: https://github.com/apache/ozone/pull/2376#discussion_r668079121



##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/DownloadAndImportReplicator.java
##########
@@ -122,7 +122,15 @@ public void replicate(ReplicationTask task) {
                 containerID, bytes);
         task.setTransferredBytes(bytes);
 
-        importContainer(containerID, path);
+        if (bytes <= 0) {
+          task.setStatus(Status.FAILED);
+          LOG.warn("Container {} is downloaded with size {}",
+              containerID, bytes);
+        } else {
+          importContainer(containerID, path);
+          LOG.info("Container {} is replicated successfully", containerID);
+          task.setStatus(Status.DONE);
+        }
         LOG.info("Container {} is replicated successfully", containerID);
         task.setStatus(Status.DONE);

Review comment:
       This would overwrite previous `FAILED` status.

##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/TarContainerPacker.java
##########
@@ -152,6 +157,20 @@ public void pack(Container<KeyValueContainerData> 
container,
     try (OutputStream compressed = compress(output);
          ArchiveOutputStream archiveOutput = tar(compressed)) {
 
+      if (!containerData.getDbFile().exists()) {
+        LOG.warn("DBfile {} not exist",
+            containerData.getDbFile().toPath().toString());
+        return;
+      } else if (!new File(containerData.getChunksPath()).exists()) {
+        LOG.warn("Chunkfile {} not exist",
+            containerData.getDbFile().toPath().toString());
+        return;
+      } else if (!container.getContainerFile().exists()) {
+        LOG.warn("Containerfile {} not exist",
+            containerData.getDbFile().toPath().toString());
+        return;
+      }

Review comment:
       > > Would it make sense to utilize `Container.scanMetadata()` instead? 
More complete checks without introducing duplication.
   >
   > Ok,I will change it.thank you very much!
   
   This [comment](https://github.com/apache/ozone/pull/2196/files#r628170059) 
from the previous PR still applies.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to