public void doVerb(Message message, String id) {
      byte[] bytes = message.getMessageBody();
      DataInputStream buffer = new DataInputStream(new FastByteArrayInputStream(bytes));

      try {
        // deserialize the remote tree, and register it
        Validator response = this.deserialize(buffer, message.getVersion());
        TreeRequest request =
            new TreeRequest(
                response.request.sessionid,
                message.getFrom(),
                response.request.range,
                response.request.cf);
        AntiEntropyService.instance.rendezvous(request, response.tree);
      } catch (IOException e) {
        throw new IOError(e);
      }
    }
    /** Trigger a validation compaction which will return the tree upon completion. */
    public void doVerb(Message message, String id) {
      byte[] bytes = message.getMessageBody();

      DataInputStream buffer = new DataInputStream(new FastByteArrayInputStream(bytes));
      try {
        TreeRequest remotereq = this.deserialize(buffer, message.getVersion());
        TreeRequest request =
            new TreeRequest(remotereq.sessionid, message.getFrom(), remotereq.range, remotereq.cf);

        // trigger readonly-compaction
        ColumnFamilyStore store =
            Table.open(request.cf.left).getColumnFamilyStore(request.cf.right);
        Validator validator = new Validator(request);
        logger.debug("Queueing validation compaction for " + request);
        CompactionManager.instance.submitValidation(store, validator);
      } catch (IOException e) {
        throw new IOError(e);
      }
    }
Ejemplo n.º 3
0
  /**
   * Takes an stream request message and creates an empty status response. Exists here because
   * StreamRequestMessage is package protected.
   */
  public static void finishStreamRequest(Message msg, InetAddress to) {
    byte[] body = msg.getMessageBody();
    ByteArrayInputStream bufIn = new ByteArrayInputStream(body);

    try {
      StreamRequestMessage srm =
          StreamRequestMessage.serializer()
              .deserialize(new DataInputStream(bufIn), MessagingService.version_);
      StreamInSession session = StreamInSession.get(to, srm.sessionId);
      session.closeIfFinished();
    } catch (Exception e) {
      System.err.println(e);
      e.printStackTrace();
    }
  }
Ejemplo n.º 4
0
 public static IndexScanCommand read(Message message) throws IOException {
   byte[] bytes = message.getMessageBody();
   FastByteArrayInputStream bis = new FastByteArrayInputStream(bytes);
   return serializer.deserialize(new DataInputStream(bis), message.getVersion());
 }