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-29090: Add server-side load metrics to client results #6623

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hgromer
Copy link
Contributor

@hgromer hgromer commented Jan 21, 2025

No description provided.

@hgromer
Copy link
Contributor Author

hgromer commented Jan 21, 2025

cc @rmdmattingly @krconv @ndimiduk

@Apache-HBase

This comment has been minimized.

Copy link

@krconv krconv left a comment

Choose a reason for hiding this comment

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

This will be very useful! Just some nitpicks, feel free to ignore

@@ -274,6 +278,7 @@ message Scan {
}
optional ReadType readType = 23 [default = DEFAULT];
optional bool need_cursor_result = 24 [default = false];
optional bool resultMetricsEnabled = 25 [default = false];
Copy link

Choose a reason for hiding this comment

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

Nit; enable_result_metrics matches the existing fields better (and same note for other protobuf changes)

Suggested change
optional bool resultMetricsEnabled = 25 [default = false];
optional bool enable_result_metrics = 25 [default = false];

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. this file has both camel & snake case littered everywhere I should probably avoid adding additional inconsistencies

* Statistics about the Result's server-side metrics
*/
message ResultMetrics {
required uint64 blockBytesScanned = 1;
Copy link

Choose a reason for hiding this comment

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

Not sure what the standard is for HBase, but I know that optional values with a default are more future proof than required fields, and I think that would be better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wasn't familiar with the move away from required fields, I'm happy to make this optional.

@@ -1434,6 +1439,10 @@ public static ClientProtos.Result toResult(final Result result, boolean encodeTa
builder.setStale(result.isStale());
builder.setPartial(result.mayHaveMoreCellsInRow());

if (result.getMetrics() != null) {
Copy link

Choose a reason for hiding this comment

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

Seems like the result metrics will get lost for exists calls; thoughts on handling that more explicitly? Maybe throwing an error if someone tries to enable metrics on an Get with checkExistenceOnly == true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Throwing an error might be a bit aggressive, though I'd be curious to know what others think. I'm not sure if we're happy throwing an unchecked exception from setCheckExistenceOnly and if we wanted to throw an IOException, we'd have to change the signature.

Maybe it's enough that the metics returned will be null

@@ -95,6 +95,7 @@ public Get(Get get) {
this.setFilter(get.getFilter());
this.setReplicaId(get.getReplicaId());
this.setConsistency(get.getConsistency());
this.setResultMetricsEnabled(get.isResultMetricsEnabled());
Copy link

Choose a reason for hiding this comment

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

Nit; Thoughts on the name QueryMetrics? I think that ResultMetrics could be interpreted as "metrics about the result" instead of "metrics about the query operation"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Query metrics makes sense, I mostly just wanted a way to distinguish between the existing scan metrics, and these new metrics

@@ -3425,6 +3438,12 @@ private void scan(HBaseRpcController controller, ScanRequest request, RegionScan
}
boolean mayHaveMoreCellsInRow = scannerContext.mayHaveMoreCellsInRow();
Result r = Result.create(values, null, stale, mayHaveMoreCellsInRow);

if (request.getScan().getResultMetricsEnabled()) {
Copy link

Choose a reason for hiding this comment

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

What's the reason for not directly setting it on the result for scans?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question, scans are a bit tricky just due to how the results are constructed on the client side. you can take a look at how the response converter builds these responses. They're created from the cells, so we need to send the metrics separately through the wire in this case and hydrate them client-side.

@Apache-HBase

This comment has been minimized.

@hgromer hgromer force-pushed the HBASE-29090 branch 2 times, most recently from 3d96194 to 8680147 Compare January 22, 2025 13:55
@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@hgromer
Copy link
Contributor Author

hgromer commented Jan 22, 2025

I'm actively working through the unit test failures that come up

@Apache-HBase

This comment has been minimized.

@rmdmattingly rmdmattingly requested a review from ndimiduk January 22, 2025 19:06
@Apache-HBase

This comment has been minimized.

@@ -44,21 +44,21 @@ public void itSerializesScan() {
Scan scan = new Scan();
scan.withStartRow(Bytes.toBytes(123));
scan.withStopRow(Bytes.toBytes(456));
String expectedOutput =
"{\n" + " \"startTime\": 1,\n" + " \"processingTime\": 2,\n" + " \"queueTime\": 3,\n"
Copy link
Contributor Author

@hgromer hgromer Jan 22, 2025

Choose a reason for hiding this comment

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

it seems like adding a field completely changed the order of the serialized fields. all I did here was add the queryMetricsEnabled field

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 30s 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.
+0 🆗 buf 0m 0s buf was not available.
+0 🆗 buf 0m 0s buf 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 _
+0 🆗 mvndep 0m 11s Maven dependency ordering for branch
+1 💚 mvninstall 3m 20s master passed
+1 💚 compile 4m 53s master passed
+1 💚 checkstyle 0m 56s master passed
+1 💚 spotbugs 4m 26s master passed
+1 💚 spotless 0m 44s branch has no errors when running spotless:check.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 11s Maven dependency ordering for patch
+1 💚 mvninstall 3m 6s the patch passed
+1 💚 compile 4m 26s the patch passed
+1 💚 cc 4m 26s the patch passed
+1 💚 javac 4m 26s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 56s the patch passed
+1 💚 spotbugs 4m 52s the patch passed
+1 💚 hadoopcheck 11m 33s Patch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚 hbaseprotoc 1m 34s the patch passed
+1 💚 spotless 0m 46s patch has no errors when running spotless:check.
_ Other Tests _
+1 💚 asflicense 0m 26s The patch does not generate ASF License warnings.
50m 21s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6623/4/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #6623
JIRA Issue HBASE-29090
Optional Tests dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless cc buflint bufcompat hbaseprotoc
uname Linux e3d2b3774954 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 8c9224f
Default Java Eclipse Adoptium-17.0.11+9
Max. process+thread count 86 (vs. ulimit of 30000)
modules C: hbase-protocol-shaded hbase-client hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6623/4/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.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 31s Docker mode activated.
-0 ⚠️ yetus 0m 2s 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 _
+0 🆗 mvndep 0m 23s Maven dependency ordering for branch
+1 💚 mvninstall 2m 57s master passed
+1 💚 compile 1m 45s master passed
+1 💚 javadoc 0m 52s master passed
+1 💚 shadedjars 5m 42s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 12s Maven dependency ordering for patch
+1 💚 mvninstall 2m 53s the patch passed
+1 💚 compile 1m 48s the patch passed
+1 💚 javac 1m 48s the patch passed
+1 💚 javadoc 0m 52s the patch passed
+1 💚 shadedjars 5m 37s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 0m 34s hbase-protocol-shaded in the patch passed.
+1 💚 unit 1m 34s hbase-client in the patch passed.
+1 💚 unit 208m 20s hbase-server in the patch passed.
238m 18s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6623/4/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR #6623
JIRA Issue HBASE-29090
Optional Tests javac javadoc unit compile shadedjars
uname Linux 4c7a4bd843f0 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 8c9224f
Default Java Eclipse Adoptium-17.0.11+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6623/4/testReport/
Max. process+thread count 5003 (vs. ulimit of 30000)
modules C: hbase-protocol-shaded hbase-client hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6623/4/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.

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