Skip to content
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

HBASE-25364 Redo the getMidPoint() in HFileWriterImpl to get rid of t… #2741

Merged
merged 1 commit into from
Feb 10, 2021

Conversation

GeorryHuang
Copy link
Contributor

…he double comparison process

There is a TODO like this "TODO: Redo so only a single pass over the arrays rather than one to compare and then a second composing midpoint." in getMidpoint() of class ​HFileWriteImpl​

The old logic compares the left byte array and the right byte array twice:

  1. A comparison is performed before composing MinimumMidpointArray
  2. During composing of MinimumMidpointArray, bytes were comparing again

My optimization combines them into one

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 8s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 4m 9s master passed
+1 💚 checkstyle 1m 12s master passed
+1 💚 spotbugs 2m 11s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 47s the patch passed
-0 ⚠️ checkstyle 1m 9s hbase-server: The patch generated 2 new + 5 unchanged - 0 fixed = 7 total (was 5)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 19m 7s Patch does not cause any errors with Hadoop 3.1.2 3.2.1 3.3.0.
+1 💚 spotbugs 2m 18s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 13s The patch does not generate ASF License warnings.
43m 5s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2741/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #2741
Optional Tests dupname asflicense spotbugs hadoopcheck hbaseanti checkstyle
uname Linux c64fb3ef40e9 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 7d0a687
checkstyle https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2741/1/artifact/yetus-general-check/output/diff-checkstyle-hbase-server.txt
Max. process+thread count 84 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2741/1/console
versions git=2.17.1 maven=3.6.3 spotbugs=3.1.12
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 6s Docker mode activated.
-0 ⚠️ yetus 0m 4s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 17s master passed
+1 💚 compile 1m 5s master passed
+1 💚 shadedjars 6m 42s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 42s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 4m 1s the patch passed
+1 💚 compile 1m 4s the patch passed
+1 💚 javac 1m 4s the patch passed
+1 💚 shadedjars 6m 35s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 38s the patch passed
_ Other Tests _
+1 💚 unit 137m 39s hbase-server in the patch passed.
165m 53s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2741/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #2741
Optional Tests javac javadoc unit shadedjars compile
uname Linux 4e341520fd43 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 7d0a687
Default Java AdoptOpenJDK-11.0.6+10
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2741/1/testReport/
Max. process+thread count 4231 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2741/1/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 6s Docker mode activated.
-0 ⚠️ yetus 0m 2s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 12s master passed
+1 💚 compile 0m 59s master passed
+1 💚 shadedjars 7m 10s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 39s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 50s the patch passed
+1 💚 compile 1m 0s the patch passed
+1 💚 javac 1m 0s the patch passed
+1 💚 shadedjars 7m 9s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 36s the patch passed
_ Other Tests _
+1 💚 unit 204m 1s hbase-server in the patch passed.
232m 29s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2741/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #2741
Optional Tests javac javadoc unit shadedjars compile
uname Linux 0e740dfd9e37 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 7d0a687
Default Java AdoptOpenJDK-1.8.0_232-b09
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2741/1/testReport/
Max. process+thread count 3241 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2741/1/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

}
}
return minMidpoint;
//Note that left[diffIdx] can never be equal to 0xff since left < right
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here is different from original?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic of composing midPoint is basically the same, with some small differences

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(diffByte + 1) < (ByteBufferUtils.toByte(right, rightOffset + diffIdx) & 0xff)
I think this logical branch is lost

byte[] minimumMidpointArray = new byte[minLength + 1];
ByteBufferUtils
.copyFromBufferToArray(minimumMidpointArray, right, rightOffset, 0, minLength + 1);
minimumMidpointArray[minLength] = 0x00;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is different from original?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I made some adjustments.

Copy link
Contributor

@saintstack saintstack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skimmed. I like your addition of extra boundary checking test. LGTM.

@@ -366,8 +366,6 @@ private void finishBlock() throws IOException {
*/
public static Cell getMidpoint(final CellComparator comparator, final Cell left,
final Cell right) {
// TODO: Redo so only a single pass over the arrays rather than one to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From HBASE-10800 ... By our Ramkrishna

@GeorryHuang
Copy link
Contributor Author

@saintstack Thanks for reviewing

@saintstack
Copy link
Contributor

@nyl3532016 You good w/ this change? If so, would like to add you as a sign-off. Thanks.

@nyl3532016
Copy link
Contributor

@nyl3532016 You good w/ this change? If so, would like to add you as a sign-off. Thanks.

@saintstack, I am good with the patch after @GeorryHuang amend a bit

@saintstack saintstack merged commit 3e743df into apache:master Feb 10, 2021
saintstack pushed a commit that referenced this pull request Feb 10, 2021
…he double comparison process (#2741)

Signed-off-by: niuyulin <nyl353@163.com>
Signed-off-by: stack <stack@apache.org>
ddupg pushed a commit to ddupg/hbase that referenced this pull request Feb 19, 2021
…he double comparison process (apache#2741)

Signed-off-by: niuyulin <nyl353@163.com>
Signed-off-by: stack <stack@apache.org>
wchevreuil pushed a commit to wchevreuil/hbase that referenced this pull request Feb 24, 2021
…he double comparison process (apache#2741)

Signed-off-by: niuyulin <nyl353@163.com>
Signed-off-by: stack <stack@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants