[ https://issues.apache.org/jira/browse/CASSANDRA-13127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16089940#comment-16089940 ]
Fridtjof Sander commented on CASSANDRA-13127: --------------------------------------------- I found another bug, that I believe falls into the same ballpark as this issue: {code:java} @Test public void testFilterViewTombstones() throws Throwable { execute("USE " + keyspace()); executeNet(protocolVersion, "USE " + keyspace()); createTable("CREATE TABLE %s (k int, c int, a int, b int, PRIMARY KEY (k, c))"); createView("mv", "CREATE MATERIALIZED VIEW %s AS SELECT k,c FROM %%s WHERE k IS NOT NULL AND c IS NOT NULL PRIMARY KEY (k,c)"); updateView("UPDATE %s USING TIMESTAMP 10 SET b=1 WHERE k=1 AND c=1"); assertRows(execute("SELECT * from %s"), row(1, 1, null, 1)); assertRows(execute("SELECT * from mv"), row(1, 1)); updateView("DELETE b FROM %s USING TIMESTAMP 11 WHERE k=1 AND c=1"); assertEmpty(execute("SELECT * from %s")); assertEmpty(execute("SELECT * from mv")); updateView("UPDATE %s USING TIMESTAMP 1 SET a=1 WHERE k=1 AND c=1"); assertRows(execute("SELECT * from %s"), row(1, 1, 1, null)); assertRows(execute("SELECT * from mv"), row(1, 1)); } {code} A view entry is created based on {{b=1@ts=10}} and deleted with {{ts=11}}. Later another cell is added with {{a=1@ts=1}}. The view's liveness-info with {{ts=1}} does not supersede the previously created tombstone with {{ts=11}}. If you disagree on the similarity, I'll open a new ticket for this. Both issues are about handling the contribution of base-cells to the view-row's liveness that are projected out of the view. On trunk, this doesn't even create an mv-entry (because of the empty liveness-info), but also fails with [~jasonstack]'s patch. I'm not sure, if this can be fixed at all without keeping hidden timestamp/liveness-data of discarded columns. > Materialized Views: View row expires too soon > --------------------------------------------- > > Key: CASSANDRA-13127 > URL: https://issues.apache.org/jira/browse/CASSANDRA-13127 > Project: Cassandra > Issue Type: Bug > Components: Local Write-Read Paths, Materialized Views > Reporter: Duarte Nunes > Assignee: ZhaoYang > > Consider the following commands, ran against trunk: > {code} > echo "DROP MATERIALIZED VIEW ks.mv; DROP TABLE ks.base;" | bin/cqlsh > echo "CREATE TABLE ks.base (p int, c int, v int, PRIMARY KEY (p, c));" | > bin/cqlsh > echo "CREATE MATERIALIZED VIEW ks.mv AS SELECT p, c FROM base WHERE p IS NOT > NULL AND c IS NOT NULL PRIMARY KEY (c, p);" | bin/cqlsh > echo "INSERT INTO ks.base (p, c) VALUES (0, 0) USING TTL 10;" | bin/cqlsh > # wait for row liveness to get closer to expiration > sleep 6; > echo "UPDATE ks.base USING TTL 8 SET v = 0 WHERE p = 0 and c = 0;" | bin/cqlsh > echo "SELECT p, c, ttl(v) FROM ks.base; SELECT * FROM ks.mv;" | bin/cqlsh > p | c | ttl(v) > ---+---+-------- > 0 | 0 | 7 > (1 rows) > c | p > ---+--- > 0 | 0 > (1 rows) > # wait for row liveness to expire > sleep 4; > echo "SELECT p, c, ttl(v) FROM ks.base; SELECT * FROM ks.mv;" | bin/cqlsh > p | c | ttl(v) > ---+---+-------- > 0 | 0 | 3 > (1 rows) > c | p > ---+--- > (0 rows) > {code} > Notice how the view row is removed even though the base row is still live. I > would say this is because in ViewUpdateGenerator#computeLivenessInfoForEntry > the TTLs are compared instead of the expiration times, but I'm not sure I'm > getting that far ahead in the code when updating a column that's not in the > view. -- 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