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

Cannot read or repair data after dropping a column when one of the nodes is down

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Duplicate
    • None
    • Cluster/Schema
    • None
    • Availability - Unavailable
    • Normal
    • Normal
    • Adhoc Test
    • All
    • None

    Description

      When a column is dropped while one of the nodes is down, when the node come back online, repair or querying the data fails.

      This can be reproduced by running the following in-jvm dtest:

          @Test
          public void testDroppingColumnWhenOneNodeIsDown() throws IOException, ExecutionException, InterruptedException
          {
              try (Cluster cluster = init(Cluster.build(3).start()))
              {
                  cluster.schemaChange("create table " + KEYSPACE + ".tab (id int primary key, v1 int, v2 int)");
                  cluster.disableAutoCompaction(KEYSPACE);
      
                  cluster.coordinator(1).execute("insert into " + KEYSPACE + ".tab (id, v1, v2) VALUES (?, ?, ?)", ConsistencyLevel.ALL, 1, 2, 3);
                  cluster.coordinator(1).execute("insert into " + KEYSPACE + ".tab (id, v1) VALUES (?, ?)", ConsistencyLevel.ALL, 4, 5);
                  cluster.coordinator(1).execute("insert into " + KEYSPACE + ".tab (id, v2) VALUES (?, ?)", ConsistencyLevel.ALL, 6, 7);
      
                  cluster.get(3).shutdown(true).get();
      
                  cluster.schemaChangeIgnoringStoppedInstances("alter table " + KEYSPACE + ".tab drop v1");
      
                  cluster.get(3).startup();
      
                  cluster.coordinator(1).execute("insert into " + KEYSPACE + ".tab (id, v2) VALUES (?, ?)", ConsistencyLevel.ALL, 1, 9);
                  cluster.coordinator(1).execute("insert into " + KEYSPACE + ".tab (id, v2) VALUES (?, ?)", ConsistencyLevel.ALL, 2, 11);
      
                  NodeToolResult repairResult = cluster.get(1).nodetoolResult("repair", KEYSPACE, "tab");
                  assertThat(repairResult.getRc()).isZero();
      
                  SimpleQueryResult rows = cluster.coordinator(1).executeWithResult("select * from " + KEYSPACE + ".tab", ConsistencyLevel.ALL);
                  assertRows(rows.toObjectArrays(), row(1, 9), row(2, 11), row(4, null), row(6, 7));
      
                  assertRows(cluster.coordinator(1).executeWithResult("select * from " + KEYSPACE + ".tab where id = ?", ConsistencyLevel.ALL, 1).toObjectArrays(), row(1, 9));
                  assertRows(cluster.coordinator(1).executeWithResult("select * from " + KEYSPACE + ".tab where id = ?", ConsistencyLevel.ALL, 2).toObjectArrays(), row(2, 11));
                  assertRows(cluster.coordinator(1).executeWithResult("select * from " + KEYSPACE + ".tab where id = ?", ConsistencyLevel.ALL, 4).toObjectArrays(), row(4, null));
                  assertRows(cluster.coordinator(1).executeWithResult("select * from " + KEYSPACE + ".tab where id = ?", ConsistencyLevel.ALL, 6).toObjectArrays(), row(6, 7));
              }
          }
      

      Attachments

        Issue Links

          Activity

            People

              jakubzytka Jakub Zytka
              jlewandowski Jacek Lewandowski
              Jakub Zytka
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: