HBase
  1. HBase
  2. HBASE-8273

HColumnDescriptor setters should return void

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      See discussion on dev@ mailing list, entitled 'Does compatibility between versions also mean binary compatibility?'

      Synopsis from that thread:

      HBASE-5357 "Use builder pattern in HColumnDescriptor" changed the
      method signatures by changing "void" to "HColumnDescriptor" so it' not
      the same methods anymore.

      if you invoke setters
      on HColumnDescriptor as you'll get:

      java.lang.NoSuchMethodError:
      org.apache.hadoop.hbase.HColumnDescriptor.setMaxVersions(I)V

        Activity

        Hide
        Jean-Daniel Cryans added a comment -

        This would make the next 0.94 release incompatible with all the other 0.94 releases (but compatible with 0.92). Not sure this is worth it.

        Show
        Jean-Daniel Cryans added a comment - This would make the next 0.94 release incompatible with all the other 0.94 releases (but compatible with 0.92). Not sure this is worth it.
        Hide
        stack added a comment -

        Resolving as invalid. Ill-specified issue. How do I know when this issue is done? We can't go back in time and change 0.94 releases.

        Show
        stack added a comment - Resolving as invalid. Ill-specified issue. How do I know when this issue is done? We can't go back in time and change 0.94 releases.
        Hide
        Lars Hofhansl added a comment -

        That would in fact be worse than a binary incompatibility between 0.92 and 0.94.
        I was hoping there's some way to have both, but I don't see an easy way to do that.

        Show
        Lars Hofhansl added a comment - That would in fact be worse than a binary incompatibility between 0.92 and 0.94. I was hoping there's some way to have both, but I don't see an easy way to do that.
        Hide
        Ted Yu added a comment -

        For the setters, there is a way to achieve compatibility between 0.92.x and 0.94.7 while keeping compatibility between 0.94.6 and 0.94.7.
        Below is an example:

        Index: hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
        ===================================================================
        --- hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java	(revision 1464795)
        +++ hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java	(working copy)
        @@ -572,6 +572,10 @@
             return this;
           }
        
        +  public void setMaxVersions(Integer maxVersions) {
        +    setValue(HConstants.VERSIONS, Integer.toString(maxVersions));
        +    cachedMaxVersions = maxVersions;
        +  }
           /**
            * @return The storefile/hfile blocksize for this column family.
            */
        

        Client previously compiled with 0.94.x release would pick up the existing setter in 0.94:

          public HColumnDescriptor setMaxVersions(int maxVersions) {
        

        Client previously compiled with 0.92.x release would pick up the new setter.

        Show
        Ted Yu added a comment - For the setters, there is a way to achieve compatibility between 0.92.x and 0.94.7 while keeping compatibility between 0.94.6 and 0.94.7. Below is an example: Index: hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java =================================================================== --- hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java (revision 1464795) +++ hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java (working copy) @@ -572,6 +572,10 @@ return this ; } + public void setMaxVersions( Integer maxVersions) { + setValue(HConstants.VERSIONS, Integer .toString(maxVersions)); + cachedMaxVersions = maxVersions; + } /** * @ return The storefile/hfile blocksize for this column family. */ Client previously compiled with 0.94.x release would pick up the existing setter in 0.94: public HColumnDescriptor setMaxVersions( int maxVersions) { Client previously compiled with 0.92.x release would pick up the new setter.
        Hide
        Lars Hofhansl added a comment -

        That's smart. Let's try that.

        Show
        Lars Hofhansl added a comment - That's smart. Let's try that.
        Hide
        Ted Yu added a comment -

        Can I reopen this JIRA ?

        The intention is to make transition from 0.92.x to 0.94.7 easier.

        Show
        Ted Yu added a comment - Can I reopen this JIRA ? The intention is to make transition from 0.92.x to 0.94.7 easier.
        Hide
        Lars Hofhansl added a comment -

        Let's give Ted's idea a try.

        Show
        Lars Hofhansl added a comment - Let's give Ted's idea a try.
        Hide
        Jean-Daniel Cryans added a comment -

        It doesn't work, even if I compile my client against 0.92 and pass an Integer it will just get compiled with Integer.intValue and still won't find the setMaxVersions(int).

        Basically, setMaxVersions(Integer) is a different signature.

        Show
        Jean-Daniel Cryans added a comment - It doesn't work, even if I compile my client against 0.92 and pass an Integer it will just get compiled with Integer.intValue and still won't find the setMaxVersions(int). Basically, setMaxVersions(Integer) is a different signature.
        Hide
        Ted Yu added a comment -

        I thought client compiled against 0.92 would pass int instead of Integer.

        Show
        Ted Yu added a comment - I thought client compiled against 0.92 would pass int instead of Integer.
        Hide
        Jean-Daniel Cryans added a comment -

        Ted Yu like I said, I tried both int and Integer and the latter once compiled is still just int, and it doesn't find a method that takes an int.

        Show
        Jean-Daniel Cryans added a comment - Ted Yu like I said, I tried both int and Integer and the latter once compiled is still just int, and it doesn't find a method that takes an int.
        Hide
        Ted Yu added a comment -

        Thanks J-D for the experiment.
        I found something that the proposed trick cannot address too:

        -  public void setValue(byte[] key, byte[] value) {
        +  public HColumnDescriptor setValue(byte[] key, byte[] value) {
        

        I tried char[] and Byte[]. Neither of which can bind with byte[].

        This is a (compatibility) lesson I will remember.

        Show
        Ted Yu added a comment - Thanks J-D for the experiment. I found something that the proposed trick cannot address too: - public void setValue( byte [] key, byte [] value) { + public HColumnDescriptor setValue( byte [] key, byte [] value) { I tried char[] and Byte[]. Neither of which can bind with byte[]. This is a (compatibility) lesson I will remember.
        Hide
        stack added a comment -

        I closed this rubbish issue once already. The description says nothing; in particular there is no fit criteria for when this issue has been solved.

        Speculation about what could work w/o an attempt at substantiation is just noise that just fills email inboxes putting load on the poor subscribers. Why is it up to others to prove whether or which it will work?

        Show
        stack added a comment - I closed this rubbish issue once already. The description says nothing; in particular there is no fit criteria for when this issue has been solved. Speculation about what could work w/o an attempt at substantiation is just noise that just fills email inboxes putting load on the poor subscribers. Why is it up to others to prove whether or which it will work?
        Hide
        Lars Hofhansl added a comment -

        I think it it was worth trying to explore this.

        Just my $0.02.

        Show
        Lars Hofhansl added a comment - I think it it was worth trying to explore this. Just my $0.02.
        Hide
        stack added a comment -

        Lars Hofhansl My point is that the 'this' is not specified. I am tired of inspecific issues. Non-specificity gives leeway for them to be filled w/ crap. This issue description points at mailing list conversation (one you have to go find yourself, no link is provided) and while a synopsis is supplied, it is NOT a synopsis of what went on on the mailing list; it is the name of a JIRA . There follows a sentence that we are supposed to infer relates some how to the preceding text, that talks of NoSuchMethodError. Then look at the subject of this issue? Should they return void?

        Awful.

        Show
        stack added a comment - Lars Hofhansl My point is that the 'this' is not specified. I am tired of inspecific issues. Non-specificity gives leeway for them to be filled w/ crap. This issue description points at mailing list conversation (one you have to go find yourself, no link is provided) and while a synopsis is supplied, it is NOT a synopsis of what went on on the mailing list; it is the name of a JIRA . There follows a sentence that we are supposed to infer relates some how to the preceding text, that talks of NoSuchMethodError. Then look at the subject of this issue? Should they return void? Awful.
        Hide
        Ted Yu added a comment -

        I logged this JIRA with an attempt to solve the binary compatibility issue.

        After further investigation, it turns out binary compatibility can be achieved between 0.92.3 and 0.94.7 in the following way:
        1. introduce an interface, called X e.g., in 0.92(.3) with the setters for HColumnDescriptor
        2. introduce an interface, called Y e.g., in 0.94(.7) with the setters for HColumnDescriptor where build pattern is supported
        3. write Java assembly code in 0.94(.7) for HColumnDescriptor supporting both interfaces

        Client code does not need reflection to use those methods.

        Show
        Ted Yu added a comment - I logged this JIRA with an attempt to solve the binary compatibility issue. After further investigation, it turns out binary compatibility can be achieved between 0.92.3 and 0.94.7 in the following way: 1. introduce an interface, called X e.g., in 0.92(.3) with the setters for HColumnDescriptor 2. introduce an interface, called Y e.g., in 0.94(.7) with the setters for HColumnDescriptor where build pattern is supported 3. write Java assembly code in 0.94(.7) for HColumnDescriptor supporting both interfaces Client code does not need reflection to use those methods.

          People

          • Assignee:
            Unassigned
            Reporter:
            Ted Yu
          • Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development