docker-library / cassandra

Docker Official Image packaging for Cassandra
Apache License 2.0
263 stars 281 forks source link

Disable enable_materialized_views? #186

Closed odunybrad closed 5 years ago

odunybrad commented 5 years ago

Hi,

It seems enable_materialized_views is not a safe option and is disabled by default. But it is enabled in this image. Is there any reason for that or should it be disabled?

Here is what the official doc says (http://cassandra.apache.org/doc/latest/configuration/cassandra_config_file.html):

image

Thanks!

wglambert commented 5 years ago

That's the default configuration from Apache's Cassandra repo https://www.apache.org/dist/cassandra/debian/pool/main/c/cassandra/

https://github.com/docker-library/cassandra/blob/5b7eebbf4412cf8b1434cfe6430648c606cdd6de/3.11/Dockerfile#L68

From http://cassandra.apache.org/download/

echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

$ wget -q https://www.apache.org/dist/cassandra/debian/pool/main/c/cassandra/cassandra_3.11.4.orig.tar.gz

$ tar -xvzf cassandra_3.11.4.orig.tar.gz 1>/dev/null

$ grep -C1 "enable_materialized_views" apache-cassandra-3.11.4-src/conf/cassandra.yaml 
# Materialized views are considered experimental and are not recommended for production use.
enable_materialized_views: true
odunybrad commented 5 years ago

I see, there may be a bug in Cassandra itself. Their code differs from what their manual says. I will report to them. Thanks for your quick response!

wglambert commented 5 years ago

From what I gather reading this discussion around what to do with the flag and conveying its experimentality to users https://www.mail-archive.com/dev@cassandra.apache.org/msg11511.html It looks like they chose not to change its existing enablement in a minor version

It looks like the reason why it's still default: true in practice is from this comment https://www.mail-archive.com/dev@cassandra.apache.org/msg11538.html

These things are live on clusters right now, and I would not want someone to upgrade their cluster to a new patch release and suddenly something that may have been working for them now does not function.

https://www.mail-archive.com/dev@cassandra.apache.org/msg11580.html

At the risk of sounding redundant it sounds like for MVs at this point we want to preserve current functionality for existing users. We would have a flag in the yaml to disable it by default for new MV creation with an error message. In addition we want a warning in the log and in cqlsh upon creation and usage even with it enabled.

And in the release notes for 3.11.2 https://fossies.org/linux/apache-cassandra/NEWS.txt

Materialized Views

  • Following a discussion regarding concerns about the design and safety of Materialized Views, the C* development community no longer recommends them for production use, and considers them experimental. Warnings messages will now be logged when they are created. (See https://www.mail-archive.com/dev@cassandra.apache.org/msg11511.html)
  • An 'enable_materialized_views' flag has been added to cassandra.yaml to allow operators to prevent creation of views

So I would imagine in the next major version it will in practice be default: false. I'm going to close as we're using upstreams defaults as they are distributed.