Package org.apache.cassandra.db

Examples of org.apache.cassandra.db.ReadResponse


      {
        byte[] body = (byte[])response.getMessageBody()[0];           
              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


        for ( Object[] result : results )
        {
            byte[] body = (byte[])result[0];
            DataInputBuffer bufIn = new DataInputBuffer();
            bufIn.reset(body, body.length);
            ReadResponse response = ReadResponse.serializer().deserialize(bufIn);
            Row row = response.row();
            rows.put(row.key(), row);
        }       
        return rows;
    }
View Full Code Here

            throw new RuntimeException(e);
            // TODO retry to a different endpoint
        }
        DataInputBuffer bufIn = new DataInputBuffer();
        bufIn.reset(body, body.length);
        ReadResponse response = ReadResponse.serializer().deserialize(bufIn);
        return response.row();
    }
View Full Code Here

            byte[] body = (byte[])response.getMessageBody()[0];           
            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 = (byte[])response.getMessageBody()[0];
      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

    {
        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

         * 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

     */
    public Row getData() throws IOException
    {
        for (MessageIn<ReadResponse> message : replies)
        {
            ReadResponse result = message.payload;
            if (!result.isDigestQuery())
                return result.row();
        }

        throw new AssertionError("getData should not be invoked when no data is present");
    }
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.