-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29706: Make CoprocessorDescriptorImpl.equals() and hashCode() r… #7575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
cd74717 to
4272f2c
Compare
This comment has been minimized.
This comment has been minimized.
|
Need to run |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
...-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyTableProcedure.java
Outdated
Show resolved
Hide resolved
Umeshkumar9414
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
4272f2c to
3a1ebef
Compare
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
@apurtell @virajjasani please review when you get some free cycle. |
Apache9
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title of the PR is different with the title of the jira...
Could someone explain more about what do we actually fix here?
Thanks.
| ) { | ||
| return false; | ||
| } | ||
| return new TreeMap<>(getProperties()).equals(new TreeMap<>(other.getProperties())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could use equals directly here?
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(className, jarPath, priority, new TreeMap<>(properties)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better use Objects.hash to calculate hashCode for fields other than properties, and then use stream.sorted to iterator over properties and calculate hashCode on the fly.
| if ( | ||
| this.unmodifiedTableDescriptor.getCoprocessorDescriptors().hashCode() | ||
| != this.modifiedTableDescriptor.getCoprocessorDescriptors().hashCode() | ||
| !new HashSet<>(this.unmodifiedTableDescriptor.getCoprocessorDescriptors()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not on the critial read/write path so maybe this is acceptable, but a better way, is to first check size, and then, create a HashSet for one of the descriptors, and then iterator over the other one, and check whethere the HashSet contains it.
…obust