Examples of ReadCommand


Examples of org.apache.cassandra.db.ReadCommand

    {
      IResponseResolver<Row> readResponseResolver = new ReadResponseResolver();
            /* Add the local storage endpoint to the replicas_ list */
            replicas_.add(FBUtilities.getLocalAddress());
      IAsyncCallback responseHandler = new DataRepairHandler(ConsistencyManager.this.replicas_.size(), readResponseResolver)
            ReadCommand readCommand = constructReadMessage(false);
            Message message = readCommand.makeReadMessage();
            if (logger_.isDebugEnabled())
              logger_.debug("Performing read repair for " + readCommand_.key + " to " + message.getMessageId() + "@[" + StringUtils.join(replicas_, ", ") + "]");
      MessagingService.instance().sendRR(message, replicas_.toArray(new InetAddress[replicas_.size()]), responseHandler);
    }
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

        {

            ByteBuffer key = CassandraUtils.hashKeyBytes(indexName.getBytes("UTF-8"), CassandraUtils.delimeterBytes,
                    "shards".getBytes("UTF-8"));

            ReadCommand cmd = new SliceFromReadCommand(CassandraUtils.keySpace, key, new ColumnParent(
                    CassandraUtils.schemaInfoColumnFamily), ByteBufferUtil.EMPTY_BYTE_BUFFER,
                    ByteBufferUtil.EMPTY_BYTE_BUFFER, false, Integer.MAX_VALUE);

            List<Row> rows = CassandraUtils.robustRead(ConsistencyLevel.QUORUM, cmd);
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

        this.dataSource = dataSource;
    }

    public void run()
  {
        ReadCommand readCommandDigestOnly = constructReadMessage(true);
    try
    {
      Message message = readCommandDigestOnly.makeReadMessage();
            if (logger_.isDebugEnabled())
              logger_.debug("Reading consistency digest for " + readCommand_.key + " from " + message.getMessageId() + "@[" + StringUtils.join(replicas_, ", ") + "]");

            MessagingService.instance.addCallback(new DigestResponseHandler(), message.getMessageId());
            for (InetAddress endpoint : replicas_)
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

    }
  }

    private ReadCommand constructReadMessage(boolean isDigestQuery)
    {
        ReadCommand readCommand = readCommand_.copy();
        readCommand.setDigestQuery(isDigestQuery);
        return readCommand;
    }
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

                ReadResponse result = ReadResponse.serializer().deserialize(new DataInputStream(bufIn));
                ByteBuffer digest = result.digest();

                if (!localDigest.equals(digest))
                {
                    ReadCommand readCommand = constructReadMessage(false);
                    Message message = readCommand.makeReadMessage();
                    if (logger_.isDebugEnabled())
                        logger_.debug("Digest mismatch; re-reading " + readCommand_.key + " from " + message.getMessageId() + "@[" + StringUtils.join(replicas_, ", ") + "]");                        
                    MessagingService.instance.addCallback(new DataRepairHandler(), message.getMessageId());
                    for (InetAddress endpoint : replicas_)
                    {
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

        ThriftValidation.validateColumnPath(keyspace, column_path);

        QueryPath path = new QueryPath(column_path.column_family, column_path.column == null ? null : column_path.super_column);
        List<ByteBuffer> nameAsList = Arrays.asList(column_path.column == null ? column_path.super_column : column_path.column);
        ThriftValidation.validateKey(key);
        ReadCommand command = new SliceByNamesReadCommand(keyspace, key, path, nameAsList);

        Map<DecoratedKey, ColumnFamily> cfamilies = readColumnFamily(Arrays.asList(command), consistency_level);

        ColumnFamily cf = cfamilies.get(StorageService.getPartitioner().decorateKey(command.key));
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

            catch (DigestMismatchException e)
            {
                if (logger.isDebugEnabled())
                    logger.debug("Digest mismatch:", e);

                ReadCommand readCommand = (ReadCommand) command;
                final RowRepairResolver repairResolver = new RowRepairResolver(readCommand.table, readCommand.key);
                IAsyncCallback repairHandler = new AsyncRepairCallback(repairResolver, endpoints.size());

                Message messageRepair = readCommand.makeReadMessage();
                for (InetAddress endpoint : endpoints)
                    MessagingService.instance().sendRR(messageRepair, endpoint, repairHandler);
            }
        }
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

        */
        private void onDigestMismatch(String key) throws IOException
        {
            if ( DatabaseDescriptor.getConsistencyCheck())
            {                               
                ReadCommand readCommand = readMessages_.get(key);
                readCommand.setDigestQuery(false);
                Message messageRepair = readCommand.makeReadMessage();
                EndPoint[] endpoints = MultiQuorumResponseHandler.this.endpoints_.get(readCommand.key);
                Message[][] messages = new Message[][]{ {messageRepair, messageRepair, messageRepair} };
                EndPoint[][] epList = new EndPoint[][]{ endpoints };
                MessagingService.getMessagingInstance().sendRR(messages, epList, MultiQuorumResponseHandler.this);               
            }
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

                if (logger.isDebugEnabled())
                    logger.debug("Digest mismatch:", e);
               
                ReadRepairMetrics.repairedBackground.mark();
               
                ReadCommand readCommand = (ReadCommand) command;
                final RowDataResolver repairResolver = new RowDataResolver(readCommand.ksName, readCommand.key, readCommand.filter(), readCommand.timestamp);
                AsyncRepairCallback repairHandler = new AsyncRepairCallback(repairResolver, endpoints.size());

                MessageOut<ReadCommand> message = ((ReadCommand) command).createMessage();
                for (InetAddress endpoint : endpoints)
                    MessagingService.instance().sendRR(message, endpoint, repairHandler);
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

                if (logger.isDebugEnabled())
                    logger.debug("Digest mismatch:", e);
               
                ReadRepairMetrics.repairedBackground.mark();
               
                ReadCommand readCommand = (ReadCommand) command;
                final RowDataResolver repairResolver = new RowDataResolver(readCommand.ksName, readCommand.key, readCommand.filter(), readCommand.timestamp);
                AsyncRepairCallback repairHandler = new AsyncRepairCallback(repairResolver, endpoints.size());

                MessageOut<ReadCommand> message = ((ReadCommand) command).createMessage();
                for (InetAddress endpoint : endpoints)
                    MessagingService.instance().sendRR(message, endpoint, repairHandler);
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.