-
Notifications
You must be signed in to change notification settings - Fork 475
Refactor hot methods #2811
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
Refactor hot methods #2811
Conversation
|
I have marked this as WIP since there is still work to be done here:
|
|
Sorry - this comment applies to #2812 Looking at the method in 'Key' the method that performs the equality check on a byte array |
Is this in relation to #2812? If so, do you think its worth investigating rearranging some of the comparisons made as mentioned in your comments here, or do you think #2812 should be closed? |
|
A few more methods were found (details). I'll look into those now, before this is merged. |
Never mind. Took a look and I don't think those methods will be changed in this PR. This PR is ready for review. |
|
I have refactored public boolean equals(Key other, PartialKey part) {
boolean result = isEqual(row, other.row);
if (part == ROW)
return result;
result &= isEqual(colFamily, other.colFamily);
if (part == ROW_COLFAM)
return result;
result &= isEqual(colQualifier, other.colQualifier);
if (part == ROW_COLFAM_COLQUAL)
return result;
result &= isEqual(colVisibility, other.colVisibility);
if (part == ROW_COLFAM_COLQUAL_COLVIS)
return result;
result &= (timestamp == other.timestamp);
if (part == ROW_COLFAM_COLQUAL_COLVIS_TIME)
return result;
result &= (deleted == other.deleted);
if (part == ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL)
return result;
throw new IllegalArgumentException("Unrecognized partial key specification " + part);
}It will fall through and compare each accumulo/core/src/main/java/org/apache/accumulo/core/data/Key.java Lines 977 to 1002 in 388d3ff
While this refactored method is smaller and no longer "hot", it should probably be determined if this has any significant performance hits which is what is being invstigated in #2812 |
|
Thanks for taking a look at these methods. I will take a look at this today. |
core/src/main/java/org/apache/accumulo/core/iteratorsImpl/system/LocalityGroupIterator.java
Show resolved
Hide resolved
milleruntime
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.
I am not sure if it makes a difference with the compiler but we have a bad habit of jamming static classes within another class. A lot of these could be pulled out into their own class.
server/tserver/src/main/java/org/apache/accumulo/tserver/TabletClientHandler.java
Outdated
Show resolved
Hide resolved
|
In 89a2f32 I added the equals method described above. This updated method does not appear on the hot methods list. |
# Conflicts: # server/tserver/src/main/java/org/apache/accumulo/tserver/scan/LookupTask.java
# Conflicts: # server/tserver/src/main/java/org/apache/accumulo/tserver/scan/LookupTask.java
|
@DomGarguilo is this PR ready to merge? If so, I can take another close look at it. |
Yes, I think I am done making changes here and was just waiting for someone to verify these changes. |
core/src/main/java/org/apache/accumulo/core/file/rfile/RelativeKey.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/accumulo/core/file/rfile/RelativeKey.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/accumulo/core/iteratorsImpl/system/LocalityGroupIterator.java
Outdated
Show resolved
Hide resolved
server/tserver/src/main/java/org/apache/accumulo/tserver/scan/LookupTask.java
Outdated
Show resolved
Hide resolved
server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Keith Turner <kturner@apache.org>
ctubbsii
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.
I didn't finish looking at all of this. I realized it may be easier to try to fix one thing at a time, rather than try to fix all hot methods in a single big PR. Smaller, more narrowly scoped PRs get reviewed and merged faster, and you can build on them incrementally with lower risk. And, there's less drift and merge conflicts when smaller PRs get merged faster.
core/src/main/java/org/apache/accumulo/core/spi/balancer/SimpleLoadBalancer.java
Show resolved
Hide resolved
Co-authored-by: Keith Turner <kturner@apache.org>
Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>
# Conflicts: # server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java
This reverts commit 59e8357.
In #1099 there are some lists of methods that have been reported as "hot method too big".
This PR refactors some of those methods to make them smaller. After these changes, the following methods are no longer reported as "hot method too big":
org.apache.accumulo.core.file.rfile.RelativeKey::<init>org.apache.accumulo.core.file.rfile.RelativeKey::readFieldsorg.apache.accumulo.server.fs.FileManager$ScanFileManager::openFilesThe following have been refactored to reduce size, but are still being reported:
org.apache.accumulo.core.iteratorsImpl.system.LocalityGroupIterator::_seekorg.apache.accumulo.tserver.scan.LookupTask::run