Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-18597

ExportSnapshot tool closes FileSystem objects obtained from the cache

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: snapshots

      Description

      In the ExportSnapshot tool the input and output FileSystem objects are being obtained using the method FileSystem.get which will either create a new FileSystem object or simply take an existing object out of the cache if a suitable one exists.
      After it is done with the these FileSystem objects it will close them.

      The issue here is that the ExportSnapshot tool will potentially remove preexisting FileSystem objects from the cache by closing said objects. This will break any apis running in the same process that are relying on these cached FileSystem objects.

      A simple solution could, I believe, fix this problem without affecting the functionality of the ExportSnapshot tool:
      Change ExportSnapshot.java lines 943:
      FileSystem inputFs = FileSystem.get(inputRoot.toUri(), srcConf);
      and 947:
      FileSystem outputFs = FileSystem.get(outputRoot.toUri(), destConf);

      to use FileSystem.newInstance instead of FileSystem.get:
      943
      FileSystem inputFs = FileSystem.newInstance(inputRoot.toUri(), srcConf);
      947
      FileSystem outputFs = FileSystem.newInstance(outputRoot.toUri(), destConf);

      This will create a unique entry in the cache and in this way prevent the closure of these FileSystem objects from wiping out any preexisting FileSystem objects. It will also ensure that no unused FileSystem objects created by the ExportSnapshot tool will be left taking up heap space and potentially causing memory issues.

      I am happy to submit a fix for this, but figured I would open an issue first so the issue can be properly discussed and tracked.
      Also note this is the first issue I have opened so I apologize in advance for any standard procedures and/or best practices I haven't followed.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ben.borchard Ben Borchard
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 0.25h
                0.25h
                Remaining:
                Remaining Estimate - 0.25h
                0.25h
                Logged:
                Time Spent - Not Specified
                Not Specified