This error occurs with elassandra 5.5.018 and 6.2.3.2. I have this table structure:
CREATE TYPE applicationinfo (
industry text,
area_of_application text,
product_group text,
sic_code text,
conveyed_product text,
flowability text,
viscosity text,
solids_content text,
size_of_solids text,
concentration text,
composition text,
specific_gravity text,
ph_value text,
product_temperature_min int,
product_temperature_max int
);
CREATE TABLE deviceinfo (
id text,
"applicationinfo" applicationinfo
PRIMARY KEY (id)
);
In my test-case there are some (about 100 entries inserted). When i try to create an elastic index for the deviceinfo table it fails with this exception:
2018-07-04 14:49:56,894 ERROR [SecondaryIndexManagement:3] CassandraDaemon.java:231 uncaughtException Exception in thread Thread[SecondaryIndexManagement:3,5,main]
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.nio.BufferUnderflowException
at org.apache.cassandra.utils.Throwables.maybeFail(Throwables.java:51)
at org.apache.cassandra.utils.FBUtilities.waitOnFutures(FBUtilities.java:373)
at org.apache.cassandra.index.SecondaryIndexManager.buildIndexesBlocking(SecondaryIndexManager.java:392)
at org.apache.cassandra.index.SecondaryIndexManager.buildIndexesBlocking(SecondaryIndexManager.java:367)
at org.apache.cassandra.index.SecondaryIndexManager.buildIndexBlocking(SecondaryIndexManager.java:288)
at org.elassandra.index.ElasticSecondaryIndex.lambda$getInitializationTask$5(ElasticSecondaryIndex.java:2266)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.cassandra.concurrent.NamedThreadFactory.lambda$threadLocalDeallocator$0(NamedThreadFactory.java:81)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: java.nio.BufferUnderflowException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.cassandra.utils.FBUtilities.waitOnFutures(FBUtilities.java:366)
... 9 common frames omitted
What am I doing wrong?
Answering own question. The issue has been resolved here:
https://github.com/strapdata/elassandra/issues/210
The solution is to freeze the udt fields:
CREATE TABLE deviceinfo (
id text,
"applicationinfo" frozen<applicationinfo>,
baseinfo frozen<baseinfo>,
"product" frozen<product>,
"specification" frozen<specification>,
"technicaldata" frozen<technicaldata>,
"customer" frozen<customer>,
PRIMARY KEY (id)
);