[ https://issues.apache.org/jira/browse/CASSANDRA-14013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16251160#comment-16251160 ]
Vincent White commented on CASSANDRA-14013: ------------------------------------------- I took a look at this today and found the cause of this issue. It is indeed that the name "snapshots" is causing confusion as C* tries to retrieve the keyspace and column family names from the file paths here: {code:java| title=org.apache.cassandra.io.sstable.Descriptor#fromFilename()} else if (cfDirectory.getParentFile().getName().equals(Directories.SNAPSHOT_SUBDIR)) { cfDirectory = cfDirectory.getParentFile().getParentFile(); } cfname = cfDirectory.getName().split("-")[0] + indexName; ksname = cfDirectory.getParentFile().getName(); {code} I wrote a quick patch [here|https://github.com/vincewhite/cassandra/commits/14013-test] and would really appreciate some suggestions on improving it (or a different approach). I didn't have a chance to test 3.0.x but the code at least in this area appears to be the same. I should have time to tidy this up and add a test this week. Cheers, -vince > Data loss in snapshots keyspace after service restart > ----------------------------------------------------- > > Key: CASSANDRA-14013 > URL: https://issues.apache.org/jira/browse/CASSANDRA-14013 > Project: Cassandra > Issue Type: Bug > Reporter: Gregor Uhlenheuer > > I am posting this bug in hope to discover the stupid mistake I am doing > because I can't imagine a reasonable answer for the behavior I see right now > :-) > In short words, I do observe data loss in a keyspace called *snapshots* after > restarting the Cassandra service. Say I do have 1000 records in a table > called *snapshots.test_idx* then after restart the table has less entries or > is even empty. > My kind of "mysterious" observation is that it happens only in a keyspace > called *snapshots*... > h3. Steps to reproduce > These steps to reproduce show the described behavior in "most" attempts (not > every single time though). > {code} > # create keyspace > CREATE KEYSPACE snapshots WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': 1}; > # create table > CREATE TABLE snapshots.test_idx (key text, seqno bigint, primary key(key)); > # insert some test data > INSERT INTO snapshots.test_idx (key,seqno) values ('key1', 1); > ... > INSERT INTO snapshots.test_idx (key,seqno) values ('key1000', 1000); > # count entries > SELECT count(*) FROM snapshots.test_idx; > 1000 > # restart service > kill <cassandra-pid> > cassandra -f > # count entries > SELECT count(*) FROM snapshots.test_idx; > 0 > {code} > I hope someone can point me to the obvious mistake I am doing :-) > This happened to me using both Cassandra 3.9 and 3.11.0 -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org