示例#1
0
  // Pass a response through the duplicate counters.
  public void handleInitiateResponseMessage(InitiateResponseMessage message) {
    // All single-partition reads are short-circuit reads and will have no duplicate counter.
    // SpScheduler will only see InitiateResponseMessages for SP transactions, so if it's
    // read-only here, it's short-circuited.  Avoid all the lookup below.  Also, don't update
    // the truncation handle, since it won't have meaning for anyone.
    if (message.isReadOnly()) {
      // the initiatorHSId is the ClientInterface mailbox. Yeah. I know.
      m_mailbox.send(message.getInitiatorHSId(), message);
      return;
    }

    final long spHandle = message.getSpHandle();
    final DuplicateCounterKey dcKey = new DuplicateCounterKey(message.getTxnId(), spHandle);
    DuplicateCounter counter = m_duplicateCounters.get(dcKey);
    if (counter != null) {
      int result = counter.offer(message);
      if (result == DuplicateCounter.DONE) {
        m_duplicateCounters.remove(dcKey);
        m_repairLogTruncationHandle = spHandle;
        m_mailbox.send(counter.m_destinationId, counter.getLastResponse());
      } else if (result == DuplicateCounter.MISMATCH) {
        VoltDB.crashLocalVoltDB("HASH MISMATCH: replicas produced different results.", true, null);
      }
    } else {
      // the initiatorHSId is the ClientInterface mailbox. Yeah. I know.
      m_repairLogTruncationHandle = spHandle;
      m_mailbox.send(message.getInitiatorHSId(), message);
    }
  }
示例#2
0
  // Eventually, the master for a partition set will need to be able to dedupe
  // FragmentResponses from its replicas.
  public void handleFragmentResponseMessage(FragmentResponseMessage message) {
    // Send the message to the duplicate counter, if any
    DuplicateCounter counter =
        m_duplicateCounters.get(new DuplicateCounterKey(message.getTxnId(), message.getSpHandle()));
    if (counter != null) {
      int result = counter.offer(message);
      if (result == DuplicateCounter.DONE) {
        m_duplicateCounters.remove(
            new DuplicateCounterKey(message.getTxnId(), message.getSpHandle()));
        m_repairLogTruncationHandle = message.getSpHandle();
        FragmentResponseMessage resp = (FragmentResponseMessage) counter.getLastResponse();
        // MPI is tracking deps per partition HSID.  We need to make
        // sure we write ours into the message getting sent to the MPI
        resp.setExecutorSiteId(m_mailbox.getHSId());
        m_mailbox.send(counter.m_destinationId, resp);
      } else if (result == DuplicateCounter.MISMATCH) {
        VoltDB.crashLocalVoltDB("HASH MISMATCH running multi-part procedure.", true, null);
      }
      // doing duplicate suppresion: all done.
      return;
    }

    m_mailbox.send(message.getDestinationSiteId(), message);
  }