Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: Coprocessors
    • Labels:
    • Hadoop Flags:
      Incompatible change, Reviewed
    • Release Note:
      Hide
      Deletes BaseMasterAndRegionObserver, BaseMasterObserver, BaseRegionObserver, BaseRegionServerObserver and BaseWALObserver.
      Their corresponding interface classes now use JDK8's 'default' keyword to provide empty/no-op implementations so that:
      1. Derived class don't break when more coprocessor hooks are added in future.
      2. Derived classes don't have to redundantly override functions they don't care about with empty implementations.

      Earlier, BaseXXXObserver classes provided these exact two benefits, but with 'default' keyword in JDK8, they are not needed anymore.

      To fix the breakages because of this change, simply change "Foo extends BaseXXXObserver" to "Foo implements XXXObserver".
      Show
      Deletes BaseMasterAndRegionObserver, BaseMasterObserver, BaseRegionObserver, BaseRegionServerObserver and BaseWALObserver. Their corresponding interface classes now use JDK8's 'default' keyword to provide empty/no-op implementations so that: 1. Derived class don't break when more coprocessor hooks are added in future. 2. Derived classes don't have to redundantly override functions they don't care about with empty implementations. Earlier, BaseXXXObserver classes provided these exact two benefits, but with 'default' keyword in JDK8, they are not needed anymore. To fix the breakages because of this change, simply change "Foo extends BaseXXXObserver" to "Foo implements XXXObserver".

      Description

      In cases where one might need to use multiple observers, say region, master and regionserver; and the fact that only one class can be extended, it gives rise to following pattern:

          public class BaseMasterAndRegionObserver
            extends BaseRegionObserver
            implements MasterObserver
      
          class AccessController
            extends BaseMasterAndRegionObserver
            implements RegionServerObserver
      

      were BaseMasterAndRegionObserver is full copy of BaseMasterObserver.

      There is an example of simple case too where the current design fails.
      Say only one observer is needed by the coprocessor, but the design doesn't permit extending even that single observer (see RSGroupAdminEndpoint), that leads to full copy of Base...Observer class into coprocessor class leading to 1000s of lines of code and this ugly mix of 5 main functions with 100 useless functions.

        Attachments

        1. HBASE-17312.master.001.patch
          298 kB
          Guanghao Zhang
        2. HBASE-17312.master.001.patch
          298 kB
          Guanghao Zhang
        3. HBASE-17312.master.002.patch
          416 kB
          Appy
        4. HBASE-17312.master.003.patch
          419 kB
          Appy
        5. HBASE-17312.master.004.patch
          435 kB
          Appy
        6. HBASE-17312.master.005.patch
          434 kB
          Appy
        7. HBASE-17312.master.006.patch
          435 kB
          Appy

          Issue Links

            Activity

              People

              • Assignee:
                appy Appy
                Reporter:
                zghaobac Guanghao Zhang
              • Votes:
                0 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: