Skip to content

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

Merged
stoty merged 1 commit into
apache:masterfrom
chandrasekhar-188k:br_HBASE-28627_fix
Jan 10, 2025
Merged

HBASE-28627 REST ScannerModel doesn't support includeStartRow/includeStopRow(addendum)#6499
stoty merged 1 commit into
apache:masterfrom
chandrasekhar-188k:br_HBASE-28627_fix

Conversation

@chandrasekhar-188k

Copy link
Copy Markdown
Contributor

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

this.includeStartRow = includeStartRow;
}

private static class IncludeStartRowFIlter {

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

updated

private boolean cacheBlocks = true;
private int limit = -1;

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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.

@stotystoty left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 43sDocker mode activated.
-0 ⚠️yetus0m 4sUnprocessed 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 💚mvninstall2m 44smaster passed
+1 💚compile0m 23smaster passed
+1 💚javadoc0m 18smaster passed
+1 💚shadedjars5m 11sbranch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚mvninstall2m 43sthe patch passed
+1 💚compile0m 22sthe patch passed
+1 💚javac0m 22sthe patch passed
+1 💚javadoc0m 17sthe patch passed
+1 💚shadedjars4m 55spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚unit3m 13shbase-rest in the patch passed.
21m 52s
SubsystemReport/Notes
DockerClientAPI=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 Testsjavac javadoc unit compile shadedjars
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 074f161
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6499/5/testReport/
Max. process+thread count2082 (vs. ulimit of 30000)
modulesC: hbase-rest U: hbase-rest
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6499/5/console
versionsgit=2.34.1 maven=3.9.8
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 42sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+0 🆗codespell0m 0scodespell was not available.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
_ master Compile Tests _
+1 💚mvninstall2m 52smaster passed
+1 💚compile0m 34smaster passed
+1 💚checkstyle0m 11smaster passed
+1 💚spotbugs0m 38smaster passed
+1 💚spotless0m 44sbranch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚mvninstall2m 40sthe patch passed
+1 💚compile0m 33sthe patch passed
+1 💚javac0m 33sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 11sthe patch passed
+1 💚spotbugs0m 40sthe patch passed
+1 💚hadoopcheck9m 39sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚spotless0m 40spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense0m 11sThe patch does not generate ASF License warnings.
26m 20s
SubsystemReport/Notes
DockerClientAPI=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 Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 074f161
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count85 (vs. ulimit of 30000)
modulesC: hbase-rest U: hbase-rest
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6499/5/console
versionsgit=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@chandrasekhar-188k

Copy link
Copy Markdown
ContributorAuthor

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

@stotystoty left a comment

Copy link
Copy Markdown
Contributor

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);

@stotystotyJan 9, 2025

Copy link
Copy Markdown
Contributor

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;
}

@chandrasekhar-188kchandrasekhar-188kJan 10, 2025

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
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.

@chandrasekhar-188kchandrasekhar-188kJan 10, 2025

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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

@stotystoty left a comment

Copy link
Copy Markdown
Contributor

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:masterJan 10, 2025
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 freeto 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

@chandrasekhar-188k@Apache-HBase@stoty