<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 6 Sep 2010, at 12:37, Mircea Markus wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 6 Sep 2010, at 11:10, Manik Surtani wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 6 Sep 2010, at 10:52, Mircea Markus wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,<br><br>This is about what happens with locking and transactions when an exception appears during an invocation. It might be a e.g. TimeoutException or an CacheStore related exception or any type of exception.<br>Deadlock detection code relies on this policy, so I need to clearly define it.<br><br>Current logic is rather unclear and spreads over multiple interceptors:<br>- CallInterceptor would mark the tx for rollback if ant exception happen. This won't include TE as lock acquisition happen earlier in the call stack <br></div></blockquote><div><br></div><div>^^ What's TE? TimeoutException?</div></div></div></blockquote>yes<br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br><blockquote type="cite"><div>- InvocationContextInterceptor releases locks on all keys associated with this call, but doesn't care if the call is in a tx or not so it doesn't rollback tx or release tx locks (this logic rather belongs in LockingInterceptor)<br></div></blockquote><div><br></div><div>It would release tx locks specific to the invocation. Look at the impl of the InvocationContext used to retrieve the locks in question. </div><div><br></div><div>Granted, it doesn't cause the transaction to roll back though - and IMO it should. Do you have a list of exceptional conditions which do not cause a transaction to roll back at the moment? I suppose cache store exceptions?</div></div></div></blockquote>The ones I can think of are:</div><div>- timeout exceptions (local or remote)</div><div>- cache store exceptions</div><div>- deadlock exceptions</div><div>- replication/invalidation exceptions</div><div>- exceptions from custom interceptors.</div><div>- InvalidStateException if if call is made in the scope of a transaction that was marked for rollback</div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br><blockquote type="cite"><div>- TxInterceptor and LockInterceptor just ignore exceptions<br></div></blockquote><div><br></div><div>You mean, pass them up higher in the interceptor chain - possibly for the InvocationContextInterceptor to deal with.</div></div></div></blockquote>yes<br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br><blockquote type="cite"><div>As discussed in a previous email, the desired behaviour in case of a TimeoutException is to mark the tx for rollback. I think this can be extended as a rule for any type of Exception happening during a transaction - e.g. store exception, remote communication exception etc. On the short, if the user receives any kind of exception while writing in a tx (e.g. cache.put() throws an exception) he should know that tx was marked as rollback only. Wdyt?<br></div></blockquote><div><br></div><div>Yep. And the InvocationContextInterceptor is the best place to trap this and deal with it since it will have visibility of exceptions further down the chain (provided they aren't swallowed somewhere). Essentially the stuff that the CallInterceptor does when it catches an exception in command.perform() should be moved to the InvocationContextInterceptor.</div><div><br></div><div><a href="http://fisheye.jboss.org/browse/Infinispan/trunk/core/src/main/java/org/infinispan/interceptors/CallInterceptor.java?r=604#l74">http://fisheye.jboss.org/browse/Infinispan/trunk/core/src/main/java/org/infinispan/interceptors/CallInterceptor.java?r=604#l74</a></div></div></div></blockquote>I agree that is the best solution. The drawback is the fact that we would have the locking logic spread over two interceptors instead of one - LockinInterceptor(harder to follow etc). Same with tx. These would need to be well documented. </div></div></blockquote><div><br></div><div>The actual logic could be wrapped up in the LockManager. You could then just invoke LockManager#releaseLocksAcquiredInCurrentInvocation(ctx) from the InvocationContextInterceptor.</div><div><br></div><div>I notice you've ripped this logic out of the InvocationContextInterceptor in branches/4.2.x</div><div><br></div><div><a href="http://fisheye.jboss.org/browse/Infinispan/branches/4.2.x/core/src/main/java/org/infinispan/interceptors/InvocationContextInterceptor.java?r1=2273&r2=2323&u=3#l45">http://fisheye.jboss.org/browse/Infinispan/branches/4.2.x/core/src/main/java/org/infinispan/interceptors/InvocationContextInterceptor.java?r1=2273&r2=2323&u=3#l45</a></div><div><br></div><div>Note that this is incorrect since, as I pointed out, you will miss exceptions thrown between the InvocationContextInterceptor and the LockingInterceptor.</div><div><br></div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Naturally we should (a) list all exception types we can come up with, in each interceptor (b) test behaviour on an ongoing transaction for each of these exceptional types. A single functional test should do the trick.</div></div></div></blockquote>Sounds good. Any other exceptions you might have in mind?</div></div></blockquote><div><br></div><div>I think that should be it.</div></div><div><br></div><div>Cheers</div><div>Manik</div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Manik Surtani</div><div><a href="mailto:manik@jboss.org">manik@jboss.org</a></div><div>Lead, Infinispan</div><div>Lead, JBoss Cache</div><div><a href="http://www.infinispan.org">http://www.infinispan.org</a></div><div><a href="http://www.jbosscache.org">http://www.jbosscache.org</a></div><div><br></div></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br></body></html>