/**
   * In this test, we often want to check that the last item in the replicated stream is not a
   * matchpoint candidate (that VLSNRange.lastVLSN != VLSNRange.lastSync) There's nothing wrong
   * intrinsically with that being so, it's just that this test is trying to ensure that we test
   * partial rollbacks.
   *
   * @return lastVLSN
   * @throws InterruptedException
   */
  private VLSN ensureDistinctLastAndSyncVLSN(ReplicatedEnvironment master, RepEnvInfo[] repEnvInfo)
      throws InterruptedException {

    VLSNIndex vlsnIndex = RepInternal.getRepImpl(master).getVLSNIndex();
    VLSNRange range = vlsnIndex.getRange();
    VLSN lastVLSN = range.getLast();
    VLSN syncVLSN = range.getLastSync();
    assertFalse("lastVLSN = " + lastVLSN + " syncVLSN = " + syncVLSN, lastVLSN.equals(syncVLSN));

    return lastVLSN;
  }
예제 #2
0
  /**
   * Implements the message exchange used to determine whether this feeder is suitable for use the
   * client's backup needs. The feeder may be unsuitable if it's already busy, or it's not current
   * enough to service the client's needs.
   */
  private void checkFeeder(Protocol protocol) throws IOException, DatabaseException {

    protocol.read(namedChannel.getChannel(), FeederInfoReq.class);
    int feeders = feederManager.getActiveFeederCount() - 1 /* Exclude this one */;
    VLSN rangeFirst = VLSN.NULL_VLSN;
    VLSN rangeLast = VLSN.NULL_VLSN;
    if (feederManager.getEnvImpl() instanceof RepImpl) {
      /* Include replication stream feeders as a load component. */
      RepImpl repImpl = (RepImpl) feederManager.getEnvImpl();
      feeders += repImpl.getRepNode().feederManager().activeReplicaCount();
      VLSNRange range = repImpl.getVLSNIndex().getRange();
      rangeFirst = range.getFirst();
      rangeLast = range.getLast();
    }
    protocol.write(protocol.new FeederInfoResp(feeders, rangeFirst, rangeLast), namedChannel);
  }