Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-5953

TXStateProxyImpl target needs to be set to local member if it contains TXState

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      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);
      }

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            eshu Eric Shu
            eshu Eric Shu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 10m
                1h 10m

                Slack

                  Issue deployment