Package org.apache.cassandra.db

Examples of org.apache.cassandra.db.ReadCommand


  }

  public void run()
  {
    logger_.debug(" Run the consistency checks for " + columnFamily_);   
        ReadCommand readCommandDigestOnly = constructReadMessage(true);
    try
    {
      Message messageDigestOnly = readCommandDigestOnly.makeReadMessage();
      IAsyncCallback digestResponseHandler = new DigestResponseHandler();
      MessagingService.getMessagingInstance().sendRR(messageDigestOnly, replicas_.toArray(new EndPoint[0]), digestResponseHandler);
    }
    catch ( IOException ex )
    {
View Full Code Here


    }
  }
   
    private ReadCommand constructReadMessage(boolean isDigestQuery)
    {
        ReadCommand readCommand = null;
        String table = DatabaseDescriptor.getTables().get(0);
       
        if(columnNames_.size() == 0)
        {
            if( start_ >= 0 && count_ < Integer.MAX_VALUE)
            {
                readCommand = new ReadCommand(table, row_.key(), columnFamily_, start_, count_);
            }
            else if(sinceTimestamp_ > 0)
            {
                readCommand = new ReadCommand(table, row_.key(), columnFamily_, sinceTimestamp_);
            }
            else
            {
                readCommand = new ReadCommand(table, row_.key(), columnFamily_);
            }
        }
        else
        {
            readCommand = new ReadCommand(table, row_.key(), columnFamily_, columnNames_);
           
        }
        readCommand.setDigestQuery(isDigestQuery);
        return readCommand;
    }
View Full Code Here

      IResponseResolver<Row> readResponseResolver = new ReadResponseResolver();
            /* Add the local storage endpoint to the replicas_ list */
            replicas_.add(StorageService.getLocalStorageEndPoint());
      IAsyncCallback responseHandler = new DataRepairHandler(ConsistencyManager.this.replicas_.size(), readResponseResolver)
      String table = DatabaseDescriptor.getTables().get(0);
            ReadCommand readCommand = constructReadMessage(false);
      // ReadMessage readMessage = new ReadMessage(table, row_.key(), columnFamily_);
            Message message = readCommand.makeReadMessage();
      MessagingService.getMessagingInstance().sendRR(message, replicas_.toArray( new EndPoint[0] ), responseHandler);     
    }
View Full Code Here

        for (String key : keys )
        {
            ReadCommand[] readParameters = new ReadCommand[2];
            if( start >= 0 && count < Integer.MAX_VALUE)
            {
                readParameters[0] = new ReadCommand(tablename, key, columnFamily, start, count);
            }
            else
            {
                readParameters[0] = new ReadCommand(tablename, key, columnFamily);
            }           
            if( start >= 0 && count < Integer.MAX_VALUE)
            {
                readParameters[1] = new ReadCommand(tablename, key, columnFamily, start, count);
            }
            else
            {
                readParameters[1] = new ReadCommand(tablename, key, columnFamily);
            }
            readParameters[1].setDigestQuery(true);
        }       
        rows = doStrongReadProtocol(readMessages);        
        logger_.debug("readProtocol: " + (System.currentTimeMillis() - startTime) + " ms.");
View Full Code Here

     */
    private static Row strongRead(ReadCommand command) throws IOException, TimeoutException
    {
        // TODO: throw a thrift exception if we do not have N nodes

        ReadCommand readMessageDigestOnly = command.copy();
        readMessageDigestOnly.setDigestQuery(true);

        Row row = null;
        Message message = command.makeReadMessage();
        Message messageDigestOnly = readMessageDigestOnly.makeReadMessage();

        IResponseResolver<Row> readResponseResolver = new ReadResponseResolver();
        QuorumResponseHandler<Row> quorumResponseHandler = new QuorumResponseHandler<Row>(
                DatabaseDescriptor.getReplicationFactor(),
                readResponseResolver);
View Full Code Here

        Row row = null;
        long startTime = System.currentTimeMillis();
        Map<String, ReadCommand> readMessages = new HashMap<String, ReadCommand>();
        for ( String key : keys )
        {
            ReadCommand readCommand = new ReadCommand(tablename, key, columnFamily, columns);
            readMessages.put(key, readCommand);
        }
        /* Performs the multiget in parallel */
        Map<String, Row> rows = doReadProtocol(readMessages);
        /*
 
View Full Code Here

        Row row = null;
        long startTime = System.currentTimeMillis();
        Map<String, ReadCommand> readMessages = new HashMap<String, ReadCommand>();
        for ( String key : keys )
        {
            ReadCommand readCommand = new ReadCommand(tablename, key, columnFamily, start, count);
            readMessages.put(key, readCommand);
        }
        /* Performs the multiget in parallel */
        Map<String, Row> rows = doReadProtocol(readMessages);
        /*
 
View Full Code Here

        Row row = null;
        long startTime = System.currentTimeMillis();
        Map<String, ReadCommand> readMessages = new HashMap<String, ReadCommand>();
        for ( String key : keys )
        {
            ReadCommand readCommand = new ReadCommand(tablename, key, columnFamily, sinceTimestamp);
            readMessages.put(key, readCommand);
        }
        /* Performs the multiget in parallel */
        Map<String, Row> rows = doReadProtocol(readMessages);
        /*
 
View Full Code Here

      {
        int key = random.nextInt(keys) + 1;
              String stringKey = new Integer(key).toString();
              stringKey = stringKey + keyFix_ ;
              int j = random.nextInt(columns) + 1;
              ReadCommand rm = new ReadCommand(tablename_, stringKey, columnFamilyColumn_ + ":" + columnFix_ + j);
              readLoad(rm);
        if ( requestsPerSecond_ > 1000)
          Thread.sleep(0, 1000000000/requestsPerSecond_);
        else
          Thread.sleep(1000/requestsPerSecond_);
View Full Code Here

        int key = random.nextInt(keys) + 1;
              String stringKey = new Integer(key).toString();
              stringKey = stringKey + keyFix_ ;
              int i = random.nextInt(superColumns) + 1;
              int j = random.nextInt(columns) + 1;
              ReadCommand rm = new ReadCommand(tablename_, stringKey, columnFamilySuperColumn_ + ":" + superColumnFix_ + i + ":" + columnFix_ + j);
              readLoad(rm);
      }
    }
    catch(Exception ex)
    {
View Full Code Here

TOP

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

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.