Package org.apache.cassandra.db

Examples of org.apache.cassandra.db.ReadResponse


        public DataRepairHandler(Row localRow, int responseCount, ReadResponseResolver readResponseResolver) throws IOException
        {
            readResponseResolver_ = readResponseResolver;
            majority_ = (responseCount / 2) + 1;
            // wrap localRow in a response Message so it doesn't need to be special-cased in the resolver
            ReadResponse readResponse = new ReadResponse(localRow);
            Message fakeMessage = new Message(FBUtilities.getLocalAddress(), StorageService.Verb.INTERNAL_RESPONSE, ArrayUtils.EMPTY_BYTE_ARRAY);
            readResponseResolver_.injectPreProcessed(fakeMessage, readResponse);
        }
View Full Code Here


    {
        byte[] body = message.getMessageBody();
        FastByteArrayInputStream bufIn = new FastByteArrayInputStream(body);
        try
        {
            ReadResponse result = ReadResponse.serializer().deserialize(new DataInputStream(bufIn), message.getVersion());
            if (logger.isDebugEnabled())
                logger.debug("Preprocessed {} response", result.isDigestQuery() ? "digest" : "data");
            replies.put(message, result);
        }
        catch (IOException e)
        {
            throw new IOError(e);
View Full Code Here

      {
        byte[] body = response.getMessageBody();           
              bufIn.reset(body, body.length);
              try
              {                
                  ReadResponse result = ReadResponse.serializer().deserialize(bufIn);
                  byte[] digest = result.digest();
                  if( !Arrays.equals(row_.digest(), digest) )
          {
                    doReadRepair();
                    break;
          }
View Full Code Here

            byte[] body = response.getMessageBody();
            bufIn.reset(body, body.length);
            try
            {
                long start = System.currentTimeMillis();
                ReadResponse result = ReadResponse.serializer().deserialize(bufIn);
                logger_.debug( "Response deserialization time : " + (System.currentTimeMillis() - start) + " ms.");
          if(!result.isDigestQuery())
          {
            rowList.add(result.row());
            endPoints.add(response.getFrom());
            key = result.row().key();
            table = result.table();
          }
          else
          {
            digest = result.digest();
            isDigestQuery = true;
          }
            }
            catch( IOException ex )
            {
View Full Code Here

            byte[] body = response.getMessageBody();
      DataInputBuffer bufIn = new DataInputBuffer();
            bufIn.reset(body, body.length);
            try
            {
          ReadResponse result = ReadResponse.serializer().deserialize(bufIn);
          if(!result.isDigestQuery())
          {
            isDataPresent = true;
          }
                bufIn.close();
            }
View Full Code Here

         * query exists then we need to compare the digest with
         * the digest of the data that is received.
        */
    for (Message message : responses)
    {
            ReadResponse result = results.get(message);
            if (result == null)
                continue; // arrived after quorum already achieved
            if (result.isDigestQuery())
            {
                digest = result.digest();
                isDigestQuery = true;
            }
            else
            {
                versions.add(result.row().cf);
                endPoints.add(message.getFrom());
                key = result.row().key;
            }
        }

    // If there was a digest query compare it with all the data digests
    // If there is a mismatch then throw an exception so that read repair can happen.
View Full Code Here

    {
        byte[] body = message.getMessageBody();
        ByteArrayInputStream bufIn = new ByteArrayInputStream(body);
        try
        {
            ReadResponse result = ReadResponse.serializer().deserialize(new DataInputStream(bufIn));
            results.put(message, result);
        }
        catch (IOException e)
        {
            throw new IOError(e);
View Full Code Here

  {
        int digests = 0;
        int data = 0;
        for (Message message : responses)
        {
            ReadResponse result = results.get(message);
            if (result == null)
                continue; // arrived concurrently
            if (result.isDigestQuery())
                digests++;
            else
                data++;
        }
        return data > 0 && (data + digests >= responseCount);
View Full Code Here

            try
            {
                byte[] body = response.getMessageBody();
                ByteArrayInputStream bufIn = new ByteArrayInputStream(body);
                ReadResponse result = ReadResponse.serializer().deserialize(new DataInputStream(bufIn));
                byte[] digest = result.digest();

                if (!Arrays.equals(localDigest, digest))
                {
                    ReadResponseResolver readResponseResolver = new ReadResponseResolver(table_, replicas_.size());
                    IAsyncCallback responseHandler = new DataRepairHandler(row_, replicas_.size(), readResponseResolver);
View Full Code Here

        public DataRepairHandler(Row localRow, int responseCount, ReadResponseResolver readResponseResolver) throws IOException
        {
            readResponseResolver_ = readResponseResolver;
            majority_ = (responseCount / 2) + 1;
            // wrap localRow in a response Message so it doesn't need to be special-cased in the resolver
            ReadResponse readResponse = new ReadResponse(localRow);
            Message fakeMessage = new Message(FBUtilities.getLocalAddress(), StageManager.RESPONSE_STAGE, StorageService.Verb.READ_RESPONSE, ArrayUtils.EMPTY_BYTE_ARRAY);
            responses_.add(fakeMessage);
            readResponseResolver_.injectPreProcessed(fakeMessage, readResponse);
        }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.ReadResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.