[Solved] Debugging Cassandra in CQLSH - ArrayIndexOutOfBoundsException

EverSQL Database Performance Knowledge Base

Debugging Cassandra in CQLSH - ArrayIndexOutOfBoundsException

I am running some Cassandra queries. When I run

select * from logtable;

I get this error:

<ErrorMessage code=0000 [Server error] message="java.lang.ArrayIndexOutOfBoundsException">

However, if I run with limits, some rows are OK:

select * from logtable limit 100;

This works. I keep increasing the limit and eventually, I get the error again. It's obvious that our software adds some corrupted data. My question is this: is there a way to find out what is happening using cqlsh? I can't study the code, because it's extremely messed up, it's a nightmare. I couldn't find anything useful in system.log. This is the table:

cqlsh:mykeyspace> desc table logtable

CREATE TABLE mykeyspace.logtable (
    key text,
    key2 text,
    column1 text,
    column2 text,
    column3 text,
    column4 text,
    value blob,
    PRIMARY KEY ((key, key2), column1, column2, column3, column4)
) WITH COMPACT STORAGE
    AND CLUSTERING ORDER BY (column1 ASC, column2 ASC, column3 ASC, column4 ASC)
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    AND comment = ''
    AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = 'NONE';

Thanks.

Regards, Serban

How to optimize this SQL query?

The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:

  1. Description of the steps you can take to speed up the query.
  2. The optimal indexes for this query, which you can copy and create in your database.
  3. An automatically re-written query you can copy and execute in your database.
The optimization process and recommendations:
  1. Avoid Selecting Unnecessary Columns (query line: 2): Avoid selecting all columns with the '*' wildcard, unless you intend to use them all. Selecting redundant columns may result in unnecessary performance degradation.
The optimized query:
SELECT
        * 
    FROM
        logtable

Related Articles



* original question posted on StackOverflow here.