Bug: sstableloader cannot parse schema of tables with CQL duration type
Status: Open
Priority: Normal
Created: 31/Jul/20 01:10

h2. Symptom
A user reported issues bulk loading data with {{sstableloader}} on C* 3.11 for a table with columns of type {{duration}}:

{noformat}
ERROR 17:38:10,726 Error parsing schema for table datakeyspace.retrylog: Cluster.getMetadata().getKeyspace("datakeyspace").getTable("retrylog") will be missing or incomplete
com.datastax.driver.core.exceptions.UnresolvedUserTypeException: Cannot resolve user type datakeyspace.duration
        at com.datastax.driver.core.DataTypeCqlNameParser.parse(DataTypeCqlNameParser.java:147) ~[cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.TableMetadata.build(TableMetadata.java:188) ~[cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.SchemaParser.buildTables(SchemaParser.java:176) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.SchemaParser.buildKeyspaces(SchemaParser.java:128) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.SchemaParser.refresh(SchemaParser.java:64) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.ControlConnection.refreshSchema(ControlConnection.java:343) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.ControlConnection.tryConnect(ControlConnection.java:273) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:201) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1424) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.Cluster.init(Cluster.java:163) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:334) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:309) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at com.datastax.driver.core.Cluster.connect(Cluster.java:251) [cassandra-driver-core-3.0.1-shaded.jar:na]
        at org.apache.cassandra.utils.NativeSSTableLoaderClient.init(NativeSSTableLoaderClient.java:73) [apache-cassandra-3.11.3.jar:3.11.3]
{noformat}

h2. Cause
Support for {{duration}} type was added to Java driver 3.2.0 ([JAVA-1347|https://datastax-oss.atlassian.net/browse/JAVA-1347]). The shaded driver included in Cassandra 3.11 is old and does support the {{duration}} type:

{noformat}
lib/cassandra-driver-core-3.0.1-shaded.jar
{noformat}

h2. Workaround
*Step 1* - Download a newer version of the Java driver from Maven in the same 3.x family. For example:
https://mvnrepository.com/artifact/com.datastax.cassandra/cassandra-driver-core/3.10.0

*Step 2* - Swap out the old JAR with {{cassandra-driver-core-3.10.0-shaded.jar}}.

*Step 3* - Re-run {{sstableloader}}.

h2. Solution
I recommend we update the Java driver version in the next patch release of C* 3.11.