The second assertion is asserting against the transaction-start-time from the Session, not against the Session itself
Yes, but the way you've written it you'd be comparing timestamps stored (directly or indirectly) in the same Session. If you wrote
assert ctc1.getTransactionStartTimestamp() == ctc2.getTransactionStartTimestamp();
this would likely fail. I agree that
assert ctc2.getTransactionStartTimestamp() == session.getTransactionStartTimestamp();
should hold as long as ctc2 belongs to currently running transaction. Should you execute any operations out of the transaction, these should probably get their own one-time CTC, with timestamp pointing to session start time or time after the last operation.
...whether the CacheTransactionContext returned from RegionFactory#startTransaction will itself be sensitive to these boundaries
No, CTC should be created by the Session anew on the tx boundary. And I agree that CTC could grap the timestamp from RF on its own.
there is an related option where we can simply reuse the CacheTransactionContext instance
I am confused - I thought you use CTC == StorageAccessContext from https://github.com/rvansa/hibernate-orm/tree/HHH-11356 - what existing option? |