ScyllaDB 2.1 - Inconsistency with Materialized View

夙愿已清 提交于 2021-01-27 13:40:00

问题


While deciding on the technology stack for my own product, I decided to go with scyllaDB for database due to it's impressive performance.

For local development, I setup Cassandra on my Macbook. Considering ScyllaDB now supports (experimental) MV (Materialized View), it made the development easy. For dev server, I'm running ScyllaDB on Ubuntu 16.04 hosted on Linod.

I am facing following issues :

  1. After a few weeks, one day when I deleted an entry from base table (from ScyllaDB running on Ubuntu) using the partition key, the respective MV still showed the respective entry for the deleted record. It was fixed after I dropped the whole Key-Space and recreated it, but I'm unable to pinpoint what caused this inconsistency.

  2. When I dropped the MV and recreated it, it did not copy the old data. I tried to search, but could not find a way to force MV to read from base table and populate itself.

For the first issue, I would like to know if anyone faced similar scenario. Also if there is anything I can do to prevent this from happening or if it can't be prevented and that is what it means to be "experimental".

Any help or reference is appreciated.


回答1:


In 2.1 Scylla lacked view building (that is, using existing data to populate a view on creation), but that is solved in 2.2.




回答2:


Indeed the MV status of 2.1 is incomplete. It gotten much better in 2.2 which will be released this week. It's still not GA yet but we have a branch on top of 2.2 that merged newer changes from master which is almost there. It should reach GA quality within 2 months.

Note that the Cassandra MV status is experimental and we have been opening JIRA tickets everywhere we identified there is design flaw in C*'s MV.




回答3:


tldr; I would suggest you either stick with cassandra if you want MV, or manually do the MV's in scylla.

Materialized views are super experimental. I ran them for about 6 months in production replacing their functionality manually. This was done to improve performance. So if performance is your goal here, I suggest avoiding them.

I can attest that the materialized views if created on a already populated table will infact populate the materialized view on their own so this seems like a scylladb problem. Cassandra has a different problem where the writes will crater the DB if you do this on a large production table.

I also did not have issues with truncating the primary table and seeing the reflection in cassandra.

Additionally I had tried scylladb for a spike for performance reasons. I found it very difficult to work with and dropped it after spending a week trying to get it to do what I knew cassandra would do.




回答4:


Thanks @Highstead for confirming the automatic population of MV if base table has entries while creating the MV.

For the main query of the inconsistency in tables and MV, I found out that it was due to truncate query on base table.

Also found an issue for it https://github.com/scylladb/scylla/issues/3188

It states that currently, truncating the base table wont clear the MVs created from that table.

Vice-versa, you can run truncate query on the MV and it won't throw an exception (where it should've) and MV will be cleared even when base table contains entries.

So solution for now is to truncate each MV along with tables separately.



来源:https://stackoverflow.com/questions/51095309/scylladb-2-1-inconsistency-with-materialized-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!