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

Ensure that empty SAI column indexes do not fail on validation after full-SSTable streaming

    XMLWordPrintableJSON

Details

    Description

      I actually discovered this in some exploratory testing for CASSANDRA-19007...

      @Test
      public void testRepairWithEmptyColumnIndex() throws IOException
      {
         try (Cluster cluster = init(Cluster.build(2).withConfig(config -> config.with(GOSSIP).with(NETWORK)).start()))
         {
             cluster.schemaChange(withKeyspace("CREATE TABLE %s.t (k int PRIMARY KEY, a int, b int)"));
             cluster.schemaChange(withKeyspace("CREATE INDEX ON %s.t(a) USING 'sai'"));
             cluster.schemaChange(withKeyspace("CREATE INDEX ON %s.t(b) USING 'sai'"));
      
             // insert a split row
             cluster.get(1).executeInternal(withKeyspace("INSERT INTO %s.t(k, a) VALUES (0, 1)"));
             cluster.get(2).executeInternal(withKeyspace("INSERT INTO %s.t(k, b) VALUES (0, 2)"));
             cluster.get(1).flush(KEYSPACE);
             cluster.get(2).flush(KEYSPACE);
             cluster.get(1).nodetoolResult("repair", KEYSPACE).asserts().success(); // fails w/ no data for the "a" index on node 2!
         }
      }
      
      java.lang.RuntimeException: Repair job has failed with the error message: Repair command #1 failed with error Repair session 55a34e20-7f24-11ee-b345-d158c708a34e for range [(-1,9223372036854775805], (9223372036854775805,-1]] failed with error Stream failed: 
      Session peer /127.0.0.2:7012 Failed because of an unknown exception
      java.io.UncheckedIOException: java.nio.file.NoSuchFileException: /private/var/folders/4d/zfjs7m7s6x5_l93k33r5k6680000gn/T/dtests2185335212676803469/node1/data0/distributed_test_keyspace/t-3459c6aa21753083afcc5b0c9f77c3f7/distributed_test_keyspace-t-nc-4-big-SAI+aa+t_a_idx+Meta.db
      	org.apache.cassandra.index.sai.disk.v1.V1OnDiskFormat.rethrowIOException(V1OnDiskFormat.java:241)
      	org.apache.cassandra.index.sai.disk.v1.V1OnDiskFormat.validatePerColumnIndexComponents(V1OnDiskFormat.java:230)
      java.nio.file.NoSuchFileException: /private/var/folders/4d/zfjs7m7s6x5_l93k33r5k6680000gn/T/dtests2185335212676803469/node1/data0/distributed_test_keyspace/t-3459c6aa21753083afcc5b0c9f77c3f7/distributed_test_keyspace-t-nc-4-big-SAI+aa+t_a_idx+Meta.db
      	java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
      	java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
      

      This is an untested side-effect of a change in CASSANDRA-18670. The fix should be fairly simple, essentially making sure we don't assume the column index components are present during validation when the index completion marker is present.

      Attachments

        Issue Links

          Activity

            People

              adelapena Andres de la Peña
              maedhroz Caleb Rackliffe
              Caleb Rackliffe
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m