public long startOperation() {
    DistributedRegion region = getRegion();
    long viewVersion = -1;
    try {
      if (containsRegionContentChange()) {
        viewVersion = region.getDistributionAdvisor().startOperation();
      }
      if (logger.isTraceEnabled(LogMarker.STATE_FLUSH_OP_VERBOSE)) {
        logger.trace(LogMarker.STATE_FLUSH_OP_VERBOSE, "dispatching operation in view version {}",
            viewVersion);
      }
      try {
        _distribute();
      } catch (InvalidVersionException e) {
        if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) {
          logger.trace(LogMarker.DM_VERBOSE,
              "PutAll failed since versions were missing; retrying", e);
        }

        if (test_InvalidVersionAction != null) {
          test_InvalidVersionAction.run();
        }
        _distribute();
      }
    } catch (RuntimeException | Error e) {
      endOperation(viewVersion);
      throw e;
    }
    return viewVersion;
  }
region's distribution advisor marked that a distribution is about to start, then distribute. It
returns a token, which is view version. Return -1 means the method did not succeed. This method
must be invoked before toDistribute(). This method should pair with endOperation() in
try/finally block.
geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java