Connection timed out while dropping keyspace

496 views
Skip to first unread message

HM

unread,
Apr 12, 2017, 8:13:44 PM4/12/17
to DataStax Java Driver for Apache Cassandra User Mailing List
I'm having trouble deleting a keyspace. 

The keyspace in question has 4 tables similar to this one:

CREATE KEYSPACE demo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = false;

CREATE TABLE demo.t1 (
    t11 int,
    t12 timeuuid,
    t13 int,
    t14 text,
    t15 text,
    t16 boolean,
    t17 boolean,
    t18 int,
    t19 timeuuid,
    t110 text,
    PRIMARY KEY (t11, t12)
) WITH CLUSTERING ORDER BY (t13 DESC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    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 = '99PERCENTILE';
CREATE INDEX t1_idx ON pathstore_applications.funcs (t14);
CREATE INDEX t1_deleted_idx ON pathstore_applications.funcs (t15);



When I want to delete the keyspace using the command:

Session session = cluster.connect();
PreparedStatement prepared = session.prepare("drop keyspace if exists " + schemaName);
BoundStatement bound = prepared.bind();
session.execute(bound);

Then the query gets timed out (or takes over 10 seconds to execute), even when the tables are empty:

com.datastax.driver.core.exceptions.OperationTimedOutException: [/192.168.0.1:9042] Timed out waiting for server response
        at com.datastax.driver.core.exceptions.OperationTimedOutException.copy(OperationTimedOutException.java:44)
        at com.datastax.driver.core.exceptions.OperationTimedOutException.copy(OperationTimedOutException.java:26)
        at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37)
        at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245)
        at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:64)
        at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:39)

I tried this on multiple machines and the result was the same. I'm using Cassandra 3.9. A similar thing happens using cqlsh. I know that I can increase the read timeout in the cassandra.yaml file, but how can I make this dropping faster? Another thing is that if I do two consecutive requests, the first one gets timed out and the second one goes through fast.

Alexandre Dutra

unread,
Apr 13, 2017, 12:11:19 PM4/13/17
to DataStax Java Driver for Apache Cassandra User Mailing List
Hi,

OperationTimedOutException means that the driver timed out, not the server. 

Modifying the server timeout will not solve the problem, but you can work around it by raising the driver timeout instead, which defaults to 12 seconds. You can do it either cluster-wise or on a per-statement basis (the latter should be more appropriate for you, since it's just for a specific statement).

As for the root problem, you could maybe ask on the Cassandra user mailing list for help. As a driver developer, I can only confirm that DROP statements, and in particular DROP KEYSPACE statements tend to be extremely slow (BTW you are not supposed to drop keyspaces so often in your application).

Thanks,

Alexandre


--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.
--
Alexandre Dutra
Driver & Tools Engineer @ DataStax
Reply all
Reply to author
Forward
0 new messages