-
Notifications
You must be signed in to change notification settings - Fork 21
CNDB-15620: Fix sstablesHit and segmentsHit metrics to be updated by ANN and generic OrderBy #2115
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
base: main
Are you sure you want to change the base?
Conversation
…ANN and generic OrderBy
Checklist before you submit for review
|
|
This is ready for review, the test coverage complains about two assertions not being covered, but that would be a bug, so I think we are good from test coverage perspective. The only test failure has actually a ticket for the same one. It does not fail locally and I keep on seeing it also on other PRs today. |
| int limit, | ||
| long totalRows) throws IOException | ||
| { | ||
| context.checkpoint(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to checkpoint? Not saying we don't, just asking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is we do it because if the query already timed out, we do not need really to update the metrics.
Also, the same approach was taken with the place where we were already updating the metric, so I think we should also stay consistent. Does this make sense?
| context.checkpoint(); | ||
| context.addSstablesHit(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem hit by any query in SlowSAIQueryLoggerTest, the test passes without this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be validated with:
// Disable query optimizer to prevent skipping hybrid query logic.
node.runOnInstance(() -> QueryController.QUERY_OPT_LEVEL = 0);
long mark = node.logs().mark();
coordinator.execute(hybridQuery, ConsistencyLevel.ONE);
assertLogsContain(mark, node,
"SAI slow query metrics:",
"sstablesHit: 2",
"segmentsHit: 2",
"partitionsRead: 3",
"rowsFiltered: 3",
"rowsPreFiltered: 0",
"trieSegmentsHit: 0",
"bkdPostingListsHit: 1",
"bkdSegmentsHit: 1",
"bkdPostingsSkips: 0",
"bkdPostingsDecodes: 4",
"triePostingsSkips: 0",
"triePostingsDecodes: 0",
"annGraphSearchLatencyNanos: 0",
"shadowedPrimaryKeyCount: 0",
"SAI slow query plan:",
"KeysSort",
"NumericIndexScan");There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I have been checking with breakpoints, that is how I added the other query. Let me take a look, maybe I did not commit something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I missed the second comment, thanks for adding that. I will add it to the test, not sure what happened that I missed it.
test/distributed/org/apache/cassandra/distributed/test/sai/SlowSAIQueryLoggerTest.java
Outdated
Show resolved
Hide resolved
…wSAIQueryLoggerTest and test the metric update fix for that method
|
✔️ Build ds-cassandra-pr-gate/PR-2115 approved by ButlerApproved by Butler |



…
What is the issue
...
SAI sstablesHit and segmentsHit metrics are not updated by ANN and generic ORDER BY
What does this PR fix and why was it fixed
...
Fix sstablesHit and segmentsHit metrics to be updated by ANN and generic OrderBy