Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0918A200CBB for ; Tue, 20 Jun 2017 04:27:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0679B160BE4; Tue, 20 Jun 2017 02:27:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4B3D0160BE1 for ; Tue, 20 Jun 2017 04:27:13 +0200 (CEST) Received: (qmail 24665 invoked by uid 500); 20 Jun 2017 02:27:12 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 24654 invoked by uid 99); 20 Jun 2017 02:27:12 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jun 2017 02:27:12 +0000 Received: from [192.168.62.220] (unknown [94.142.111.7]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 6E5191A002E for ; Tue, 20 Jun 2017 02:27:11 +0000 (UTC) From: Denis Magda Content-Type: multipart/alternative; boundary="Apple-Mail=_8C7FD5CD-9309-40D6-A69F-EBE129254695" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Transaction Deadlock Detection exception is not wrapped by the timeout exception Date: Tue, 20 Jun 2017 04:27:09 +0200 References: <849A3243-6348-4854-985E-66EDF2906AF3@apache.org> <69E5C4B7-6905-4BFD-A30A-295967F2EB52@apache.org> To: dev@ignite.apache.org In-Reply-To: Message-Id: <143FE5E2-506E-4B8C-B551-516689B1C321@apache.org> X-Mailer: Apple Mail (2.3273) archived-at: Tue, 20 Jun 2017 02:27:14 -0000 --Apple-Mail=_8C7FD5CD-9309-40D6-A69F-EBE129254695 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Here is a ticket, please fix the degradation in 2.1: https://issues.apache.org/jira/browse/IGNITE-5548 = =E2=80=94 Denis > On Jun 14, 2017, at 3:17 PM, Denis Magda wrote: >=20 > Andrey, >=20 >> On Jun 14, 2017, at 3:11 AM, Andrey Gura wrote: >>=20 >> Guys, >>=20 >> first of all I should notice that thre is difference between eception >> handling in pessimistic and optimistic transaction, because in >> optimistic txs we can't throw CacheException on tx.commit() call. >>=20 >=20 > How do we use the detection with this transactions then? There is no = special documentation section about this. >=20 >> The second, I'm surprised why TransactionTimeoutException is replaced >> by IgniteCheckedException? I still see converter for >> IgniteTxTimeoutCheckedException that eventually throws >> TransactionTimeoutException with TransactionDeadlockException as >> cause. >>=20 > See the provided example that shows this is no longer true: > = https://github.com/dmagda/ignite_transactions/blob/master/src/main/java/or= g/apache/ignite/examples/DeadlockDetectionExample.java = >=20 > In the example I have to use IgniteCheckedException instead on = TransactionTimeoutException because otherwise the whole exception will = be swallowed. >>=20 >>=20 >> On Wed, Jun 14, 2017 at 3:11 AM, Dmitriy Setrakyan >> wrote: >>> On Tue, Jun 13, 2017 at 5:06 PM, Denis Magda = wrote: >>>=20 >>>> e.getCause() might return =E2=80=98null=E2=80=99 and you=E2=80=99ll = get NullPointerException >>>> trying to execute e.getCause().getCause(). >>>>=20 >>>> Ideally, we need to throw TransactionDeadlockException like it=E2=80=99= s done in >>>> .NET. >>>>=20 >>>=20 >>> Agree, looks odd, but because of JSR107 we cannot throw any = additional type >>> of exception. >>>=20 >>> Can we simplify by having one getCause() instead of double >>> getCause().getCause()? >>>=20 >>>=20 >>>> =E2=80=94 >>>> Denis >>>>=20 >>>>> On Jun 13, 2017, at 4:43 PM, Dmitriy Setrakyan = >>>> wrote: >>>>>=20 >>>>> This looks a bit confusing. Why is it not enough to have this = check: >>>>>=20 >>>>> e.getCause().getCause() instanceof TransactionDeadlockException >>>>>=20 >>>>> ? >>>>>=20 >>>>> On Tue, Jun 13, 2017 at 4:40 PM, Denis Magda = wrote: >>>>>=20 >>>>>> Pardon me, copy pasted the catch block twice. This how the block = looked >>>>>> like in Ignite 1.x >>>>>>=20 >>>>>> catch (CacheException e) { >>>>>> if (e.getCause() instanceof TransactionTimeoutException && >>>>>> e.getCause().getCause() instanceof = TransactionDeadlockException) >>>>>>=20 >>>>>> System.out.println(e.getCause().getCause().getMessage()); >>>>>> } >>>>>>=20 >>>>>> and this is how it must be coded in 2.0: >>>>>>=20 >>>>>>> catch (CacheException e) { >>>>>>> if (e.getCause() instanceof IgniteCheckedException && >>>>>>> e.getCause().getCause() instanceof = TransactionDeadlockException) >>>>>>>=20 >>>>>>> System.out.println(e.getCause().getCause().getMessage()); >>>>>>> } >>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>> =E2=80=94 >>>>>> Denis >>>>>>=20 >>>>>>> On Jun 13, 2017, at 4:24 PM, Denis Magda = wrote: >>>>>>>=20 >>>>>>> Andrey Gura, Igniters, >>>>>>>=20 >>>>>>> If to refer to our documentation [1], this is how we need to = catch the >>>>>> deadlock detection exception: >>>>>>>=20 >>>>>>> catch (CacheException e) { >>>>>>> if (e.getCause() instanceof IgniteCheckedException && >>>>>>> e.getCause().getCause() instanceof = TransactionDeadlockException) >>>>>>>=20 >>>>>>> System.out.println(e.getCause().getCause().getMessage()); >>>>>>> } >>>>>>>=20 >>>>>>> However, this is no longer works in Ignite 2.0 because >>>>>> IgniteCheckedException has to be used instead of >>>>>> TransactionTimeoutException: >>>>>>>=20 >>>>>>> catch (CacheException e) { >>>>>>> if (e.getCause() instanceof IgniteCheckedException && >>>>>>> e.getCause().getCause() instanceof = TransactionDeadlockException) >>>>>>>=20 >>>>>>> System.out.println(e.getCause().getCause().getMessage()); >>>>>>> } >>>>>>>=20 >>>>>>> See the example with the workaround: >>>>>>> https://github.com/dmagda/ignite_transactions/blob/ >>>>>> master/src/main/java/org/apache/ignite/examples/ >>>>>> DeadlockDetectionExample.java >>>>>>>=20 >>>>>>>=20 >>>>>>> Could we do on of the following: >>>>>>>=20 >>>>>>> 1) Recover the previous behavior or >>>>>>> 2) Throw TransactionDeadlockDetection right away as it=E2=80=99s = done in .NET >>>> [3] >>>>>>>=20 >>>>>>> [1] https://apacheignite.readme.io/docs/transactions#section- >>>>>> deadlock-detection >>>>>>> [3] https://github.com/apache/ignite/blob/master/modules/ >>>>>> platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/ >>>>>> TransactionDeadlockDetectionExample.cs#L110 >>>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>=20 >>>>=20 >=20 --Apple-Mail=_8C7FD5CD-9309-40D6-A69F-EBE129254695--