Examples of ReadResponse


Examples of org.apache.cassandra.db.ReadResponse

            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

Examples of org.apache.cassandra.db.ReadResponse

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

Examples of org.apache.cassandra.db.ReadResponse

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

                if (!localDigest.equals(digest))
                {
                    ReadCommand readCommand = constructReadMessage(false);
                    Message message = readCommand.makeReadMessage();
View Full Code Here

Examples of org.apache.cassandra.db.ReadResponse

        public DataRepairHandler() throws IOException
        {
            readResponseResolver_ = new ReadResponseResolver(readCommand_.table, readCommand_.key);
            majority_ = (replicas_.size() / 2) + 1;
            // wrap original data Row in a response Message so it doesn't need to be special-cased in the resolver
            ReadResponse readResponse = new ReadResponse(row_);
            Message fakeMessage = new Message(dataSource, StorageService.Verb.INTERNAL_RESPONSE, ArrayUtils.EMPTY_BYTE_ARRAY);
            readResponseResolver_.injectPreProcessed(fakeMessage, readResponse);
        }
View Full Code Here

Examples of org.apache.cassandra.db.ReadResponse

    {
        byte[] body = message.getMessageBody();
        ByteArrayInputStream bufIn = new ByteArrayInputStream(body);
        try
        {
            ReadResponse result = ReadResponse.serializer().deserialize(new DataInputStream(bufIn));
            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

Examples of org.apache.cassandra.db.ReadResponse

            byte[] body = response.getMessageBody();
            bufIn.reset(body, body.length);
            try
            {
                long start = System.currentTimeMillis();
                ReadResponse result = ReadResponse.serializer().deserialize(bufIn);
                if (logger_.isDebugEnabled())
                  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.row().getTable();
          }
          else
          {
            digest = result.digest();
            isDigestQuery = true;
          }
            }
            catch( IOException ex )
            {
View Full Code Here

Examples of org.apache.cassandra.db.ReadResponse

            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

Examples of org.apache.cassandra.db.ReadResponse

   
    public Row getData() throws IOException
    {
        for (Map.Entry<Message, ReadResponse> entry : replies.entrySet())
        {
            ReadResponse result = entry.getValue();
            if (!result.isDigestQuery())
                return result.row();
        }

        throw new AssertionError("getData should not be invoked when no data is present");
    }
View Full Code Here

Examples of org.apache.cassandra.db.ReadResponse

        // when resolve() is called a second time for read repair on responses that were not
        // necessary to satisfy ConsistencyLevel.
        ByteBuffer digest = null;
        for (Map.Entry<Message, ReadResponse> entry : replies.entrySet())
        {
            ReadResponse response = entry.getValue();
            if (response.isDigestQuery())
            {
                if (digest == null)
                {
                    digest = response.digest();
                }
                else
                {
                    ByteBuffer digest2 = response.digest();
                    if (!digest.equals(digest2))
                        throw new DigestMismatchException(key, digest, digest2);
                }
            }
            else
            {
                data = response.row().cf;
            }
        }

    // 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

Examples of org.apache.cassandra.db.ReadResponse

    {
        byte[] body = message.getMessageBody();
        ByteArrayInputStream bufIn = new ByteArrayInputStream(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
TOP
Copyright © 2018 www.massapi.com. 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.