Package org.apache.cassandra.io

Examples of org.apache.cassandra.io.DataInputBuffer


            }
            catch (TimeoutException e)
            {
                throw new TimedOutException();
            }
            DataInputBuffer bufIn = new DataInputBuffer();
            bufIn.reset(body, body.length);
            ReadResponse response = ReadResponse.serializer().deserialize(bufIn);
            if (response.row() != null)
                rows.add(response.row());
            commandIndex++;
        }
View Full Code Here


                handleDigestResponses();
        }
   
    private void handleDigestResponses()
    {
            DataInputBuffer bufIn = new DataInputBuffer();
            for (Message response : responses_)
            {
                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();
View Full Code Here

    private static Logger logger_ = Logger.getLogger(RowMutationVerbHandler.class);

    public void doVerb(Message message)
    {
        byte[] bytes = message.getMessageBody();
        DataInputBuffer buffer = new DataInputBuffer();
        buffer.reset(bytes, bytes.length);

        try
        {
            RowMutation rm = RowMutation.serializer().deserialize(buffer);
            if (logger_.isDebugEnabled())
View Full Code Here

    {
        Set<Table> tablesRecovered = new HashSet<Table>();
        assert StageManager.getStage(StageManager.mutationStage_).getCompletedTasks() == 0;
        int rows = 0;

        DataInputBuffer bufIn = new DataInputBuffer();
        for (File file : clogs)
        {
            int bufferSize = (int)Math.min(file.length(), 32 * 1024 * 1024);
            BufferedRandomAccessFile reader = new BufferedRandomAccessFile(file.getAbsolutePath(), "r", bufferSize);
            final CommitLogHeader clHeader = readCommitLogHeader(reader);
            /* seek to the lowest position where any CF has non-flushed data */
            int lowPos = CommitLogHeader.getLowestPosition(clHeader);
            if (lowPos == 0)
                break;

            reader.seek(lowPos);
            if (logger_.isDebugEnabled())
                logger_.debug("Replaying " + file + " starting at " + lowPos);

            /* read the logs populate RowMutation and apply */
            while (!reader.isEOF())
            {
                if (logger_.isDebugEnabled())
                    logger_.debug("Reading mutation at " + reader.getFilePointer());

                byte[] bytes;
                try
                {
                    bytes = new byte[(int) reader.readLong()]; // readlong can throw EOFException too
                    reader.readFully(bytes);
                }
                catch (EOFException e)
                {
                    // last CL entry didn't get completely written.  that's ok.
                    break;
                }
                bufIn.reset(bytes, bytes.length);

                /* read the commit log entry */
                final RowMutation rm = RowMutation.serializer().deserialize(bufIn);
                if (logger_.isDebugEnabled())
                    logger_.debug(String.format("replaying mutation for %s.%s: %s",
View Full Code Here

       
        /* Cannot bootstrap another node if I'm in bootstrap mode myself! */
        assert !StorageService.instance().isBootstrapMode();
       
        byte[] body = message.getMessageBody();
        DataInputBuffer bufIn = new DataInputBuffer();
        bufIn.reset(body, body.length);
        try
        {
            BootstrapMetadataMessage bsMetadataMessage = BootstrapMetadataMessage.serializer().deserialize(bufIn);
            BootstrapMetadata[] bsMetadata = bsMetadataMessage.bsMetadata_;

View Full Code Here

    private static Logger logger_ = Logger.getLogger(ReadRepairVerbHandler.class);   
   
    public void doVerb(Message message)
    {         
        byte[] body = message.getMessageBody();
        DataInputBuffer buffer = new DataInputBuffer();
        buffer.reset(body, body.length);       
       
        try
        {
            RowMutationMessage rmMsg = RowMutationMessage.serializer().deserialize(buffer);
            RowMutation rm = rmMsg.getRowMutation();
View Full Code Here

    public void doVerb(Message message)
    {
        try
        {
          byte[] body = message.getMessageBody();
            DataInputBuffer buffer = new DataInputBuffer();
            buffer.reset(body, body.length);
          RowMutationMessage rmMsg = RowMutationMessage.serializer().deserialize(buffer);

            EndPoint[] endpoints = StorageService.instance().getNStorageEndPoint(rmMsg.getRowMutation().key());

      Message messageInternal = new Message(StorageService.getLocalStorageEndPoint(),
View Full Code Here

     * Populate the list of rows from each of the messages
     * Check to see if there is a digest query. If a digest
         * query exists then we need to compare the digest with
         * the digest of the data that is received.
        */
        DataInputBuffer bufIn = new DataInputBuffer();
    for (Message response : responses)
    {                     
            byte[] body = response.getMessageBody();
            bufIn.reset(body, body.length);
            try
            {
                long start = System.currentTimeMillis();
                ReadResponse result = ReadResponse.serializer().deserialize(bufIn);
                if (logger_.isDebugEnabled())
View Full Code Here

  {
    boolean isDataPresent = false;
    for (Message response : responses)
    {
            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();
            }
            catch(IOException ex)
            {
                logger_.info(LogUtil.throwableToString(ex));
            }                       
View Full Code Here

         * receiving end.
        */
        public void doVerb(Message message)
        {
            byte[] body = message.getMessageBody();
            DataInputBuffer bufIn = new DataInputBuffer();
            bufIn.reset(body, body.length);
           
            try
            {
                BootstrapInitiateMessage biMsg = BootstrapInitiateMessage.serializer().deserialize(bufIn);
                StreamContextManager.StreamContext[] streamContexts = biMsg.getStreamContext();               
View Full Code Here

TOP

Related Classes of org.apache.cassandra.io.DataInputBuffer

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.