[
https://issues.apache.org/jira/browse/CASSANDRA-9054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15244829#comment-15244829
]
Robert Stupp commented on CASSANDRA-9054:
-----------------------------------------
Goal is to be able to use {{DatabaseDescriptor}} for several use cases - i.e.
for {{CassandraDaemon}} and for the several tools, which have several needs.
Some tools just need the config, some need storage, some need storage and
schema and so on. The patch does not change any functionality - it just breaks
things up.
Summary of changes:
* a lot of noise in this patch due to movement of some constants and additional
code for a lot of utests (sorry for that)
* {{DatabaseDescriptor}} :
** removed {{forceStaticInitialization()}} and following static init block
** split {{applyConfig()}} into several methods:
*** {{applySimpleConfig()}} does all the stuff from {{applyConfig()}} except
the code parts that actually _do_ something
*** {{applyPartitioner()}}, {{applyAddressConfig()}}, {{applyThriftHSHA()}},
{{applySnitch()}}, {{applyRequestScheduler()}}, {{applyInitialTokens()}},
{{applySeedProvider()}}, {{applyEncryptionContext()}} set up these parts.
Intention of that split is that tools can just initialize what they really need.
** Authentication setup had to be moved to a separate class {{AuthSetup}} since
the classes used within the auth setup implicitly setup "everything".
** removed the {{SSTableFormat.Type sstable_format}} - this would implicitly
setup "everything" (goes via Version, BigFormat, etc etc)
** moved the {{isReplacing()}} to {{StorageService}}, where it's actually used
- requires {{SystemKeyspace}}
** moved logic of {{getTimeout(MessagingService.Verb verb)}} into
{{Messaging.Verb}}
** moved {{getMemtableAllocatorPool()}} to {{Memtable}}, where it's actually
used
** added {{daemonInitialization()}}, {{toolInitialization()}} and
{{clientInitialization()}} methods for C* daemon tools and clients - currently
nothing special in {{toolInitialization()}} and {{clientInitialization()}}.
* moved a couple of constants from {{Schema}} to new class {{SchemaConstants}}
since these were used from tools (even nodetool)
* moved the constants for the keyspace names to {{SchemaConstants}}
* added {{DatabaseDescriptorRefTest}} to validate that {{DatabaseDescriptor}}
neither loads "bad" classes nor start "unwanted" threads
* made {{YamlConfigurationLoader.storageConfigURL}} lazy
* moved thread-local scratch buffer management from {{FBUtilitites}} into
{{DeflateCompressor}}
* moved type constants in {{ThriftServer}} into a static inner class
* lots of utest classes needed code to initialize {{DatabaseDescriptor}} (since
that's no longer done implicitly)
* some tools needed code to initialize {{DatabaseDescriptor}} (since that's no
longer done implicitly)
* manually tested all tools
Todo: (reasons for not setting as patch-available yet):
* add tests to ensure that no CL replay is performed for all tools
* add tests to ensure that no CL are written for all tools
* (maybe) add tests to ensure that schema is not loaded for some tools
* add tests to ensure that gossip's not started for all tools
Follow-ups can:
* Modify the tools to really just initialize what they need
* Move functionality out of {{DatabaseDescriptor}} - e.g.
{{hinted_handoff_disabled_datacenters}} into {{StorageProxy}}
[branch|https://github.com/apache/cassandra/compare/trunk...snazy:9054-split-dd-trunk]
[testall|http://cassci.datastax.com/view/Dev/view/snazy/job/snazy-9054-split-dd-trunk-testall/lastBuild/]
[dtest|http://cassci.datastax.com/view/Dev/view/snazy/job/snazy-9054-split-dd-trunk-dtest/lastBuild/]
> Break DatabaseDescriptor up into multiple classes.
> --------------------------------------------------
>
> Key: CASSANDRA-9054
> URL: https://issues.apache.org/jira/browse/CASSANDRA-9054
> Project: Cassandra
> Issue Type: Improvement
> Reporter: Jeremiah Jordan
> Assignee: Robert Stupp
> Fix For: 3.x
>
>
> Right now to get at Config stuff you go through DatabaseDescriptor. But when
> you instantiate DatabaseDescriptor it actually opens system tables and such,
> which triggers commit log replays, and other things if the right flags aren't
> set ahead of time. This makes getting at config stuff from tools annoying,
> as you have to be very careful about instantiation orders.
> It would be nice if we could break DatabaseDescriptor up into multiple
> classes, so that getting at config stuff from tools wasn't such a pain.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)