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

Andres de la Peña commented on CASSANDRA-19047:
-----------------------------------------------

As mentioned by Ekaterina, {{table_count_warn_threshold}} can be effectively 
disabled by setting it to a very high value, like 1000. It doesn't have a 
disable value like the new guardrail that it's meant to replace it.

The new {{tables_warn_threshold}} guardrail works independently from the old 
one. Unlike the old {{{}table_count_warn_threshold{}}}, all new guardrails are 
only applied to regular users, whereas superusers are excluded. The default 
user when using {{{}AllowAllAuthenticator{}}}/{{{}AllowAllAuthorizer{}}} is a 
superuser, so the guardrail won't work without setting non-default 
authentication. Once authentication is enabled, only non-superuser users will 
see the warnings.

Also, the old and new guardrails on the number of tables use different counts. 
The deprecated {{table_count_warn_threshold}} counts all the tables including 
~44 internal tables. The new {{tables_warn_threshold}} however only counts user 
tables.

Here is an example using these {{cassandra.yml}} properties on a new install:
{code:java}
authenticator: PasswordAuthenticator
authorizer: CassandraAuthorizer
tables_warn_threshold: 1
table_count_warn_threshold: 46 # will warn on more than 2 user tables, since 
there are 44 internal tables
{code}
And with cqlsh:
{code:java}
bin/cqlsh -u cassandra -p cassandra
cassandra@cqlsh> CREATE USER test WITH PASSWORD 'test';
cassandra@cqlsh> GRANT CREATE ON ALL KEYSPACES TO test;
cassandra@cqlsh> GRANT SELECT ON ALL KEYSPACES TO test;
cassandra@cqlsh> LOGIN test
Password:
test@cqlsh> CREATE KEYSPACE k WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': 1};
test@cqlsh> CREATE TABLE k.t1 (k int PRIMARY KEY, v int);
test@cqlsh> CREATE TABLE k.t2 (k int PRIMARY KEY, v int);

Warnings :
Guardrail tables violated: Creating table t2, current number of tables 2 
exceeds warning threshold of 1.

test@cqlsh> CREATE TABLE k.t3 (k int PRIMARY KEY, v int);

Warnings :
Guardrail tables violated: Creating table t3, current number of tables 3 
exceeds warning threshold of 1.

Cluster already contains 47 tables in 6 keyspaces. Having a large number of 
tables will significantly slow down schema dependent cluster operations.
{code}
We can see that the 1st table creation doesn't trigger any guardrail, the 2nd 
table creation only triggers the new guardrail, and the 3rd table creation 
triggers both guardrails, as expected.

Regarding giving a specific disable value to the old 
{{{}table_count_warn_threshold{}}}. That guardrail is kept for backward 
compatibility, so we don't break anyone depending on it. To keep this backward 
compatibility, we shouldn't change its behaviour, default value or the meaning 
of its possible values. It's indeed questionable that it doesn't have a default 
value and that it counts internal tables, that's why we have added the new 
guardrail that will replace it.

> Guardrail for the number of tables is not working
> -------------------------------------------------
>
>                 Key: CASSANDRA-19047
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-19047
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Cluster/Schema
>            Reporter: Mohammad Aburadeh
>            Priority: Urgent
>
> Hi, 
> We installed Cassandra 4.1.3 and we got the following warning when creating 
> more than 150 tables: 
> {code:java}
> WARN  [Native-Transport-Requests-6] 2023-11-21 18:35:24,585 
> CreateTableStatement.java:421 - Cluster already contains 161 tables in 6 
> keyspaces. Having a large number of tables will significantly slow down 
> schema dependent cluster operations. {code}
> I tried to disable "table_count_warn_threshold" by setting its value to "-1" 
> but that did not work. 
> Then I tried to set the guardrail for number of tables to "-1" to disable the 
> above but did not work as well. It seems there is no way to disable checking 
> the number of tables. 
> Also,  I tried to set "tables_warn_threshold" to a value less than 
> "tables_count_warn_threshold", it seems Cassandra always uses 
> "tables_count_warn_threshold" when throwing the warning. 
> *Two issues in Cassandra 4.1.3:* 
> 1- There should be a way to disable this feature. Either by setting the 
> guardrail parameter to -1 or setting tables_count_warn_threshold to -1. 
> 2- The guardrail for number of tables should overwrite 
> tables_count_warn_threshold because I always get the following warning when I 
> try to increase the number of tables: 
> {code:java}
> WARN  [main] 2023-11-21 18:26:16,988 YamlConfigurationLoader.java:427 - 
> [keyspace_count_warn_threshold, table_count_warn_threshold] parameters have 
> been deprecated. They have new names and/or value format; For more 
> information, please refer to NEWS.txt {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to