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

HHH-7898 Regression on org.hibernate.cache.infinispan.query.QueryResu… #1020

Closed
wants to merge 2 commits into from

Conversation

rvansa
Copy link
Contributor

@rvansa rvansa commented Jul 22, 2015

…ltsRegionImpl.put(Object, Object)

  • Moved query cache update to second phase of transaction commit
  • Query caches are now recommended to be non-transactional (transactional ones will be slower)

JIRA: https://hibernate.atlassian.net/browse/HHH-7898

@rvansa
Copy link
Contributor Author

rvansa commented Jul 27, 2015

One thing worth mentioning: with this fix, if the same transaction executes the same query, the value is not in transactional context nor committed in the cache and therefore, it will result in cache miss.
This is not revealed by current tests since the cache was made non-transactional, and the region detects current transaction based on the transaction manager retrieved from the cache, not from the transaction manager used to executed the whole operation. Therefore, the tests execute non-transactional code.

* Passing SessionImplementor to all the calls executed in transactional context
@rvansa rvansa force-pushed the HHH-7898 branch 2 times, most recently from 02bb3be to bb76cea Compare July 27, 2015 16:02
@rvansa
Copy link
Contributor Author

rvansa commented Jul 27, 2015

I've added a logic that does not break one of the unit tests, but it's based on some other changes that await as PR. Though, I am not sure if I should implement the same logic for non-JTA transactions - currently it simply writes the entry before the transaction commits. However, can I execute another JDBC transaction from afterCompletion? TransactionCoordinator does not have any API for suspend.

@sebersole
Copy link
Member

TransactionCoordinator tc = ...;
tc.createIsolationDelegate().delegateWork( ... )

Whatever work is done here is isolated from the current transaction. And it works for both JTA and JDBC. Starting to see the benefit of encapsulating all this? ;)

@rvansa
Copy link
Contributor Author

rvansa commented Jul 28, 2015

@sebersole Ah, ok :) I'll make this TX impl agnostic :)

@rvansa
Copy link
Contributor Author

rvansa commented Jul 28, 2015

@sebersole Using the isolation delegate simplifies the code a lot, though, it would be better if I didn't have to obtain the connection when I don't need it. Should I add a
<T> T delegateCallable(Callable<T> callable, boolean transacted) throws HibernateException
to IsolationDelegate?

@rvansa rvansa force-pushed the HHH-7898 branch 2 times, most recently from d6fca92 to 3c76eea Compare July 28, 2015 10:18
@rvansa
Copy link
Contributor Author

rvansa commented Jul 28, 2015

Reworked... I had to reshuffle the query cache tests a bit to correctly use sessions, but it was worth it.

@sebersole
Copy link
Member

@rvansa We already have the Connection. There is no overhead in it being there. -1 for adding a new method just to not accept it.

@sebersole
Copy link
Member

@rvansa On HHH-7898 you mentioned that this work also needed to account for HHH-9988. But I do not see a PR for that. Did you address that one here? Somewhere else? Not at all?

@rvansa
Copy link
Contributor Author

rvansa commented Jul 28, 2015

@sebersole It seemed to me that JtaIsolationDelegate.doTheWork obtains separate connection, if it does not, my mistake.

Wrt HHH-9988: When using TransactionCoordinator, HHH-9988 is not necessary in fact, I'll correct it. Sorry about making things messy with several related JIRAs awaiting PRs. Btw., is there any recommended practice to tag the PR when it depends on another not-integrated changes?

…ltsRegionImpl.put(Object, Object)

* Moved query cache update to second phase of transaction commit
* Query caches are now recommended to be non-transactional (transactional ones will be slower)
@sebersole
Copy link
Member

@rvansa actually you are right I think in regards to the Connection. I guess I am ok with adding a new method there. Let me know if you'd prefer me to work on that.

In regards to HHH-9988, awesome. So should HHH-9988 be closed?

In regards to "dependent PRs".. The best you can refer to them and make sure everything is cross linked. For now, maybe ping me on IRC and walk me through which need applied?

@dreab8
Copy link
Contributor

dreab8 commented Jul 28, 2015

Thanks @rvansa ,

PR fixed conflicts, rebased and merged

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