Cassandra物化视图显示过时数据

时间:2015-08-04 13:36:49

标签: cassandra cql

我正在尝试使用Cassandra 3.0 alpha来查看物化视图的工作方式,并按照显示here的示例进行操作。

该示例在从基表中删除整个分区时起作用,但是当我删除单个聚簇行时,它将继续显示在物化视图中。基表中删除的行是否也不会从视图中消失?

例如:

CREATE TABLE base (part int, clus int , val int, PRIMARY KEY (part, clus));
CREATE MATERIALIZED VIEW view1 AS SELECT part FROM base WHERE part IS NOT NULL AND clus IS NOT NULL AND val IS NOT NULL PRIMARY KEY (val, part, clus);
INSERT INTO base (part, clus, val) VALUES ( 1, 2, 200 );
INSERT INTO base (part, clus, val) VALUES ( 1, 3, 300 );

SELECT * FROM view1;

 val | part | clus
-----+------+------
 200 |    1 |    2
 300 |    1 |    3

然后我只删除其中一行:

DELETE FROM base WHERE part=1 and clus=3;

现在我期待val = 300从视图中消失,但它没有:

SELECT * FROM view1;

 val | part | clus
-----+------+------
 200 |    1 |    2
 300 |    1 |    3

接下来如果删除整个分区,我之前删除的聚类行将留在视图中:

DELETE FROM base WHERE part=1;

SELECT * from base;

 clus | part | val
------+------+-----

SELECT * FROM view1;

 val | part | clus
-----+------+------
 300 |    1 |    3

我猜这是alpha版本中的一个错误,但是想确保这不是预期的行为。我是否应该能够删除单个聚簇行并查看实体化视图中反映的内容?

我正在使用此版本:

nodetool version
ReleaseVersion: 3.0.0-alpha1-SNAPSHOT

感谢。

1 个答案:

答案 0 :(得分:1)

删除和更新都应根据" Cassandra 3.0 materialised views in action"传播到视图。