Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-4987

Import container should not delete container contents if container already exists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.2.0
    • None

    Description

      KeyValueContainer # importContainerData

      if (getContainerFile().exists()) {
              String errorMessage = String.format(
                  "Can't import container (cid=%d) data to a specific location"
                      + " as the container descriptor (%s) has already been exist.",
                  getContainerData().getContainerID(),
                  getContainerFile().getAbsolutePath());
              throw new IOException(errorMessage);
            }
      
      ....
      
      catch (Exception ex) {
            //delete all the temporary data in case of any exception.
            try {
              FileUtils.deleteDirectory(new File(containerData.getMetadataPath()));
              FileUtils.deleteDirectory(new File(containerData.getChunksPath()));
              FileUtils.deleteDirectory(getContainerFile());
            } catch (Exception deleteex) {
              LOG.error(
                  "Can not cleanup destination directories after a container import"
                      + " error (cid" +
                      containerData.getContainerID() + ")", deleteex);
            }
            throw ex;
      

      That's one of the reason why DN report empty container directories during startup.
      2021-03-16 16:26:58,337 [Thread-9] ERROR org.apache.hadoop.ozone.container.ozoneimpl.ContainerReader: Missing .container file for ContainerID: 112224
      2021-03-16 16:26:58,433 [Thread-9] ERROR org.apache.hadoop.ozone.container.ozoneimpl.ContainerReader: Missing .container file for ContainerID: 11913
      2021-03-16 16:26:58,474 [Thread-9] ERROR org.apache.hadoop.ozone.container.ozoneimpl.ContainerReader: Missing .container file for ContainerID: 11823

      Attachments

        Issue Links

          Activity

            People

              Sammi Sammi Chen
              Sammi Sammi Chen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: