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

StrictLiveness for view row is not handled in AbstractRow

    XMLWordPrintableJSON

Details

    • Normal

    Description

      In AbstractRow.hasLiveData(nowInSecond), it doesn't handle strictLiveness introduced in CASSANDRA-11500. The DataLimits counts the expired view row as live data and then the expired view row is purged in Row.purge(). When query with limit, we will get less data.

      test to reproduce
          @Test
          public void testRegularColumnTimestampUpdates() throws Throwable
          {
              createTable("CREATE TABLE %s (" +
                          "k int PRIMARY KEY, " +
                          "c int, " +
                          "val int)");
      
              execute("USE " + keyspace());
              executeNet(protocolVersion, "USE " + keyspace());
      
              createView("mv_rctstest", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE k IS NOT NULL AND c IS NOT NULL PRIMARY KEY (k,c)");
      
              updateView("UPDATE %s SET c = ?, val = ? WHERE k = ?", 0, 0, 0);
              updateView("UPDATE %s SET val = ? WHERE k = ?", 1, 0);
              updateView("UPDATE %s SET c = ? WHERE k = ?", 1, 0);
              assertRows(execute("SELECT c, k, val FROM mv_rctstest"), row(1, 0, 1));
      
              updateView("TRUNCATE %s");
      
              updateView("UPDATE %s USING TIMESTAMP 1 SET c = ?, val = ? WHERE k = ?", 0, 0, 0);
              updateView("UPDATE %s USING TIMESTAMP 3 SET c = ? WHERE k = ?", 1, 0);
              updateView("UPDATE %s USING TIMESTAMP 2 SET val = ? WHERE k = ?", 1, 0);
              updateView("UPDATE %s USING TIMESTAMP 4 SET c = ? WHERE k = ?", 2, 0);
              updateView("UPDATE %s USING TIMESTAMP 3 SET val = ? WHERE k = ?", 2, 0);
      
              // FIXME no rows return
              assertRows(execute("SELECT c, k, val FROM mv_rctstest limit 1"), row(2, 0, 2));
              assertRows(execute("SELECT c, k, val FROM mv_rctstest"), row(2, 0, 2));
          }
      

      Attachments

        Activity

          People

            jasonstack Zhao Yang
            jasonstack Zhao Yang
            Zhao Yang
            Paulo Motta (Deprecated)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: