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

OM Ratis dir creation may fail

    XMLWordPrintableJSON

Details

    Description

      OM Ratis dir creation is attempted from 2 threads:

      1. Ratis server initializes storage dir in async CompletableFuture
      2. OM init directly creates it

      The latter may encounter the following exception:

      java.lang.IllegalArgumentException: Unable to create path: /github/workspace/hadoop-ozone/integration-test/target/test-dir/MiniOzoneClusterImpl-bdc6aaad-da50-4196-ab1e-80aad183d7b2/omNode-2/ratis
       	at org.apache.hadoop.ozone.OmUtils.createOMDir(OmUtils.java:493)
       	at org.apache.hadoop.ozone.om.OzoneManager.<init>(OzoneManager.java:426)
       	at org.apache.hadoop.ozone.om.OzoneManager.createOm(OzoneManager.java:862)
       	at org.apache.hadoop.ozone.MiniOzoneHAClusterImpl$Builder.createOMService(MiniOzoneHAClusterImpl.java:267)
       	at org.apache.hadoop.ozone.MiniOzoneHAClusterImpl$Builder.build(MiniOzoneHAClusterImpl.java:199)
      

      at:

        public static File createOMDir(String dirPath) {
          File dirFile = new File(dirPath);
          if (!dirFile.exists() && !dirFile.mkdirs()) {
            throw new IllegalArgumentException("Unable to create path: " + dirFile);
          }
          return dirFile;
        }
      

      It may happen that exists() returns false because the dir is does not exist yet, but mkdirs() also returns false because the dir is created in the meantime by the Ratis thread.

      Attachments

        Issue Links

          Activity

            People

              adoroszlai Attila Doroszlai
              adoroszlai Attila Doroszlai
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m