Skip to content

Query cache always missed in session having altered the entities #1731

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

Merged
merged 1 commit into from
Jun 6, 2018

Conversation

igitur
Copy link
Contributor

@igitur igitur commented Jun 4, 2018

Fixes #1730

This is my first fix to NHibernate. Please let me know what else is required on this PR. Ideally, I'd like this patch to be included on the 4.1 branch. Anything I can do to make that easier?

@igitur igitur force-pushed the GH1730-query-cache-timestamp-fix branch from 72b71be to 857c1db Compare June 4, 2018 17:00
hazzik
hazzik previously approved these changes Jun 4, 2018
@hazzik hazzik added the t: Fix label Jun 4, 2018
@hazzik
Copy link
Member

hazzik commented Jun 4, 2018

@fredericDelaporte 5.1.3 or 5.2?

@hazzik
Copy link
Member

hazzik commented Jun 4, 2018

Also, I think that async tests are missing.

@igitur
Copy link
Contributor Author

igitur commented Jun 4, 2018

Ah, yes, I'll add async tests.

Comments on the possibility of backporting to 4.1?

@hazzik
Copy link
Member

hazzik commented Jun 4, 2018

4.1 unlikely. What’s holding you from updating to 5.x?

@igitur
Copy link
Contributor Author

igitur commented Jun 4, 2018

Stuck on net452 for a while.

@hazzik
Copy link
Member

hazzik commented Jun 4, 2018

@fredericDelaporte odd semi-unrelated question (but I was thinking about it for a while): .net 4.5 support in 5.2, yeah/nah?

I did initial analysis: the only thing is missing is AsyncLocal<>. It has 2 usages:

  • AsyncLocalSessionContext - this has to go into the void;
  • AdoNetWithSystemTransactionFactory._bypassLock - this can be replaced with CallContext.LogicalGetData/CallContext.LogicalSetData surrounded to compilation directive.

A rationale for that: to get a better user acquisition on a newer version.

@igitur igitur force-pushed the GH1730-query-cache-timestamp-fix branch from 857c1db to fd0220a Compare June 5, 2018 07:00
@igitur
Copy link
Contributor Author

igitur commented Jun 5, 2018

Async test added.

@fredericDelaporte
Copy link
Member

Async test added.

Hum, have you missed a git add?

@hazzik
Copy link
Member

hazzik commented Jun 5, 2018

It seems it's manual addition

@fredericDelaporte
Copy link
Member

@fredericDelaporte odd semi-unrelated question (but I was thinking about it for a while): .net 4.5 support in 5.2, yeah/nah?

I am in favor of adding it. The main drawback will be the increase in the NuGet size. And should we start providing multiple targets in the SourceForge package? (Or on the contrary, drop SourceForge publishing?)

@hazzik
Copy link
Member

hazzik commented Jun 5, 2018

https://twitter.com/AlfredoCambera/status/1002966376468770816

@igitur
Copy link
Contributor Author

igitur commented Jun 5, 2018

Hum, have you missed a git add?

No, I added it as a new test method in Fixture.cs.

Ah, I just re-read the contributing guidelines and I see the part about using the async code generator. I'll redo the async part using the generator.

@igitur igitur force-pushed the GH1730-query-cache-timestamp-fix branch from fd0220a to a914425 Compare June 5, 2018 11:46
@igitur
Copy link
Contributor Author

igitur commented Jun 5, 2018

In other words @igitur, have you used the async generator like explained here?

Now I have.

{
protected override void Configure(Configuration configuration)
{
configuration.SetProperty("show_sql", "true");
Copy link
Member

Choose a reason for hiding this comment

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

is this required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Errr, no.

protected override void Configure(Configuration configuration)
{
configuration.SetProperty("show_sql", "true");
configuration.SetProperty("generate_statistics", "true");
Copy link
Member

Choose a reason for hiding this comment

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

Please use a property from Cfg.Environment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, done.

@igitur igitur force-pushed the GH1730-query-cache-timestamp-fix branch from a914425 to d044a5c Compare June 5, 2018 12:52
@fredericDelaporte
Copy link
Member

5.1.3 or 5.2?

I am more for 5.2. Especially since the opener would need this down to 4.1, which is quite unlikely we will do for a trouble which is not a serious regression. Moreover if we do support Fx4.5 in 5.2, that may suit him as I understand his need for having it in 4.1.

@igitur
Copy link
Contributor Author

igitur commented Jun 5, 2018

If you do plan to support net45 in 5.2, I can definitely wait until then.

@fredericDelaporte fredericDelaporte changed the title Query Cache effective only after closing the session that created the cache Query cache always missed in session having altered the entities Jun 5, 2018
@fredericDelaporte
Copy link
Member

Still on the unrelated subject, TransactionScopeAsyncFlowOption seems to be there only from 4.5.1, so that will be net451 rather than net45. #ifdef-ing that would create bugs with async-await.

hazzik
hazzik previously approved these changes Jun 5, 2018
@hazzik
Copy link
Member

hazzik commented Jun 5, 2018

Tried to do .NET 4.5 and found more issues: Task.FromCancelled(...), Task.FromException(...), Task.CompletedTask, and Array.Empty<T>() are missing. The array is easy to fix. Task is not so - it requires changes to AsyncGenerator. So, let's close the off-topic for now.

@fredericDelaporte
Copy link
Member

fredericDelaporte commented Jun 5, 2018

So well, we are back to "where should we put that fix"... I still do not think we should backport it to 4.1. Of course @igitur could rebase this PR on 5.1.x for inclusion in 5.1.3 then he could create backport PRs cherry-picking the change in 5.0.x and 4.1.x, reducing the work on the team side.
But that would be still publishing two additional releases for a non-regression bug, which is time consuming. And this could incite more people to ask for more backports, which I would rather avoid.

@igitur
Copy link
Contributor Author

igitur commented Jun 5, 2018

Don't worry about the 4.1 request. I can use this as motivation to upgrade our apps to net461+.

Yes, I can rebase on 5.1.x if @hazzik is OK with that.

@hazzik
Copy link
Member

hazzik commented Jun 5, 2018

Yes, 5.1.3 would be good. So, please rebase.

@igitur igitur force-pushed the GH1730-query-cache-timestamp-fix branch from d044a5c to 17a9961 Compare June 6, 2018 08:28
@igitur igitur changed the base branch from master to 5.1.x June 6, 2018 08:29
@igitur igitur force-pushed the GH1730-query-cache-timestamp-fix branch from 17a9961 to 683df95 Compare June 6, 2018 08:30
@igitur
Copy link
Contributor Author

igitur commented Jun 6, 2018

Rebased on 5.1.x

@hazzik hazzik merged commit 683df95 into nhibernate:5.1.x Jun 6, 2018
@hazzik hazzik added the r: Fixed label Jun 6, 2018
@hazzik
Copy link
Member

hazzik commented Jun 6, 2018

Thanks @igitur

@fredericDelaporte fredericDelaporte added this to the 5.1.3 milestone Jun 6, 2018
@igitur igitur deleted the GH1730-query-cache-timestamp-fix branch June 25, 2018 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants