-
Notifications
You must be signed in to change notification settings - Fork 934
Do not cache ExpandedQueryExpression query plan if it's based on not cacheable query expression #2300
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
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
So the current issue is due to the way DML query is prepared in selectPartOfUpdateQuery.Select(x => new Dictionary<string, object>()
{
{"propertyPath1", updateValue1},
....
}; The problem here is that property path is stored as string constant and our |
I have an idea how to fix it (see bahusoid@4f0dd7a). Instead of dictionary I generate a block of variable assignments: var propertyPath1 = propValue1;
var propertyPath2 = propValue2; So in cache key it's added as |
@@ -257,6 +259,41 @@ public void PlansAreCached() | |||
} | |||
} | |||
|
|||
//GH-2298 - Different Update queries - same query cache plan | |||
[Test] | |||
public void DmlPlansAreProperlyHandled() |
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 test would be better put into LinqBulkManipulation
namespace I think.
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.
I prefer to keep it here. IMHO it's very similar to PlansWithNonParameterizedConstantsAreNotCachedForExpandedQuery
only for DML query. Also I think it's better to keep tests with a bit hacky reflection logic in one place (part about retrieving query plan cache).
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…cacheable query expression
9a30225
to
fb83c8b
Compare
Fixes #2298. Do not cache
ExpandedQueryExpression
query plan if it's based on not cacheable query expressionIt fixes regression since 5.1 with possible execution of wrong DML query for queries with parameters list (details here)
In master branch it depends on #2299 (already merged)
And async code should be re-genarated when merging to master (as test for UpdateAsync is not generated in 5.2)