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 2021/03/23 14:08:31 UTC

[GitHub] [ozone] ChenSammi opened a new pull request #2077: HDDS-4987. Import container should not delete container contents if container already exists

ChenSammi opened a new pull request #2077:
URL: https://github.com/apache/ozone/pull/2077


   https://issues.apache.org/jira/browse/HDDS-4987
   
   Import container should also delete the whole container directory in case of import failure. 


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


[GitHub] [ozone] ChenSammi commented on pull request #2077: HDDS-4987. Import container should not delete container contents if container already exists

Posted by GitBox <gi...@apache.org>.
ChenSammi commented on pull request #2077:
URL: https://github.com/apache/ozone/pull/2077#issuecomment-811684322


   @GlenGeng , thanks for the code review. 


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


[GitHub] [ozone] GlenGeng commented on pull request #2077: HDDS-4987. Import container should not delete container contents if container already exists

Posted by GitBox <gi...@apache.org>.
GlenGeng commented on pull request #2077:
URL: https://github.com/apache/ozone/pull/2077#issuecomment-811675755


   +1. Thanks @ChenSammi  for the contribution.


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


[GitHub] [ozone] GlenGeng commented on a change in pull request #2077: HDDS-4987. Import container should not delete container contents if container already exists

Posted by GitBox <gi...@apache.org>.
GlenGeng commented on a change in pull request #2077:
URL: https://github.com/apache/ozone/pull/2077#discussion_r605404496



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
##########
@@ -496,11 +497,17 @@ public void importContainerData(InputStream input,
       KeyValueContainerUtil.parseKVContainerData(containerData, config);
 
     } catch (Exception ex) {
+      if (ex instanceof StorageContainerException &&

Review comment:
       NIT. Following may be better to handle the exception cases.
   
   ```
   } catch (StorageContainerException ex) {
     throw ex;
   } catch (Exception ex) {
     //delete all the temporary data in case of any exception.
     ...
   }
   ```




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


[GitHub] [ozone] ChenSammi merged pull request #2077: HDDS-4987. Import container should not delete container contents if container already exists

Posted by GitBox <gi...@apache.org>.
ChenSammi merged pull request #2077:
URL: https://github.com/apache/ozone/pull/2077


   


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


[GitHub] [ozone] GlenGeng commented on a change in pull request #2077: HDDS-4987. Import container should not delete container contents if container already exists

Posted by GitBox <gi...@apache.org>.
GlenGeng commented on a change in pull request #2077:
URL: https://github.com/apache/ozone/pull/2077#discussion_r600295679



##########
File path: hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainer.java
##########
@@ -206,8 +206,32 @@ public void testContainerImportExport() throws Exception {
       fail("Container is imported twice. Previous files are overwritten");
     } catch (IOException ex) {
       //all good
+      assertTrue(container.getContainerFile().exists());
     }
 
+    //Import failure should cleanup the container directory
+    containerData =
+        new KeyValueContainerData(containerId + 1,
+            keyValueContainerData.getLayOutVersion(),
+            keyValueContainerData.getMaxSize(), UUID.randomUUID().toString(),
+            datanodeId.toString());
+    container = new KeyValueContainer(containerData, CONF);
+
+    containerVolume = volumeChoosingPolicy.chooseVolume(volumeSet
+        .getVolumesList(), 1);
+    hddsVolumeDir = containerVolume.getHddsRootDir().toString();
+    container.populatePathFields(scmId, containerVolume, hddsVolumeDir);
+    try (FileInputStream fis = new FileInputStream(folderToExport)) {

Review comment:
       since you close `fis` explicitly, no need try with resource. Just
   
   ```
   try {
     FileInputStream fis = new FileInputStream(folderToExport);
     fis.close();
   }
   ```




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