Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-10277

Empty BATCH throws exception in Cassandra

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 2.2.2
    • None
    • None
    • Low

    Description

      Connect to Cassandra with cqlsh and perform empty BATCH statement:

      BEGIN BATCH  APPLY BATCH;

      Following exception is thrown and logged

      ERROR 14:02:07 Unexpected exception during request
      java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      	at java.util.ArrayList.rangeCheck(ArrayList.java:653) ~[na:1.8.0_45]
      	at java.util.ArrayList.get(ArrayList.java:429) ~[na:1.8.0_45]
      	at org.apache.cassandra.cql3.statements.BatchStatement$Parsed.prepare(BatchStatement.java:514) ~[main/:na]
      ...........................
      

      It's caused because of access to batch statement list, even if it's empty.
      Proposed patch (for 2.2.0) is attached.

      Attachments

        1. 10277.txt
          2 kB
          Michael Shuler
        2. emptybatch.patch
          1.0 kB
          Vovodroid
        3. emptytest.patch
          0.6 kB
          Vovodroid

        Activity

          People

            Unassigned Unassigned
            vovodroid Vovodroid
            Benjamin Lerer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: