You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2018/10/30 17:02:00 UTC

[jira] [Commented] (GEODE-5953) TXStateProxyImpl target needs to be set to local member if it contains TXState

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

ASF subversion and git services commented on GEODE-5953:
--------------------------------------------------------

Commit 6b973466336ee228f7881ec11344359a30a6ac96 in geode's branch refs/heads/feature/GEODE-5953 from eshu
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=6b97346 ]

GEODE-5953: set transaction target to local member if member host transaction.

  * to be able to detect primary bucket has moved due to rebalance.
  * add debug level logging for transaction.


> TXStateProxyImpl target needs to be set to local member if it contains TXState
> ------------------------------------------------------------------------------
>
>                 Key: GEODE-5953
>                 URL: https://issues.apache.org/jira/browse/GEODE-5953
>             Project: Geode
>          Issue Type: Bug
>          Components: transactions
>    Affects Versions: 1.1.0
>            Reporter: Eric Shu
>            Assignee: Eric Shu
>            Priority: Major
>
> If target is not set earlier, it will be set in function execution code. It could cause issue when rebalance occurs during function execution by setting target to another node when the local member already hosts the transaction. If target was set earlier, the following code can detect it and throw TransactionDataRebalancedException.
>   public void validateExecution(Function function, Set targetMembers) {
>     InternalCache cache = pr.getGemFireCache();
>     if (cache.getTxManager().getTXState() != null) {
>       if (targetMembers.size() > 1) {
>         throw new TransactionException(
>             "Function inside a transaction cannot execute on more than one node");
>       } else {
>         assert targetMembers.size() == 1;
>         DistributedMember funcTarget = (DistributedMember) targetMembers.iterator().next();
>         DistributedMember target = cache.getTxManager().getTXState().getTarget();
>         if (target == null) {
>           cache.getTxManager().getTXState().setTarget(funcTarget);
>         } else if (!target.equals(funcTarget)) {
>           throw new TransactionDataRebalancedException(
>               String.format(
>                   "Function execution is not colocated with transaction. The transactional data is hosted on node %s, but you are trying to target node %s",
>                   target, funcTarget));
>         }
>       }
>     }
>     cache.getInternalResourceManager().getHeapMonitor().checkForLowMemory(function, targetMembers);
>   }



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