[
https://issues.apache.org/jira/browse/CASSANDRA-7597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14089820#comment-14089820
]
Yuki Morishita commented on CASSANDRA-7597:
-------------------------------------------
In my opinion, we should, ultimately, get rid of DatabaseDescriptor.
The root of the problem is that it affects everything it touches even you just
want a piece of it.
It does too much. I think calling System.exit from DD is not good at all.
So I prefer finding the way to do it rather than introducing tweak.
I think each module(gossip, net, streaming, etc...) shuold:
- Define own options and the way to validate them.
- Not *pull* options from somewhere else. Options should be given at the module
initialization.
Note that we can keep Config/cassandra.yaml as is after the change because it
is just the source of options.
For the first step, I'm planning to try to rip off DD from the path called from
sstableloader(CASSANDRA-7585 is in fact a part of it).
It still is not a easy way, since classes like Range/Token indirectly reference
option(partitioner, specifically) from DD.
After that, maybe we can move on to another tool or module for ripping off.
> Remove static initializer in DatabaseDescriptor
> -----------------------------------------------
>
> Key: CASSANDRA-7597
> URL: https://issues.apache.org/jira/browse/CASSANDRA-7597
> Project: Cassandra
> Issue Type: Improvement
> Environment: Cassandra 2.0.9 (earlier version should be affected as
> well)
> Reporter: Pavel Sakun
> Assignee: Robert Stupp
> Attachments: 7597.txt
>
>
> As discussed below, it's difficult to properly react on invalid configuration
> values in a client tool that uses cassandra code (here: an sstable loader).
> Reason is that the static initializer in DatabaseDescriptor calls System.exit
> in case of configuration failures.
> Recommend to implement some "loadAndApplyConfig" method on DatabaseDescriptor
> and remove the static initializer and let the calling code react accordingly
> (print error, exit VM).
> All direct and indirect uses of DatabaseDescriptor must be catched to solve
> this ticket - so this is not a 2.1 ticket.
> --------------------------
> Old Description:
> We're using SSTableSimpleUnsortedWriter API to generate SSTable to be loaded
> into cassandra. In case of any issue with config DatabaseDescriptor calls
> System.exit() which is apparently not the thing you expect while using API.
> Test case is simple:
> System.setProperty( "cassandra.config", "" );
> new YamlConfigurationLoader().loadConfig();
> Thread.sleep( 5000 );
> System.out.println("We're still alive"); // this will never be called
--
This message was sent by Atlassian JIRA
(v6.2#6252)