Skip to content

HBASE-28627 REST ScannerModel doesn't support includeStartRow/include… - #6374

Merged
stoty merged 1 commit into
apache:masterfrom
chandrasekhar-188k:br_HBASE-28627
Nov 27, 2024
Merged

HBASE-28627 REST ScannerModel doesn't support includeStartRow/include…#6374
stoty merged 1 commit into
apache:masterfrom
chandrasekhar-188k:br_HBASE-28627

Conversation

@chandrasekhar-188k

Copy link
Copy Markdown
Contributor

…StopRow

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@stoty

Copy link
Copy Markdown
Contributor

Thank you.

The thorny issue here backwards-forward compatibility.

i.e. What happens if a client without this patch tries to run a scan on server with this change, and vice versa, with all three (json,xml,protobuf) encodings.

Unfortnuately, the easiest way to test that is bringing up an old/new cluster (can be a single process one), and trying a scan with the new/old client manually for all six cases.

To be clear, it's fine for the old server to fail when the new parameters are set, but it should work if they are not set, or are at the default value.

@chandrasekhar-188k

Copy link
Copy Markdown
ContributorAuthor

Thank you.

The thorny issue here backwards-forward compatibility.

i.e. What happens if a client without this patch tries to run a scan on server with this change, and vice versa, with all three (json,xml,protobuf) encodings.

Unfortnuately, the easiest way to test that is bringing up an old/new cluster (can be a single process one), and trying a scan with the new/old client manually for all six cases.

To be clear, it's fine for the old server to fail when the new parameters are set, but it should work if they are not set, or are at the default value.

i have tested for JSON with new server and new/old clients, i will test for other combinations also and update the test results.

@chandrasekhar-188k

chandrasekhar-188k commented Nov 10, 2024

Copy link
Copy Markdown
ContributorAuthor

i.e. What happens if a client without this patch tries to run a scan on server with this change, and vice versa, with all three (json,xml,protobuf) encodings.

I have tested for all the combinations and results are fine.

REST_Scan.ods
image

@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.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+0 🆗codespell0m 0scodespell was not available.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+0 🆗buf0m 0sbuf was not available.
+0 🆗buf0m 0sbuf 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 💚mvninstall3m 16smaster passed
+1 💚compile0m 45smaster passed
+1 💚checkstyle0m 16smaster passed
+1 💚spotbugs0m 57smaster passed
+1 💚spotless1m 5sbranch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚mvninstall3m 34sthe patch passed
+1 💚compile0m 43sthe patch passed
+1 💚cc0m 43sthe patch passed
-0 ⚠️javac0m 43s/results-compile-javac-hbase-rest.txthbase-rest generated 2 new + 183 unchanged - 0 fixed = 185 total (was 183)
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 12sthe patch passed
+1 💚spotbugs0m 54sthe patch passed
+1 💚hadoopcheck12m 22sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚hbaseprotoc0m 26sthe patch passed
+1 💚spotless0m 54spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense0m 11sThe patch does not generate ASF License warnings.
33m 58s
SubsystemReport/Notes
DockerClientAPI=1.47 ServerAPI=1.47 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6374/3/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6374
Optional Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless cc buflint bufcompat hbaseprotoc
unameLinux 4c1f57507408 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 / 2d3a36d
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count84 (vs. ulimit of 30000)
modulesC: hbase-rest U: hbase-rest
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6374/3/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.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 41sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed 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 💚mvninstall3m 2smaster passed
+1 💚compile0m 23smaster passed
+1 💚javadoc0m 19smaster passed
+1 💚shadedjars5m 22sbranch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚mvninstall2m 52sthe patch passed
+1 💚compile0m 24sthe patch passed
+1 💚javac0m 24sthe patch passed
+1 💚javadoc0m 18sthe patch passed
+1 💚shadedjars5m 13spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚unit3m 39shbase-rest in the patch passed.
23m 18s
SubsystemReport/Notes
DockerClientAPI=1.47 ServerAPI=1.47 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6374/3/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6374
Optional Testsjavac javadoc unit compile shadedjars
unameLinux 9ea8555c21e5 5.4.0-195-generic #215-Ubuntu SMP Fri Aug 2 18:28:05 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 2d3a36d
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6374/3/testReport/
Max. process+thread count1542 (vs. ulimit of 30000)
modulesC: hbase-rest U: hbase-rest
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6374/3/console
versionsgit=2.34.1 maven=3.9.8
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@stoty

stoty commented Nov 25, 2024

Copy link
Copy Markdown
Contributor

Thanks.

Can you please do a backport PR for branch-2 @chandrasekhar-188k ?

@chandrasekhar-188k

Copy link
Copy Markdown
ContributorAuthor

Thanks.

Can you please do a backport PR for branch-2 @chandrasekhar-188k ?

okay

@chandrasekhar-188k

Copy link
Copy Markdown
ContributorAuthor

Thanks.

Can you please do a backport PR for branch-2 @chandrasekhar-188k ?

backport PR raised for branch-2, please review
#6494

@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

@stoty
stoty merged commit f9ec1dc into apache:masterNov 27, 2024
@stoty

stoty commented Nov 27, 2024

Copy link
Copy Markdown
Contributor

After commiting this (a little late), I realized that I have more questions:

I see this annotation on ScannerModel:

@JsonInclude(JsonInclude.Include.NON_NULL)

and

private boolean includeStartRow = true;

private boolean includeStopRow = false;

Doesn't that mean that the new attributes will get serialized regardless of their values to JSON,
and cause the deserialization in the old server to fail ?

You matrix shows this as passing, but I can't see how that can happen.
Does JSON skip serializing the default values ?

@chandrasekhar-188k

chandrasekhar-188k commented Nov 27, 2024

Copy link
Copy Markdown
ContributorAuthor

After commiting this (a little late), I realized that I have more questions:

I see this annotation on ScannerModel:

@JsonInclude(JsonInclude.Include.NON_NULL)

and

private boolean includeStartRow = true;
private boolean includeStopRow = false;

Doesn't that mean that the new attributes will get serialized regardless of their values to JSON, and cause the deserialization in the old server to fail ?

You matrix shows this as passing, but I can't see how that can happen. Does JSON skip serializing the default values ?

you are correct, when we serialize the ScannerModel the new attributes are also included and causing the deserilization to fail at old server.
when I tested for JSON I have construcuted the JSON message manually with the required fields, instead of Converting the ScannerModel to JSON, that's why my test was ok.
For XML and protobuff I had tested with Conversion of ScannerModel object to the required mime type, so no problem here.

For solving the issue wrt JSON, I think we can have two approaches

  1. change the class level JSON include annotation to @JsonInclude(JsonInclude.Include.NON_DEFAULT), so that it doesn't serialize the default values. This can work with out any functional impact only if the default values of ScannerModel and Scan Class are in sync always.. but currently I could see the default values for some fields are different between ScannerModel and Scan.
  2. For the newly introduced attributes add a custom JSON include annotation with a filter class that skips serialization of a field if the field has default value set to it.
    ex:
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = MaskingFilter.class)
private boolean includeStartRow = true;
static class MaskingFilter {
public boolean equals(Object value){
return Boolean.TRUE.equals(value);
}
}

I think the 2nd approach is better for this. I will raise an addendum PR for this..Let me know if you have any other suggestions..

stoty pushed a commit that referenced this pull request Nov 28, 2024
…StopRow (#6374)
Signed-off-by: Istvan Toth <stoty@apache.org>
(cherry picked from commit f9ec1dc)
@chandrasekhar-188k

Copy link
Copy Markdown
ContributorAuthor

After commiting this (a little late), I realized that I have more questions:
I see this annotation on ScannerModel:

@JsonInclude(JsonInclude.Include.NON_NULL)

and

private boolean includeStartRow = true;
private boolean includeStopRow = false;

Doesn't that mean that the new attributes will get serialized regardless of their values to JSON, and cause the deserialization in the old server to fail ?
You matrix shows this as passing, but I can't see how that can happen. Does JSON skip serializing the default values ?

you are correct, when we serialize the ScannerModel the new attributes are also included and causing the deserilization to fail at old server. when I tested for JSON I have construcuted the JSON message manually with the required fields, instead of Converting the ScannerModel to JSON, that's why my test was ok. For XML and protobuff I had tested with Conversion of ScannerModel object to the required mime type, so no problem here.

For solving the issue wrt JSON, I think we can have two approaches

  1. change the class level JSON include annotation to @JsonInclude(JsonInclude.Include.NON_DEFAULT), so that it doesn't serialize the default values. This can work with out any functional impact only if the default values of ScannerModel and Scan Class are in sync always.. but currently I could see the default values for some fields are different between ScannerModel and Scan.
  2. For the newly introduced attributes add a custom JSON include annotation with a filter class that skips serialization of a field if the field has default value set to it.
    ex:
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = MaskingFilter.class)
private boolean includeStartRow = true;
static class MaskingFilter {
public boolean equals(Object value){
return Boolean.TRUE.equals(value);
}
}

I think the 2nd approach is better for this. I will raise an addendum PR for this..Let me know if you have any other suggestions..

addendum PR raised for this fix, Please review
#6499

Comment on lines +139 to +140
@DefaultValue("true") @QueryParam(Constants.SCAN_INCLUDE_START_ROW) boolean includeStartRow,
@DefaultValue("false") @QueryParam(Constants.SCAN_INCLUDE_STOP_ROW) boolean includeStopRow) {

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.

I know that this is PR is already merged but maybe it would make sense to also log these new parameters in the trace log statement a bit below. Maybe this could be added in the followup PR: #6499

What do you think @chandrasekhar-188k ?

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.

@PDavid ,
I have missed to check this.
#6499 is already merged. I will raise another PR for this change

@stoty

stoty commented Dec 6, 2024

Copy link
Copy Markdown
Contributor

Can you fix the test and answer my question question by mid next week @chandrasekhar-188k ?

I don't want to start the winter holidays with the unfixed compatibility issue, so if we cannot fix that, I will temporarily revert the patch until the compatibility issue can be fixed.

gvprathyusha6 pushed a commit to gvprathyusha6/hbase that referenced this pull request Dec 19, 2024
…StopRow (apache#6374)
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.

4 participants

@chandrasekhar-188k@Apache-HBase@stoty@PDavid