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

Use builder pattern in StoreFile and HFile

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.94.0
    • Component/s: None
    • Labels:
      None

      Description

      We have five ways to create an HFile writer, two ways to create a StoreFile writer, and the sets of parameters keep changing, creating a lot of confusion, especially when porting patches across branches. The same thing is happening to HColumnDescriptor. I think we should move to a "builder pattern" solution, e.g.

        HFileWriter w = HFile.getWriterBuilder(conf, <some common args>)
            .setParameter1(value1)
            .setParameter2(value2)
            ...
            .build();
      

      Each parameter setter being on its own line will make merges/cherry-pick work properly, we will not have to even mention default parameters again, and we can eliminate a dozen impossible-to-remember constructors.

      This particular JIRA addresses StoreFile and HFile refactoring. For HColumnDescriptor refactoring see HBASE-5357.

        Attachments

        1. ASF.LICENSE.NOT.GRANTED--D1893.1.patch
          43 kB
          Phabricator
        2. ASF.LICENSE.NOT.GRANTED--D1893.2.patch
          54 kB
          Phabricator
        3. HFile-StoreFile-builder-2012-02-22_22_49_00.patch
          58 kB
          Mikhail Bautin
        4. ASF.LICENSE.NOT.GRANTED--D1941.1.patch
          72 kB
          Phabricator
        5. ASF.LICENSE.NOT.GRANTED--D1941.2.patch
          72 kB
          Phabricator
        6. ASF.LICENSE.NOT.GRANTED--D1941.3.patch
          74 kB
          Phabricator
        7. ASF.LICENSE.NOT.GRANTED--D1941.4.patch
          74 kB
          Phabricator
        8. ASF.LICENSE.NOT.GRANTED--D1941.5.patch
          75 kB
          Phabricator
        9. ASF.LICENSE.NOT.GRANTED--D1983.1.patch
          0.9 kB
          Phabricator

          Activity

            People

            • Assignee:
              mikhail Mikhail Bautin
              Reporter:
              mikhail Mikhail Bautin
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: