Examples of ReadResponse


Examples of org.apache.cassandra.db.ReadResponse

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

Examples of org.apache.cassandra.db.ReadResponse

        ColumnFamily data = null;
        ByteBuffer digest = null;

        for (MessageIn<ReadResponse> message : replies)
        {
            ReadResponse response = message.payload;
            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;
            }
        }

        // Compare digest (only one, since we threw earlier if there were different replies)
        // with the data response. 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

        DataInputBuffer bufIn = new DataInputBuffer();
    for (Message response : responses)
    {                     
            byte[] body = response.getMessageBody();
            bufIn.reset(body, body.length);
            ReadResponse result = ReadResponse.serializer().deserialize(bufIn);
            if (result.isDigestQuery())
            {
                digest = result.digest();
                isDigestQuery = true;
            }
            else
            {
                versions.add(result.row().cf);
                endPoints.add(response.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.
        if (isDigestQuery)
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

            {
                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(ColumnFamily.digest(row_.cf), digest))
                    {
                        doReadRepair();
                        break;
                    }
View Full Code Here

Examples of org.apache.cassandra.db.ReadResponse

        */
    for (Message response : responses)
    {                     
            byte[] body = response.getMessageBody();
            ByteArrayInputStream bufIn = new ByteArrayInputStream(body);
            ReadResponse result = ReadResponse.serializer().deserialize(new DataInputStream(bufIn));
            if (result.isDigestQuery())
            {
                digest = result.digest();
                isDigestQuery = true;
            }
            else
            {
                versions.add(result.row().cf);
                endPoints.add(response.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.
        if (isDigestQuery)
View Full Code Here

Examples of org.apache.cassandra.db.ReadResponse

        {
            byte[] body = response.getMessageBody();
            ByteArrayInputStream bufIn = new ByteArrayInputStream(body);
            try
            {
                ReadResponse result = ReadResponse.serializer().deserialize(new DataInputStream(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(ColumnFamily.digest(row_.cf), digest))
                    {
                        doReadRepair();
                        break;
                    }
View Full Code Here

Examples of org.apache.cassandra.db.ReadResponse

          StorageService.readVerbHandler_,
          new Object[] {readCommand});
      IAsyncResult iar = MessagingService.getMessagingInstance().sendRR(
          message, to_);
      Object[] result = iar.get();
      ReadResponse readResponse = (ReadResponse) result[0];
      Row row = readResponse.row();
      if (row == null) {
        logger_.debug("ERROR No row for this key .....: " + line);
                Thread.sleep(1000/requestsPerSecond_, 1000%requestsPerSecond_);
        errorCount_++;
      } else {
View Full Code Here

Examples of org.apache.cassandra.db.ReadResponse

        DataInputBuffer bufIn = new DataInputBuffer();
    for (Message response : responses)
    {                     
            byte[] body = response.getMessageBody();
            bufIn.reset(body, body.length);
            ReadResponse result = ReadResponse.serializer().deserialize(bufIn);
            if (result.isDigestQuery())
            {
                digest = result.digest();
                isDigestQuery = true;
            }
            else
            {
                rowList.add(result.row());
                endPoints.add(response.getFrom());
                key = result.row().key();
                table = result.row().getTable();
            }
        }
    // 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.
        if (isDigestQuery)
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.