cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ZhaoYang (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CASSANDRA-13127) Materialized Views: View row expires too soon
Date Mon, 26 Jun 2017 14:08:00 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-13127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16062776#comment-16062776
] 

ZhaoYang edited comment on CASSANDRA-13127 at 6/26/17 2:07 PM:
---------------------------------------------------------------

one more issue in Row.Merger:
{quote}
 if (row.primaryKeyLivenessInfo().supersedes(rowInfo))   // only timestamp is used to compare
    rowInfo = row.primaryKeyLivenessInfo();
{quote}
3. when timestamps are the same, whether TTL is considered or ignored, is depending which
row is luckily compared first.
{quote}
  a. insert Row-A using timestamp 1;  flush
  b. insert Row-A using timestamp 1 and ttl 5; flush
  c. sleep 6 second
  d. check result, Row-A exists
  reversed step a and b and try again. Row-A not longer exists.
{quote}
imo, when timestamps are same, livenessInfo with greater localDeletionTime should supersede
another if both are TTL. if only one is TTL, ttl supersede. 
 


was (Author: jasonstack):
one more issue in Row.Merger:

| if (row.primaryKeyLivenessInfo().supersedes(rowInfo))   // only timestamp is used to compare
|    rowInfo = row.primaryKeyLivenessInfo();

3. when timestamps are the same, whether TTL is considered or ignored, is depending which
row is luckily compared first.

|  a. insert Row-A using timestamp 1;  flush
|  b. insert Row-A using timestamp 1 and ttl 5; flush
|  c. sleep 6 second
|  d. check result, Row-A exists
|  reversed step a and b and try again. Row-A not longer exists.

imo, when timestamps are same, livenessInfo with greater localDeletionTime should supersede
another if both are TTL. if only one is TTL, ttl supersede. 
 

> 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-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message