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

Benjamin Lerer commented on CASSANDRA-13935:
--------------------------------------------

[~stefan.miklosovic] sure. I should be able to do that next week. 

> Indexes and UDTs creation should have IF NOT EXISTS on its String 
> representation
> --------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-13935
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13935
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Feature/2i Index, Legacy/CQL
>         Environment: Ubuntu 16.04.2 LTS
> java version "1.8.0_144"
> Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
> Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
>            Reporter: Javier Canillas
>            Assignee: Stefan Miklosovic
>            Priority: Low
>             Fix For: 4.0-beta
>
>         Attachments: 13935-3.0.txt, 13935-3.11.txt, 13935-trunk.txt
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> I came across something that bothers me a lot. I'm using snapshots to backup 
> data from my Cassandra cluster in case something really bad happens (like 
> dropping a table or a keyspace).
> Exercising the recovery actions from those backups, I discover that the 
> schema put on the file "schema.cql" as a result of the snapshot has the 
> "CREATE IF NOT EXISTS" for the table, but not for the indexes.
> When restoring from snapshots, and relying on the execution of these schemas 
> to build up the table structure, everything seems fine for tables without 
> secondary indexes, but for the ones that make use of them, the execution of 
> these statements fail miserably.
> Here I paste a generated schema.cql content for a table with indexes:
> CREATE TABLE IF NOT EXISTS keyspace1.table1 (
>       id text PRIMARY KEY,
>       content text,
>       last_update_date date,
>       last_update_date_time timestamp)
>       WITH ID = f1045fc0-2f59-11e7-95ec-295c3c064920
>       AND bloom_filter_fp_chance = 0.01
>       AND dclocal_read_repair_chance = 0.1
>       AND crc_check_chance = 1.0
>       AND default_time_to_live = 8640000
>       AND gc_grace_seconds = 864000
>       AND min_index_interval = 128
>       AND max_index_interval = 2048
>       AND memtable_flush_period_in_ms = 0
>       AND read_repair_chance = 0.0
>       AND speculative_retry = '99PERCENTILE'
>       AND caching = { 'keys': 'NONE', 'rows_per_partition': 'NONE' }
>       AND compaction = { 'max_threshold': '32', 'min_threshold': '4', 
> 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' }
>       AND compression = { 'chunk_length_in_kb': '64', 'class': 
> 'org.apache.cassandra.io.compress.LZ4Compressor' }
>       AND cdc = false
>       AND extensions = {  };
> CREATE INDEX table1_last_update_date_idx ON keyspace1.table1 
> (last_update_date);
> I think the last part should be:
> CREATE INDEX IF NOT EXISTS table1_last_update_date_idx ON keyspace1.table1 
> (last_update_date);
> // edit by Stefan Miklosovic
> PR: https://github.com/apache/cassandra/pull/731
> I have added UDTs as part of this patch as well.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to