[ 
https://issues.apache.org/jira/browse/IGNITE-8820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16517212#comment-16517212
 ] 

Alexei Scherbakov commented on IGNITE-8820:
-------------------------------------------

[~ivandasch],

My comments:

1. Your code doesn't handle a case then timeout was enabled (>0) and after that 
was disabled (=0).
Also readability is not good.

I suggest the following code:

{code}
        boolean rolledBack = false;

        long waitTimeout = 2 * cfg.getNetworkTimeout();

        while (true) {
            try {
                partReleaseFut.get(waitTimeout, TimeUnit.MILLISECONDS);

                break;
            }
            catch (IgniteFutureTimeoutCheckedException ignored) {
                // Print pending transactions and locks that might have led to 
hang.
                if (nextDumpTime <= U.currentTimeMillis()) {
                    dumpPendingObjects(partReleaseFut);

                    nextDumpTime = U.currentTimeMillis() + 
nextDumpTimeout(dumpCnt++, waitTimeout);
                }

                long curTimeout = 
cfg.getTransactionConfiguration().getTxTimeoutOnPartitionMapExchange();

                if (!rolledBack && curTimeout > 0 && U.currentTimeMillis() - 
waitStart >= curTimeout) {
                    rolledBack = true;

                    cctx.tm().rollbackOnTopologyChange(initialVersion());
                }
            }
            catch (IgniteCheckedException e) {
                U.warn(log,"Unable to await partitions release future", e);

                throw e;
            }
        }
{code}

2. You have added argument check to single method of TransactionConfiguration 
and now it looks incomplete.

Please add argument checks to all setters or remove it at all. In fact we 
really do not need arg check for timeouts because we treat only values > 0 as 
valid timeots.




> Add ability to accept changing txTimeoutOnPartitionMapExchange while waiting 
> for pending transactions.
> ------------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-8820
>                 URL: https://issues.apache.org/jira/browse/IGNITE-8820
>             Project: Ignite
>          Issue Type: Improvement
>    Affects Versions: 2.5
>            Reporter: Ivan Daschinskiy
>            Assignee: Ivan Daschinskiy
>            Priority: Minor
>             Fix For: 2.6
>
>
> Currently, if ExchangeFuture waits whith old value of 
> txTimeoutOnPartitionMapExchange, new value is not accepted until next 
> exchange starts. Sometimes it's very usefull (while timeout is too long and 
> must be shorter applied immediatelly)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to