Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-11221

Have StorageDirectory return Optional<File> instead of File/null

    XMLWordPrintableJSON

Details

    • Task
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      In HDFS-10675, StorageDirectory.root can be null because PROVIDED storage locations will not have any directories associated with them. Hence, we need to add checks to StorageDirectory to make sure we handle this. This would also lead to changes in code that call StorageDirectory.getRoot, StorageDirectory.getCurrentDir, StorageDirectory.getVersionFile etc. as the return value can be nul}}l (if {{StorageDirectory.root is null).

      The proposal to handle this is to change the return type of the above functions to Optional<File>. According to my preliminary check, this will result in changes in ~70 places, which is why it's not appropriate to put it in the patch for HDFS-10675. But it is certainly a valuable fix.

      Attachments

        1. HDFS-11221-v1.patch
          106 kB
          Jiajia Li
        2. HDFS-11221-002.patch
          110 kB
          Jiajia Li

        Issue Links

          Activity

            People

              jiajia Jiajia Li
              ehiggs Ewan Higgs
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: