Transaction Deadlock Detection exception is not wrapped by the timeout exception

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Transaction Deadlock Detection exception is not wrapped by the timeout exception

dmagda
Andrey Gura, Igniters,

If to refer to our documentation [1], this is how we need to catch the deadlock detection exception:

catch (CacheException e) {
    if (e.getCause() instanceof IgniteCheckedException &&
        e.getCause().getCause() instanceof TransactionDeadlockException)    
       
        System.out.println(e.getCause().getCause().getMessage());
}

However, this is no longer works in Ignite 2.0 because IgniteCheckedException has to be used instead of TransactionTimeoutException:

catch (CacheException e) {
    if (e.getCause() instanceof IgniteCheckedException &&
        e.getCause().getCause() instanceof TransactionDeadlockException)    
       
        System.out.println(e.getCause().getCause().getMessage());
}

See the example with the workaround:
https://github.com/dmagda/ignite_transactions/blob/master/src/main/java/org/apache/ignite/examples/DeadlockDetectionExample.java


Could we do on of the following:

1) Recover the previous behavior or
2) Throw TransactionDeadlockDetection right away as it’s done in .NET [3]

[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

Reply | Threaded
Open this post in threaded view
|

Re: Transaction Deadlock Detection exception is not wrapped by the timeout exception

dmagda
Pardon me, copy pasted the catch block twice. This how the block looked like in Ignite 1.x

catch (CacheException e) {
    if (e.getCause() instanceof TransactionTimeoutException &&
        e.getCause().getCause() instanceof TransactionDeadlockException)    
       
        System.out.println(e.getCause().getCause().getMessage());
}

and this is how it must be coded in 2.0:

> catch (CacheException e) {
>    if (e.getCause() instanceof IgniteCheckedException &&
>        e.getCause().getCause() instanceof TransactionDeadlockException)    
>
>        System.out.println(e.getCause().getCause().getMessage());
> }




Denis

> On Jun 13, 2017, at 4:24 PM, Denis Magda <[hidden email]> wrote:
>
> Andrey Gura, Igniters,
>
> If to refer to our documentation [1], this is how we need to catch the deadlock detection exception:
>
> catch (CacheException e) {
>    if (e.getCause() instanceof IgniteCheckedException &&
>        e.getCause().getCause() instanceof TransactionDeadlockException)    
>
>        System.out.println(e.getCause().getCause().getMessage());
> }
>
> However, this is no longer works in Ignite 2.0 because IgniteCheckedException has to be used instead of TransactionTimeoutException:
>
> catch (CacheException e) {
>    if (e.getCause() instanceof IgniteCheckedException &&
>        e.getCause().getCause() instanceof TransactionDeadlockException)    
>
>        System.out.println(e.getCause().getCause().getMessage());
> }
>
> See the example with the workaround:
> https://github.com/dmagda/ignite_transactions/blob/master/src/main/java/org/apache/ignite/examples/DeadlockDetectionExample.java
>
>
> Could we do on of the following:
>
> 1) Recover the previous behavior or
> 2) Throw TransactionDeadlockDetection right away as it’s done in .NET [3]
>
> [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
>

Reply | Threaded
Open this post in threaded view
|

Re: Transaction Deadlock Detection exception is not wrapped by the timeout exception

dsetrakyan
This looks a bit confusing. Why is it not enough to have this check:

e.getCause().getCause() instanceof TransactionDeadlockException

?

On Tue, Jun 13, 2017 at 4:40 PM, Denis Magda <[hidden email]> wrote:

> Pardon me, copy pasted the catch block twice. This how the block looked
> like in Ignite 1.x
>
> catch (CacheException e) {
>     if (e.getCause() instanceof TransactionTimeoutException &&
>         e.getCause().getCause() instanceof TransactionDeadlockException)
>
>         System.out.println(e.getCause().getCause().getMessage());
> }
>
> and this is how it must be coded in 2.0:
>
> > catch (CacheException e) {
> >    if (e.getCause() instanceof IgniteCheckedException &&
> >        e.getCause().getCause() instanceof TransactionDeadlockException)
> >
> >        System.out.println(e.getCause().getCause().getMessage());
> > }
>
>
>
> —
> Denis
>
> > On Jun 13, 2017, at 4:24 PM, Denis Magda <[hidden email]> wrote:
> >
> > Andrey Gura, Igniters,
> >
> > If to refer to our documentation [1], this is how we need to catch the
> deadlock detection exception:
> >
> > catch (CacheException e) {
> >    if (e.getCause() instanceof IgniteCheckedException &&
> >        e.getCause().getCause() instanceof TransactionDeadlockException)
> >
> >        System.out.println(e.getCause().getCause().getMessage());
> > }
> >
> > However, this is no longer works in Ignite 2.0 because
> IgniteCheckedException has to be used instead of
> TransactionTimeoutException:
> >
> > catch (CacheException e) {
> >    if (e.getCause() instanceof IgniteCheckedException &&
> >        e.getCause().getCause() instanceof TransactionDeadlockException)
> >
> >        System.out.println(e.getCause().getCause().getMessage());
> > }
> >
> > See the example with the workaround:
> > https://github.com/dmagda/ignite_transactions/blob/
> master/src/main/java/org/apache/ignite/examples/
> DeadlockDetectionExample.java
> >
> >
> > Could we do on of the following:
> >
> > 1) Recover the previous behavior or
> > 2) Throw TransactionDeadlockDetection right away as it’s done in .NET [3]
> >
> > [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
> >
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Transaction Deadlock Detection exception is not wrapped by the timeout exception

dmagda
e.getCause() might return ‘null’ and you’ll get NullPointerException trying to execute e.getCause().getCause().

Ideally, we need to throw TransactionDeadlockException like it’s done in .NET.


Denis

> On Jun 13, 2017, at 4:43 PM, Dmitriy Setrakyan <[hidden email]> wrote:
>
> This looks a bit confusing. Why is it not enough to have this check:
>
> e.getCause().getCause() instanceof TransactionDeadlockException
>
> ?
>
> On Tue, Jun 13, 2017 at 4:40 PM, Denis Magda <[hidden email]> wrote:
>
>> Pardon me, copy pasted the catch block twice. This how the block looked
>> like in Ignite 1.x
>>
>> catch (CacheException e) {
>>    if (e.getCause() instanceof TransactionTimeoutException &&
>>        e.getCause().getCause() instanceof TransactionDeadlockException)
>>
>>        System.out.println(e.getCause().getCause().getMessage());
>> }
>>
>> and this is how it must be coded in 2.0:
>>
>>> catch (CacheException e) {
>>>   if (e.getCause() instanceof IgniteCheckedException &&
>>>       e.getCause().getCause() instanceof TransactionDeadlockException)
>>>
>>>       System.out.println(e.getCause().getCause().getMessage());
>>> }
>>
>>
>>
>> —
>> Denis
>>
>>> On Jun 13, 2017, at 4:24 PM, Denis Magda <[hidden email]> wrote:
>>>
>>> Andrey Gura, Igniters,
>>>
>>> If to refer to our documentation [1], this is how we need to catch the
>> deadlock detection exception:
>>>
>>> catch (CacheException e) {
>>>   if (e.getCause() instanceof IgniteCheckedException &&
>>>       e.getCause().getCause() instanceof TransactionDeadlockException)
>>>
>>>       System.out.println(e.getCause().getCause().getMessage());
>>> }
>>>
>>> However, this is no longer works in Ignite 2.0 because
>> IgniteCheckedException has to be used instead of
>> TransactionTimeoutException:
>>>
>>> catch (CacheException e) {
>>>   if (e.getCause() instanceof IgniteCheckedException &&
>>>       e.getCause().getCause() instanceof TransactionDeadlockException)
>>>
>>>       System.out.println(e.getCause().getCause().getMessage());
>>> }
>>>
>>> See the example with the workaround:
>>> https://github.com/dmagda/ignite_transactions/blob/
>> master/src/main/java/org/apache/ignite/examples/
>> DeadlockDetectionExample.java
>>>
>>>
>>> Could we do on of the following:
>>>
>>> 1) Recover the previous behavior or
>>> 2) Throw TransactionDeadlockDetection right away as it’s done in .NET [3]
>>>
>>> [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
>>>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: Transaction Deadlock Detection exception is not wrapped by the timeout exception

dsetrakyan
On Tue, Jun 13, 2017 at 5:06 PM, Denis Magda <[hidden email]> wrote:

> e.getCause() might return ‘null’ and you’ll get NullPointerException
> trying to execute e.getCause().getCause().
>
> Ideally, we need to throw TransactionDeadlockException like it’s done in
> .NET.
>

Agree, looks odd, but because of JSR107 we cannot throw any additional type
of exception.

Can we simplify by having one getCause() instead of double
getCause().getCause()?


> —
> Denis
>
> > On Jun 13, 2017, at 4:43 PM, Dmitriy Setrakyan <[hidden email]>
> wrote:
> >
> > This looks a bit confusing. Why is it not enough to have this check:
> >
> > e.getCause().getCause() instanceof TransactionDeadlockException
> >
> > ?
> >
> > On Tue, Jun 13, 2017 at 4:40 PM, Denis Magda <[hidden email]> wrote:
> >
> >> Pardon me, copy pasted the catch block twice. This how the block looked
> >> like in Ignite 1.x
> >>
> >> catch (CacheException e) {
> >>    if (e.getCause() instanceof TransactionTimeoutException &&
> >>        e.getCause().getCause() instanceof TransactionDeadlockException)
> >>
> >>        System.out.println(e.getCause().getCause().getMessage());
> >> }
> >>
> >> and this is how it must be coded in 2.0:
> >>
> >>> catch (CacheException e) {
> >>>   if (e.getCause() instanceof IgniteCheckedException &&
> >>>       e.getCause().getCause() instanceof TransactionDeadlockException)
> >>>
> >>>       System.out.println(e.getCause().getCause().getMessage());
> >>> }
> >>
> >>
> >>
> >> —
> >> Denis
> >>
> >>> On Jun 13, 2017, at 4:24 PM, Denis Magda <[hidden email]> wrote:
> >>>
> >>> Andrey Gura, Igniters,
> >>>
> >>> If to refer to our documentation [1], this is how we need to catch the
> >> deadlock detection exception:
> >>>
> >>> catch (CacheException e) {
> >>>   if (e.getCause() instanceof IgniteCheckedException &&
> >>>       e.getCause().getCause() instanceof TransactionDeadlockException)
> >>>
> >>>       System.out.println(e.getCause().getCause().getMessage());
> >>> }
> >>>
> >>> However, this is no longer works in Ignite 2.0 because
> >> IgniteCheckedException has to be used instead of
> >> TransactionTimeoutException:
> >>>
> >>> catch (CacheException e) {
> >>>   if (e.getCause() instanceof IgniteCheckedException &&
> >>>       e.getCause().getCause() instanceof TransactionDeadlockException)
> >>>
> >>>       System.out.println(e.getCause().getCause().getMessage());
> >>> }
> >>>
> >>> See the example with the workaround:
> >>> https://github.com/dmagda/ignite_transactions/blob/
> >> master/src/main/java/org/apache/ignite/examples/
> >> DeadlockDetectionExample.java
> >>>
> >>>
> >>> Could we do on of the following:
> >>>
> >>> 1) Recover the previous behavior or
> >>> 2) Throw TransactionDeadlockDetection right away as it’s done in .NET
> [3]
> >>>
> >>> [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
> >>>
> >>
> >>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Transaction Deadlock Detection exception is not wrapped by the timeout exception

agura
Guys,

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.

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.



On Wed, Jun 14, 2017 at 3:11 AM, Dmitriy Setrakyan
<[hidden email]> wrote:

> On Tue, Jun 13, 2017 at 5:06 PM, Denis Magda <[hidden email]> wrote:
>
>> e.getCause() might return ‘null’ and you’ll get NullPointerException
>> trying to execute e.getCause().getCause().
>>
>> Ideally, we need to throw TransactionDeadlockException like it’s done in
>> .NET.
>>
>
> Agree, looks odd, but because of JSR107 we cannot throw any additional type
> of exception.
>
> Can we simplify by having one getCause() instead of double
> getCause().getCause()?
>
>
>> —
>> Denis
>>
>> > On Jun 13, 2017, at 4:43 PM, Dmitriy Setrakyan <[hidden email]>
>> wrote:
>> >
>> > This looks a bit confusing. Why is it not enough to have this check:
>> >
>> > e.getCause().getCause() instanceof TransactionDeadlockException
>> >
>> > ?
>> >
>> > On Tue, Jun 13, 2017 at 4:40 PM, Denis Magda <[hidden email]> wrote:
>> >
>> >> Pardon me, copy pasted the catch block twice. This how the block looked
>> >> like in Ignite 1.x
>> >>
>> >> catch (CacheException e) {
>> >>    if (e.getCause() instanceof TransactionTimeoutException &&
>> >>        e.getCause().getCause() instanceof TransactionDeadlockException)
>> >>
>> >>        System.out.println(e.getCause().getCause().getMessage());
>> >> }
>> >>
>> >> and this is how it must be coded in 2.0:
>> >>
>> >>> catch (CacheException e) {
>> >>>   if (e.getCause() instanceof IgniteCheckedException &&
>> >>>       e.getCause().getCause() instanceof TransactionDeadlockException)
>> >>>
>> >>>       System.out.println(e.getCause().getCause().getMessage());
>> >>> }
>> >>
>> >>
>> >>
>> >> —
>> >> Denis
>> >>
>> >>> On Jun 13, 2017, at 4:24 PM, Denis Magda <[hidden email]> wrote:
>> >>>
>> >>> Andrey Gura, Igniters,
>> >>>
>> >>> If to refer to our documentation [1], this is how we need to catch the
>> >> deadlock detection exception:
>> >>>
>> >>> catch (CacheException e) {
>> >>>   if (e.getCause() instanceof IgniteCheckedException &&
>> >>>       e.getCause().getCause() instanceof TransactionDeadlockException)
>> >>>
>> >>>       System.out.println(e.getCause().getCause().getMessage());
>> >>> }
>> >>>
>> >>> However, this is no longer works in Ignite 2.0 because
>> >> IgniteCheckedException has to be used instead of
>> >> TransactionTimeoutException:
>> >>>
>> >>> catch (CacheException e) {
>> >>>   if (e.getCause() instanceof IgniteCheckedException &&
>> >>>       e.getCause().getCause() instanceof TransactionDeadlockException)
>> >>>
>> >>>       System.out.println(e.getCause().getCause().getMessage());
>> >>> }
>> >>>
>> >>> See the example with the workaround:
>> >>> https://github.com/dmagda/ignite_transactions/blob/
>> >> master/src/main/java/org/apache/ignite/examples/
>> >> DeadlockDetectionExample.java
>> >>>
>> >>>
>> >>> Could we do on of the following:
>> >>>
>> >>> 1) Recover the previous behavior or
>> >>> 2) Throw TransactionDeadlockDetection right away as it’s done in .NET
>> [3]
>> >>>
>> >>> [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
>> >>>
>> >>
>> >>
>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: Transaction Deadlock Detection exception is not wrapped by the timeout exception

dmagda
Andrey,

> On Jun 14, 2017, at 3:11 AM, Andrey Gura <[hidden email]> wrote:
>
> Guys,
>
> 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.
>

How do we use the detection with this transactions then? There is no special documentation section about this.

> 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.
>
See the provided example that shows this is no longer true:
https://github.com/dmagda/ignite_transactions/blob/master/src/main/java/org/apache/ignite/examples/DeadlockDetectionExample.java <https://github.com/dmagda/ignite_transactions/blob/master/src/main/java/org/apache/ignite/examples/DeadlockDetectionExample.java>

In the example I have to use IgniteCheckedException instead on TransactionTimeoutException because otherwise the whole exception will be swallowed.

>
>
> On Wed, Jun 14, 2017 at 3:11 AM, Dmitriy Setrakyan
> <[hidden email]> wrote:
>> On Tue, Jun 13, 2017 at 5:06 PM, Denis Magda <[hidden email]> wrote:
>>
>>> e.getCause() might return ‘null’ and you’ll get NullPointerException
>>> trying to execute e.getCause().getCause().
>>>
>>> Ideally, we need to throw TransactionDeadlockException like it’s done in
>>> .NET.
>>>
>>
>> Agree, looks odd, but because of JSR107 we cannot throw any additional type
>> of exception.
>>
>> Can we simplify by having one getCause() instead of double
>> getCause().getCause()?
>>
>>
>>> —
>>> Denis
>>>
>>>> On Jun 13, 2017, at 4:43 PM, Dmitriy Setrakyan <[hidden email]>
>>> wrote:
>>>>
>>>> This looks a bit confusing. Why is it not enough to have this check:
>>>>
>>>> e.getCause().getCause() instanceof TransactionDeadlockException
>>>>
>>>> ?
>>>>
>>>> On Tue, Jun 13, 2017 at 4:40 PM, Denis Magda <[hidden email]> wrote:
>>>>
>>>>> Pardon me, copy pasted the catch block twice. This how the block looked
>>>>> like in Ignite 1.x
>>>>>
>>>>> catch (CacheException e) {
>>>>>   if (e.getCause() instanceof TransactionTimeoutException &&
>>>>>       e.getCause().getCause() instanceof TransactionDeadlockException)
>>>>>
>>>>>       System.out.println(e.getCause().getCause().getMessage());
>>>>> }
>>>>>
>>>>> and this is how it must be coded in 2.0:
>>>>>
>>>>>> catch (CacheException e) {
>>>>>>  if (e.getCause() instanceof IgniteCheckedException &&
>>>>>>      e.getCause().getCause() instanceof TransactionDeadlockException)
>>>>>>
>>>>>>      System.out.println(e.getCause().getCause().getMessage());
>>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> —
>>>>> Denis
>>>>>
>>>>>> On Jun 13, 2017, at 4:24 PM, Denis Magda <[hidden email]> wrote:
>>>>>>
>>>>>> Andrey Gura, Igniters,
>>>>>>
>>>>>> If to refer to our documentation [1], this is how we need to catch the
>>>>> deadlock detection exception:
>>>>>>
>>>>>> catch (CacheException e) {
>>>>>>  if (e.getCause() instanceof IgniteCheckedException &&
>>>>>>      e.getCause().getCause() instanceof TransactionDeadlockException)
>>>>>>
>>>>>>      System.out.println(e.getCause().getCause().getMessage());
>>>>>> }
>>>>>>
>>>>>> However, this is no longer works in Ignite 2.0 because
>>>>> IgniteCheckedException has to be used instead of
>>>>> TransactionTimeoutException:
>>>>>>
>>>>>> catch (CacheException e) {
>>>>>>  if (e.getCause() instanceof IgniteCheckedException &&
>>>>>>      e.getCause().getCause() instanceof TransactionDeadlockException)
>>>>>>
>>>>>>      System.out.println(e.getCause().getCause().getMessage());
>>>>>> }
>>>>>>
>>>>>> See the example with the workaround:
>>>>>> https://github.com/dmagda/ignite_transactions/blob/
>>>>> master/src/main/java/org/apache/ignite/examples/
>>>>> DeadlockDetectionExample.java
>>>>>>
>>>>>>
>>>>>> Could we do on of the following:
>>>>>>
>>>>>> 1) Recover the previous behavior or
>>>>>> 2) Throw TransactionDeadlockDetection right away as it’s done in .NET
>>> [3]
>>>>>>
>>>>>> [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
>>>>>>
>>>>>
>>>>>
>>>
>>>

Reply | Threaded
Open this post in threaded view
|

Re: Transaction Deadlock Detection exception is not wrapped by the timeout exception

dmagda
Here is a ticket, please fix the degradation in 2.1:
https://issues.apache.org/jira/browse/IGNITE-5548 <https://issues.apache.org/jira/browse/IGNITE-5548>


Denis

> On Jun 14, 2017, at 3:17 PM, Denis Magda <[hidden email]> wrote:
>
> Andrey,
>
>> On Jun 14, 2017, at 3:11 AM, Andrey Gura <[hidden email]> wrote:
>>
>> Guys,
>>
>> 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.
>>
>
> How do we use the detection with this transactions then? There is no special documentation section about this.
>
>> 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.
>>
> See the provided example that shows this is no longer true:
> https://github.com/dmagda/ignite_transactions/blob/master/src/main/java/org/apache/ignite/examples/DeadlockDetectionExample.java <https://github.com/dmagda/ignite_transactions/blob/master/src/main/java/org/apache/ignite/examples/DeadlockDetectionExample.java>
>
> In the example I have to use IgniteCheckedException instead on TransactionTimeoutException because otherwise the whole exception will be swallowed.
>>
>>
>> On Wed, Jun 14, 2017 at 3:11 AM, Dmitriy Setrakyan
>> <[hidden email]> wrote:
>>> On Tue, Jun 13, 2017 at 5:06 PM, Denis Magda <[hidden email]> wrote:
>>>
>>>> e.getCause() might return ‘null’ and you’ll get NullPointerException
>>>> trying to execute e.getCause().getCause().
>>>>
>>>> Ideally, we need to throw TransactionDeadlockException like it’s done in
>>>> .NET.
>>>>
>>>
>>> Agree, looks odd, but because of JSR107 we cannot throw any additional type
>>> of exception.
>>>
>>> Can we simplify by having one getCause() instead of double
>>> getCause().getCause()?
>>>
>>>
>>>> —
>>>> Denis
>>>>
>>>>> On Jun 13, 2017, at 4:43 PM, Dmitriy Setrakyan <[hidden email]>
>>>> wrote:
>>>>>
>>>>> This looks a bit confusing. Why is it not enough to have this check:
>>>>>
>>>>> e.getCause().getCause() instanceof TransactionDeadlockException
>>>>>
>>>>> ?
>>>>>
>>>>> On Tue, Jun 13, 2017 at 4:40 PM, Denis Magda <[hidden email]> wrote:
>>>>>
>>>>>> Pardon me, copy pasted the catch block twice. This how the block looked
>>>>>> like in Ignite 1.x
>>>>>>
>>>>>> catch (CacheException e) {
>>>>>>  if (e.getCause() instanceof TransactionTimeoutException &&
>>>>>>      e.getCause().getCause() instanceof TransactionDeadlockException)
>>>>>>
>>>>>>      System.out.println(e.getCause().getCause().getMessage());
>>>>>> }
>>>>>>
>>>>>> and this is how it must be coded in 2.0:
>>>>>>
>>>>>>> catch (CacheException e) {
>>>>>>> if (e.getCause() instanceof IgniteCheckedException &&
>>>>>>>     e.getCause().getCause() instanceof TransactionDeadlockException)
>>>>>>>
>>>>>>>     System.out.println(e.getCause().getCause().getMessage());
>>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>> —
>>>>>> Denis
>>>>>>
>>>>>>> On Jun 13, 2017, at 4:24 PM, Denis Magda <[hidden email]> wrote:
>>>>>>>
>>>>>>> Andrey Gura, Igniters,
>>>>>>>
>>>>>>> If to refer to our documentation [1], this is how we need to catch the
>>>>>> deadlock detection exception:
>>>>>>>
>>>>>>> catch (CacheException e) {
>>>>>>> if (e.getCause() instanceof IgniteCheckedException &&
>>>>>>>     e.getCause().getCause() instanceof TransactionDeadlockException)
>>>>>>>
>>>>>>>     System.out.println(e.getCause().getCause().getMessage());
>>>>>>> }
>>>>>>>
>>>>>>> However, this is no longer works in Ignite 2.0 because
>>>>>> IgniteCheckedException has to be used instead of
>>>>>> TransactionTimeoutException:
>>>>>>>
>>>>>>> catch (CacheException e) {
>>>>>>> if (e.getCause() instanceof IgniteCheckedException &&
>>>>>>>     e.getCause().getCause() instanceof TransactionDeadlockException)
>>>>>>>
>>>>>>>     System.out.println(e.getCause().getCause().getMessage());
>>>>>>> }
>>>>>>>
>>>>>>> See the example with the workaround:
>>>>>>> https://github.com/dmagda/ignite_transactions/blob/
>>>>>> master/src/main/java/org/apache/ignite/examples/
>>>>>> DeadlockDetectionExample.java
>>>>>>>
>>>>>>>
>>>>>>> Could we do on of the following:
>>>>>>>
>>>>>>> 1) Recover the previous behavior or
>>>>>>> 2) Throw TransactionDeadlockDetection right away as it’s done in .NET
>>>> [3]
>>>>>>>
>>>>>>> [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
>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>