[
https://issues.apache.org/jira/browse/CASSANDRA-21156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18114510#comment-18114510
]
Mykyta Bozhenko commented on CASSANDRA-21156:
---------------------------------------------
Patch: https://github.com/apache/cassandra/pull/5156
The converter for the deprecated count thresholds reads TABLE_NAMES from
SystemKeyspace and the other keyspace classes. Touching those fields runs their
static initializers, which read DatabaseDescriptor while it is still loading
the configuration, so the read returns null and <clinit> fails.
The patch declares the per-keyspace name sets in SchemaConstants, built only
from the String constants of those classes. A reference to a compile-time
constant does not trigger class initialization (JLS 12.4.1), so the converter
no longer initializes any keyspace class. The TABLE_NAMES fields now alias the
SchemaConstants sets, so each list is defined once, and a new test compares
every set with the real keyspace metadata. Converters itself is unchanged.
One thing the fix makes visible, left alone here: past the NPE, guardrail
validation rejects a small legacy value. On the patched build (56 system
tables, 7 system keyspaces), table_count_warn_threshold: 40 fails startup with
"Invalid value -16 for tables_warn_threshold: negative values are not allowed,
outside of -1 which disables the guardrail"; 100 converts cleanly to 44. That
belongs with the discussion in CASSANDRA-19047 rather than here.
Looking for a reviewer.
> Static init race between paxos v2 and table count guardrail causes NPE on
> startup
> ---------------------------------------------------------------------------------
>
> Key: CASSANDRA-21156
> URL: https://issues.apache.org/jira/browse/CASSANDRA-21156
> Project: Apache Cassandra
> Issue Type: Bug
> Components: Local/Startup and Shutdown
> Reporter: Blake Eggleston
> Assignee: Mykyta Bozhenko
> Priority: Normal
> Fix For: 5.0.x
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Set the following config values:
> table_count_warn_threshold: 400
> causes this exception on startup:
> {{ERROR [main] 2026-02-02 15:52:22,389 CassandraDaemon.java:887 - Exception
> encountered during startup
> java.lang.ExceptionInInitializerError: null
> at
> org.apache.cassandra.db.SystemKeyspace.<clinit>(SystemKeyspace.java:239)
> at
> org.apache.cassandra.schema.SchemaConstants.getLocalAndReplicatedSystemTableNames(SchemaConstants.java:184)
> at
> org.apache.cassandra.config.Converters.lambda$static$32(Converters.java:128)
> at org.apache.cassandra.config.Converters.convert(Converters.java:174)
> at org.apache.cassandra.config.Replacement$1.set(Replacement.java:76)
> at
> org.apache.cassandra.config.YamlConfigurationLoader$PropertiesChecker$1.set(YamlConfigurationLoader.java:376)
> at
> org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:276)
> at
> org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:169)
> at
> org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:320)
> at
> org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:264)
> at
> org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:247)
> at
> org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:201)
> at
> org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:185)
> at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:493)
> at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:486)
> at
> org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:310)
> at
> org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:141)
> at
> org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:116)
> at
> org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:399)
> at
> org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:261)
> at
> org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:246)
> at
> org.apache.cassandra.service.CassandraDaemon.applyConfig(CassandraDaemon.java:780)
> at
> org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:723)
> at
> org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:865)
> Caused by: java.lang.NullPointerException: null
> at org.apache.cassandra.db.DataRange.allData(DataRange.java:71)
> at
> org.apache.cassandra.service.paxos.uncommitted.PaxosUncommittedIndex.<clinit>(PaxosUncommittedIndex.java:90)
> ... 24 common frames omitted}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]