-
Notifications
You must be signed in to change notification settings - Fork 117
Add more logs for UnableToPlanException #3766
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
| * @return this exception for chaining | ||
| */ | ||
| @Nonnull | ||
| public UnableToPlanException withPlanCacheInfo(@Nullable String planCacheInfo) { |
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 class should not have anything in it referring to upper layers. The match candidates are fine and needed.
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.
removed planCacheInfo from UnableToPlanException, log it directly in PlanGenerator.
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.
and also removed connectionOptionsInfo and log it directly in PlanGenerator.
| */ | ||
| @Nonnull | ||
| public UnableToPlanException withPlanCacheInfo(@Nullable String planCacheInfo) { | ||
| this.planCacheInfo = planCacheInfo; |
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.
Let's not have this mutable.
| matchCandidatesBuilder.append(" (none)"); | ||
| } else { | ||
| for (final var candidate : matchCandidates) { | ||
| matchCandidatesBuilder.append(String.format(" - %s%n", candidate.toString())); |
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.
Are we fine with just logging the kind of index and the index name here? candidate.toString() in ValueIndexScanMatchCandidate is implemented in a way that would print:
value[someIndexName]
Should we rather just add the MatchCandidates themselves here? In that way the consumer can decide what to do with them.
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.
what functions of MatchCandidate shows the complete graph? I added some more info in here, but not sure if that is enough.
| } catch (UnableToPlanException e) { | ||
| if (logger.isErrorEnabled()) { | ||
| final var logBuilder = KeyValueLogMessage.build("Unable to plan query", | ||
| "recordMetadata", metaData.toString(), |
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 one does not have a toString() unless I missed that.
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.
replace it with toProto().toString().
| planContext.getConstantActionFactory(), planContext.getDbUri(), caseSensitive) | ||
| .generateLogicalPlan(ast.getParseTree())); | ||
| return maybePlan.optimize(planner, planContext, currentPlanHashMode); | ||
| } catch (UnableToPlanException e) { |
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.
Can you please add a test for this? we should test cases where:
- we do not have cache.
- we have cache but cold.
- we have cache that is warm.
| // Attach connection options information to the exception | ||
| final var optionsBuilder = new StringBuilder("Connection Options:\n"); | ||
| for (final var entry : options.entries()) { | ||
| optionsBuilder.append(String.format(" %s = %s%n", entry.getKey(), entry.getValue())); |
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.
If I am not mistaken, some values can be null, is that ok for the StringBuilder?
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.
good catch, log string null when it is null.
| @@ -0,0 +1,106 @@ | |||
| /* | |||
| * UnableToPlanExceptionTest.java | |||
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.
These tests may be useful, but they seem a bit superficial to me, can we add integration tests where we verify the exception's behavior in a real scenario where the planner fails to plan? please see my other comment.
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.
yes this test was actually added to meet TeamScale requirement, added a test around plan cache.
No description provided.