cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aleksey Yeschenko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-8095) create table query not working in concurrent
Date Tue, 14 Oct 2014 12:47:33 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-8095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14170863#comment-14170863
] 

Aleksey Yeschenko commented on CASSANDRA-8095:
----------------------------------------------

What's concurrent about it?

> create table query not working in concurrent
> --------------------------------------------
>
>                 Key: CASSANDRA-8095
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8095
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: 2.1.0 on Ubuntu 14.04
>            Reporter: Katsutoshi Nagaoka
>
> After 2.1.0, I have encountered the strange behavior of create table.
> When I executed create table query in concurrent, 
> {code}
> package cassandra.test;
> import com.datastax.driver.core.Cluster;
> import com.datastax.driver.core.Session;
> import java.util.ArrayList;
> import java.util.List;
> import java.util.concurrent.ExecutorService;
> import java.util.concurrent.Executors;
> import java.util.concurrent.Future;
> import java.util.concurrent.TimeUnit;
> public class ConcurrentCreateTable {
>     public static void main(String[] args) {
>         ConcurrentCreateTable instance = new ConcurrentCreateTable();
>         try {
>             instance.execute();
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
>     private final Cluster cluster;
>     public ConcurrentCreateTable() {
>         this.cluster = Cluster.builder().addContactPoint("server1").build();
>     }
>     private void execute() throws Exception {
>         Session session = cluster.newSession();
>         session.execute("DROP KEYSPACE IF EXISTS ks");
>         session.execute("CREATE KEYSPACE IF NOT EXISTS ks WITH REPLICATION = {'class':'SimpleStrategy','replication_factor':3}");
>         ExecutorService executor = Executors.newFixedThreadPool(10);
>         List<Future<?>> futures = new ArrayList<>();
>         futures.add(executor.submit(new CreateTableRunner("text")));
>         futures.add(executor.submit(new CreateTableRunner("int")));
>         futures.add(executor.submit(new CreateTableRunner("boolean")));
>         futures.add(executor.submit(new CreateTableRunner("bigint")));
>         executor.shutdown();
>         executor.awaitTermination(1L, TimeUnit.MINUTES);
>     	session.execute("DROP KEYSPACE ks");
>     	session.close();
>         cluster.close();
>     }
>     private class CreateTableRunner implements Runnable {
>         private final Session session;
>         private final String type;
>         public CreateTableRunner(String type) {
>             this.session = cluster.newSession();
>             this.type = type;
>         }
>         @Override
>         public void run() {
>             session.execute("CREATE TABLE IF NOT EXISTS ks.tb (key " + type + ", value
" + type + ", PRIMARY KEY (key))");
>             session.close();
>         }
>     }
> }
> {code}
> sometimes each node has different table schema or no table.
> {code}
> [on server1] cqlsh> DESCRIBE TABLE ks.tb;
> CREATE TABLE ks.tb (
>     key int PRIMARY KEY,
>     value int
> ) WITH bloom_filter_fp_chance = 0.01
>     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 = '99.0PERCENTILE';
> [on server2] cqlsh> DESCRIBE TABLE ks.tb;
> CREATE TABLE ks.tb (
>     key bigint PRIMARY KEY,
>     value bigint
> ) WITH bloom_filter_fp_chance = 0.01
>     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 = '99.0PERCENTILE';
> [on server3] cqlsh> DESCRIBE TABLE ks.tb;
> Column family 'tb' not found
> {code}
> I can reproduce this issue on three nodes cluster in 2.1.0. and the test works fine in
2.0.10.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message