Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-6514

Nodetool Refresh / CFS.loadNewSSTables() can Lose New SSTables

    XMLWordPrintableJSON

Details

    • Low

    Description

      When nodetool refresh / CFS.loadNewSSTables() renames the newly loaded SSTables, it doesn't check to make sure the new name doesn't already exist. It's easy for one of the newly loaded files themselves to have one of these names, so the rename will wipe out one of the SSTables you intended to load.

      For example, if you create a new, empty table, move two SSTables with generations 1 and 2 into the data directory, and then call nodetool refresh, you might see this:

      INFO 15:37:42,587 Loading new SSTables for duration_test/ints...
       INFO 15:37:42,601 Renaming new SSTable /var/lib/cassandra/data/duration_test/ints/duration_test-ints-jb-2 to /var/lib/cassandra/data/duration_test/ints/duration_test-ints-jb-1
       INFO 15:37:42,605 Opening /var/lib/cassandra/data/duration_test/ints/duration_test-ints-jb-1 (424005 bytes)
       INFO 15:37:42,614 Renaming new SSTable /var/lib/cassandra/data/duration_test/ints/duration_test-ints-jb-1 to /var/lib/cassandra/data/duration_test/ints/duration_test-ints-jb-2
       INFO 15:37:42,615 Opening /var/lib/cassandra/data/duration_test/ints/duration_test-ints-jb-2 (424005 bytes)
       INFO 15:37:42,617 Loading new SSTables and building secondary indexes for duration_test/ints: [SSTableReader(path='/var/lib/cassandra/data/duration_test/ints/duration_test-ints-jb-1-Data.db'), SSTableReader(path='/var/lib/cassandra/data/duration_test/ints/duration_test-ints-jb-2-Data.db')]
       INFO 15:37:42,618 Done loading load new SSTables for duration_test/ints
      ERROR 15:38:09,428 Exception in thread Thread[ReadStage:40,5,main]
      java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException: /var/lib/cassandra/data/duration_test/ints/duration_test-ints-jb-1-Data.db (No such file or directory)
      	at org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:1939)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:724)
      
      

      Attachments

        1. 6514-2.0.patch
          5 kB
          Tom Hobbs
        2. 6514-2.0-v2.patch
          6 kB
          Tom Hobbs

        Issue Links

          Activity

            People

              thobbs Tom Hobbs
              thobbs Tom Hobbs
              Tom Hobbs
              Jonathan Ellis
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: