Skip to content

HBASE-28627 REST ScannerModel doesn't support includeStartRow/includeStopRow(addendum) #6499

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

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

chandrasekhar-188k
Copy link
Contributor

HBASE-28627 REST ScannerModel doesn't support includeStartRow/includeStopRow(addendum)

@@ -143,6 +145,13 @@ public void setIncludeStartRow(boolean includeStartRow) {
this.includeStartRow = includeStartRow;
}

private static class IncludeStartRowFIlter {
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo, should be IncludeStartRowFilter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@@ -121,8 +121,10 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
private boolean cacheBlocks = true;
private int limit = -1;

@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = IncludeStartRowFIlter.class)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need the filter for this and not for the stopRow ?
Wouldn't JsonInclude.Include.NON_DEFAULT work here the same ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, a Unit test to check this serialization behaviour would be helpful.

Copy link
Contributor

Choose a reason for hiding this comment

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

To make sure that it survives any later refactors, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like there is already a test, it just needs to be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do we need the filter for this and not for the stopRow ?

JsonInclude.Include.NON_DEFAULT --> this annotation serialize the attribute only if the attribute value is different from it's default value , ex: for boolean variables if the value is false(default) it will not get serialized, if the value is true it gets serialized.

Since includeStopRow is false by default we can use this annotation, where as includeStartRow is true by default, so we can't use this annotation because when the value is set to false this attribute will not get serialized and it will be giving wrong results in the response of scan request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like there is already a test, it just needs to be updated.

updated

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, I get it. I thought that the default referred to the enclosing type, not to the boolean primitive.

Copy link
Contributor

@stoty stoty left a comment

Choose a reason for hiding this comment

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

Please see my comments

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@chandrasekhar-188k
Copy link
Contributor Author

Please see my comments

review comments are fixed, pls check

@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
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 43s Docker mode activated.
-0 ⚠️ yetus 0m 4s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 2m 44s master passed
+1 💚 compile 0m 23s master passed
+1 💚 javadoc 0m 18s master passed
+1 💚 shadedjars 5m 11s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 2m 43s the patch passed
+1 💚 compile 0m 22s the patch passed
+1 💚 javac 0m 22s the patch passed
+1 💚 javadoc 0m 17s the patch passed
+1 💚 shadedjars 4m 55s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 3m 13s hbase-rest in the patch passed.
21m 52s
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6499/5/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR #6499
Optional Tests javac javadoc unit compile shadedjars
uname Linux 53a63a8ffb9b 5.4.0-200-generic #220-Ubuntu SMP Fri Sep 27 13:19:16 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 074f161
Default Java Eclipse Adoptium-17.0.11+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6499/5/testReport/
Max. process+thread count 2082 (vs. ulimit of 30000)
modules C: hbase-rest U: hbase-rest
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6499/5/console
versions git=2.34.1 maven=3.9.8
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 42s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
_ master Compile Tests _
+1 💚 mvninstall 2m 52s master passed
+1 💚 compile 0m 34s master passed
+1 💚 checkstyle 0m 11s master passed
+1 💚 spotbugs 0m 38s master passed
+1 💚 spotless 0m 44s branch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚 mvninstall 2m 40s the patch passed
+1 💚 compile 0m 33s the patch passed
+1 💚 javac 0m 33s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 11s the patch passed
+1 💚 spotbugs 0m 40s the patch passed
+1 💚 hadoopcheck 9m 39s Patch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚 spotless 0m 40s patch has no errors when running spotless:check.
_ Other Tests _
+1 💚 asflicense 0m 11s The patch does not generate ASF License warnings.
26m 20s
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6499/5/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #6499
Optional Tests dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
uname Linux ceef54b14c8b 5.4.0-200-generic #220-Ubuntu SMP Fri Sep 27 13:19:16 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 074f161
Default Java Eclipse Adoptium-17.0.11+9
Max. process+thread count 85 (vs. ulimit of 30000)
modules C: hbase-rest U: hbase-rest
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6499/5/console
versions git=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@chandrasekhar-188k
Copy link
Contributor Author

Please see my comments

review comments are fixed, pls check

@stoty review comments are addressed and the build is okay, please review the changes again

Copy link
Contributor

@stoty stoty left a comment

Choose a reason for hiding this comment

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

Basically fine, but could be more readable, please see my comments.

private static class IncludeStartRowFilter {
@Override
public boolean equals(Object value) {
return Boolean.TRUE.equals(value);
Copy link
Contributor

@stoty stoty Jan 9, 2025

Choose a reason for hiding this comment

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

Since this code is not performance critial, we could just check for the type and avoid the suppression:

if(value instanceOf Boolean) {
   return Boolean.TRUE.equals(value);
} else {
   return false;
}

Copy link
Contributor Author

@chandrasekhar-188k chandrasekhar-188k Jan 10, 2025

Choose a reason for hiding this comment

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

image

according to the documents EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS checks if we are doing an instanceof check on any thing other than the current class. in this case it is IncludeStartRowFilter.
the equals() implementation of Boolean class as below.
image
Since it is trying to check instanceof Boolean which is not in the Hierachy of IncludeStartRowFilter find bugs is reporting it as voilation.
I had tried your suggestion before, but it still fails due to above reason.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you love static checkers ?

OK, let's leave it like this.

return Boolean.TRUE.equals(value);
}

@Override
Copy link
Contributor

Choose a reason for hiding this comment

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

This is confusing, and I don't think this is necessary.

hashCode() is never called for for this object according to the docs.

Copy link
Contributor Author

@chandrasekhar-188k chandrasekhar-188k Jan 10, 2025

Choose a reason for hiding this comment

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

This is confusing, and I don't think this is necessary.

hashCode() is never called for for this object according to the docs.

hashCode is never called, I have added this dummy hashCode implementation as the spotbugs was complaining about the rule:
image
we can either supress the check or add a dummy hashCode implementation.

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case add the suppression instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

it's less bad.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR is updated with this change

Copy link
Contributor

@stoty stoty left a comment

Choose a reason for hiding this comment

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

+1 LGTM

Thank you

@stoty stoty merged commit 7134f29 into apache:master Jan 10, 2025
1 check was pending
ragarkar pushed a commit to ragarkar/hbase that referenced this pull request Jan 13, 2025
…StopRow (addendum) (apache#6499)

Signed-off-by: Istvan Toth <stoty@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.

3 participants