Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-5708

Configuration should provide a way to write only properties that have been set

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Invalid
    • 0.19.1
    • None
    • conf
    • None

    Description

      The Configuration.write and .writeXml methods always output all properties, whether they came from a default source, a loaded resource file, or an "overlay" set call. There should be a way to write only the properties that were set, leaving out the properties that came from a default source.

      Why? Suppose I build a configuration on a machine that is not associated with a grid, write it out to XML, then try to load it on a grid gateway. The configuration would contain all of the defaults picked up from my non-grid machine, and would completely overwrite all the defaults on that grid.

      I propose to add methods to write out only the overlay values in Object and XML formats.

      I see two options for implementing this:
      1) Either completely new methods could be crafted (writeOverlay(DataOutput) and writeOverlayXml(OutputStream), or
      2) The existing write() and writeXml() methods could be adjusted to take an additional parameter indicating whether the full properties or overlay properties should be written. (Of course, the existing write() and writeXml() methods would remain, defaulting to the current behavior.)

      Option 1 has less impact to existing code. Option 2 is a cleaner implementation with less code-duplication involved. I would much prefer to do option 2.

      Oh, and in case it's not clear, I'm offering to make this change and submit it.

      Thoughts?

      . Topher

      Attachments

        1. 02_configuration.patch
          53 kB
          Shevek
        2. 01_configuration.patch
          50 kB
          Shevek

        Issue Links

          Activity

            People

              Unassigned Unassigned
              xephyrus Topher ZiCornell
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: