Skip to content

Conversation

@brfrn169
Copy link
Member

@brfrn169 brfrn169 commented Jul 18, 2020

  • Added a new method checkAndMutate(CheckAndMutate) to Region/HRegion and deprecated the old methods checkAndPut/checkAndDelete/checkAndRowMutate
  • Added new coprocessor methods preCheckAndMutate/preCheckAndMutateAfterRowLock/postCheckAndMutate to RegionObserver and deprecated the old coprocessor methods preCheckAndPut/preCheckAndPutAfterRowLock/postCheckAndPut/preCheckAndDelete/preCheckAndDeleteAfterRowLock/postCheckAndDelete
  • Added a new metric for checkAndMutate

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@brfrn169
Copy link
Member Author

brfrn169 commented Jul 22, 2020

@Apache9 Can you please review this when you get a chance?

Copy link
Member

@joshelser joshelser left a comment

Choose a reason for hiding this comment

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

Generally looks OK to me. I don't have a lot of experience in the new CheckAndMutate objects, though.


try {
if (mutations.size() == 1) {
if (mutations.get(0) instanceof Put) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: Mutation m = mutations.get(0) and then use m for the rest of this block.

*/
default CheckAndMutateResult preCheckAndMutate(ObserverContext<RegionCoprocessorEnvironment> c,
CheckAndMutate checkAndMutate, CheckAndMutateResult result) throws IOException {
if (checkAndMutate.getAction() instanceof Put) {
Copy link
Member

Choose a reason for hiding this comment

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

Every time I see this, I want to suggest you use a visitor pattern to reduce the boilerplate, but that would require putting more logic on Put/Delete which not worth it. 🤷

Copy link
Contributor

Choose a reason for hiding this comment

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

Put/Delete is public so let's not do this...

// checkAndMutate tests
// ////////////////////////////////////////////////////////////////////////////
@Test
@Deprecated
Copy link
Member

Choose a reason for hiding this comment

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

Probably don't need to mark deprecated tests in the future, but this is fine to leave, IMO.

@brfrn169
Copy link
Member Author

@joshelser Thank you very much for reviewing this!

I will wait for any other opinions/objections until tomorrow. If nothing, will commit this.

* Update checkAndMutate histogram
* @param t time it took
*/
void updateCheckAndMutate(long t);
Copy link
Contributor

Choose a reason for hiding this comment

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

After this change, do we still have checkAndPut and checkAndDelete?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. This change keeps the existing metrics for checkAndPut and checkAndDelete for backward compatibility. This change doesn't break the existing tests for the metrics for checkAndPut and checkAndDelete.

*/
default CheckAndMutateResult preCheckAndMutate(ObserverContext<RegionCoprocessorEnvironment> c,
CheckAndMutate checkAndMutate, CheckAndMutateResult result) throws IOException {
if (checkAndMutate.getAction() instanceof Put) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Put/Delete is public so let's not do this...

throw new DoNotRetryIOException(
"Unsupported mutate type: " + mutation.getClass().getSimpleName().toUpperCase());
}
} catch (IllegalArgumentException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do we throw this exception out? Catching a RuntimeException seems strange to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

CheckAndMutate.Builder.build() calls preCheck() internally and it can throw IllegalArgumentException if the parameters are invalid:

private void preCheck(Row action) {
Preconditions.checkNotNull(action, "action (Put/Delete/RowMutations) is null");
if (!Bytes.equals(row, action.getRow())) {
throw new IllegalArgumentException("The row of the action (Put/Delete/RowMutations) <" +
Bytes.toStringBinary(action.getRow()) + "> doesn't match the original one <" +
Bytes.toStringBinary(this.row) + ">");
}
Preconditions.checkState(op != null || filter != null, "condition is null. You need to"
+ " specify the condition by calling ifNotExists/ifEquals/ifMatches before building a"
+ " CheckAndMutate object");
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Then we'd better let the try catch for IllegalArgumentException only wrap the builder.build? And then we call checkAndMutate, without catching the IllegalArgumentException. I think this will be better to let others know why we may hit IllegalArgumentException.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, thanks. Will do that as your review.

throw new DoNotRetryIOException("Unsupported mutate type: " +
mutation.getClass().getSimpleName().toUpperCase());
}
} catch (IllegalArgumentException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

Copy link
Member Author

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

@Apache9 Thank you very much for taking a look at this!

I left some comments for your review. Can you please check them?

* Update checkAndMutate histogram
* @param t time it took
*/
void updateCheckAndMutate(long t);
Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. This change keeps the existing metrics for checkAndPut and checkAndDelete for backward compatibility. This change doesn't break the existing tests for the metrics for checkAndPut and checkAndDelete.

throw new DoNotRetryIOException(
"Unsupported mutate type: " + mutation.getClass().getSimpleName().toUpperCase());
}
} catch (IllegalArgumentException e) {
Copy link
Member Author

Choose a reason for hiding this comment

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

CheckAndMutate.Builder.build() calls preCheck() internally and it can throw IllegalArgumentException if the parameters are invalid:

private void preCheck(Row action) {
Preconditions.checkNotNull(action, "action (Put/Delete/RowMutations) is null");
if (!Bytes.equals(row, action.getRow())) {
throw new IllegalArgumentException("The row of the action (Put/Delete/RowMutations) <" +
Bytes.toStringBinary(action.getRow()) + "> doesn't match the original one <" +
Bytes.toStringBinary(this.row) + ">");
}
Preconditions.checkState(op != null || filter != null, "condition is null. You need to"
+ " specify the condition by calling ifNotExists/ifEquals/ifMatches before building a"
+ " CheckAndMutate object");
}

@brfrn169 brfrn169 requested a review from Apache9 July 24, 2020 10:08
@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@brfrn169
Copy link
Member Author

Not sure why QA was re-triggered.. The test failure in the last QA is not related to this patch because I ran the failed test locally and it was successful. Kicking QA again.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@brfrn169
Copy link
Member Author

Looks the QA is okay. Can you please take a look at this? @Apache9
Thanks.

@brfrn169
Copy link
Member Author

Ping @Apache9
Thanks.

throw new DoNotRetryIOException(
"Unsupported mutate type: " + mutation.getClass().getSimpleName().toUpperCase());
}
} catch (IllegalArgumentException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Then we'd better let the try catch for IllegalArgumentException only wrap the builder.build? And then we call checkAndMutate, without catching the IllegalArgumentException. I think this will be better to let others know why we may hit IllegalArgumentException.

Copy link
Contributor

@Apache9 Apache9 left a comment

Choose a reason for hiding this comment

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

+1.

Let's wait for the pre commit result.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 31s 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 _
+0 🆗 mvndep 0m 23s Maven dependency ordering for branch
+1 💚 mvninstall 3m 40s master passed
+1 💚 checkstyle 1m 59s master passed
+1 💚 spotbugs 3m 33s master passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 13s Maven dependency ordering for patch
+1 💚 mvninstall 3m 28s the patch passed
+1 💚 checkstyle 0m 13s The patch passed checkstyle in hbase-hadoop-compat
+1 💚 checkstyle 0m 32s The patch passed checkstyle in hbase-client
+1 💚 checkstyle 1m 13s hbase-server: The patch generated 0 new + 411 unchanged - 22 fixed = 411 total (was 433)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 11m 30s Patch does not cause any errors with Hadoop 3.1.2 3.2.1.
+1 💚 spotbugs 4m 0s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 37s The patch does not generate ASF License warnings.
39m 45s
Subsystem Report/Notes
Docker Client=19.03.12 Server=19.03.12 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #2094
Optional Tests dupname asflicense spotbugs hadoopcheck hbaseanti checkstyle
uname Linux e37a88cd64b6 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 7c4d66a
Max. process+thread count 94 (vs. ulimit of 12500)
modules C: hbase-hadoop-compat hbase-client hbase-server U: .
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) spotbugs=3.1.12
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 30s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗 mvndep 0m 37s Maven dependency ordering for branch
+1 💚 mvninstall 3m 26s master passed
+1 💚 compile 1m 39s master passed
+1 💚 shadedjars 5m 34s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 1m 19s master passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 16s Maven dependency ordering for patch
+1 💚 mvninstall 3m 26s the patch passed
+1 💚 compile 1m 38s the patch passed
+1 💚 javac 1m 38s the patch passed
+1 💚 shadedjars 5m 28s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 1m 17s the patch passed
_ Other Tests _
+1 💚 unit 0m 33s hbase-hadoop-compat in the patch passed.
+1 💚 unit 1m 6s hbase-client in the patch passed.
+1 💚 unit 140m 38s hbase-server in the patch passed.
170m 11s
Subsystem Report/Notes
Docker Client=19.03.12 Server=19.03.12 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #2094
Optional Tests javac javadoc unit shadedjars compile
uname Linux 442c00b3f615 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 7c4d66a
Default Java 1.8.0_232
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/testReport/
Max. process+thread count 4281 (vs. ulimit of 12500)
modules C: hbase-hadoop-compat hbase-client hbase-server U: .
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f)
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 3m 54s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗 mvndep 0m 26s Maven dependency ordering for branch
+1 💚 mvninstall 5m 3s master passed
+1 💚 compile 2m 12s master passed
+1 💚 shadedjars 7m 12s branch has no errors when building our shaded downstream artifacts.
-0 ⚠️ javadoc 1m 1s hbase-client in master failed.
-0 ⚠️ javadoc 0m 21s hbase-hadoop-compat in master failed.
-0 ⚠️ javadoc 0m 47s hbase-server in master failed.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 16s Maven dependency ordering for patch
+1 💚 mvninstall 5m 8s the patch passed
+1 💚 compile 2m 8s the patch passed
+1 💚 javac 2m 8s the patch passed
+1 💚 shadedjars 6m 42s patch has no errors when building our shaded downstream artifacts.
-0 ⚠️ javadoc 0m 20s hbase-hadoop-compat in the patch failed.
-0 ⚠️ javadoc 0m 30s hbase-client in the patch failed.
-0 ⚠️ javadoc 0m 48s hbase-server in the patch failed.
_ Other Tests _
+1 💚 unit 0m 40s hbase-hadoop-compat in the patch passed.
+1 💚 unit 1m 15s hbase-client in the patch passed.
-1 ❌ unit 217m 12s hbase-server in the patch failed.
258m 45s
Subsystem Report/Notes
Docker Client=19.03.12 Server=19.03.12 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #2094
Optional Tests javac javadoc unit shadedjars compile
uname Linux e3442270b2fe 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 7c4d66a
Default Java 2020-01-14
javadoc https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/artifact/yetus-jdk11-hadoop3-check/output/branch-javadoc-hbase-client.txt
javadoc https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/artifact/yetus-jdk11-hadoop3-check/output/branch-javadoc-hbase-hadoop-compat.txt
javadoc https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/artifact/yetus-jdk11-hadoop3-check/output/branch-javadoc-hbase-server.txt
javadoc https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/artifact/yetus-jdk11-hadoop3-check/output/patch-javadoc-hbase-hadoop-compat.txt
javadoc https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/artifact/yetus-jdk11-hadoop3-check/output/patch-javadoc-hbase-client.txt
javadoc https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/artifact/yetus-jdk11-hadoop3-check/output/patch-javadoc-hbase-server.txt
unit https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/artifact/yetus-jdk11-hadoop3-check/output/patch-unit-hbase-server.txt
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/testReport/
Max. process+thread count 3642 (vs. ulimit of 12500)
modules C: hbase-hadoop-compat hbase-client hbase-server U: .
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2094/4/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f)
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

@brfrn169
Copy link
Member Author

brfrn169 commented Aug 1, 2020

I don' think the test failure in the last QA is related to this patch. I ran the failed tests locally and it was successful. Will merge this PR.

@brfrn169 brfrn169 merged commit e22a2d2 into apache:master Aug 1, 2020
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