-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deprecate config-magic in favor of json configuration stuff #14695
Conversation
6eba8a8
to
253cc2a
Compare
253cc2a
to
2c1c4fc
Compare
); | ||
} | ||
@Rule | ||
public ExpectedException expectedException = ExpectedException.none(); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
ExpectedException.none
Injector injector = Initialization.makeInjectorWithModules( | ||
GuiceInjectors.makeStartupInjector(), | ||
ImmutableList.of( | ||
Modules.override( | ||
(binder) -> { | ||
binder.bindConstant().annotatedWith(Names.named("serviceName")).to("test"); | ||
binder.bindConstant().annotatedWith(Names.named("servicePort")).to(0); | ||
binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(-1); | ||
binder.bind(Properties.class).toInstance(props); | ||
ConfigurationObjectFactory factory = Config.createFactory(props); | ||
LegacyBrokerParallelMergeConfig legacyConfig = factory.build(LegacyBrokerParallelMergeConfig.class); | ||
binder.bind(ConfigurationObjectFactory.class).toInstance(factory); | ||
binder.bind(LegacyBrokerParallelMergeConfig.class).toInstance(legacyConfig); | ||
}, | ||
target | ||
).with((binder) -> { | ||
binder.bind(CachePopulatorStats.class).toInstance(cachePopulatorStats); | ||
binder.bind(CacheConfig.class).toInstance(cacheConfig); | ||
} | ||
}) | ||
) | ||
))); | ||
); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
Initialization.makeInjectorWithModules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clintropolis , the changes look good to me overall. I have left some minor comments.
As for DruidCoordinatorConfig
, I am looking into how we can clean up the structure. I will share my thoughts here soon.
But for now, I think we should merge the current PR (as it has already touched several files) and tackle DruidCoordinatorConfig
in a separate PR of its own.
: numThreads; | ||
this.numMergeBuffers = numMergeBuffers == null ? Math.max(2, this.numThreads / 4) : numMergeBuffers; | ||
this.fifo = fifo == null || fifo; | ||
this.tmpDir = tmpDir == null ? System.getProperty("java.io.tmpdir") : tmpDir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: You could consider using Configs.valueOrDefault()
utility method for better readability.
this.tmpDir = tmpDir == null ? System.getProperty("java.io.tmpdir") : tmpDir; | |
this.tmpDir = Configs.valueOrDefault(tmpDir, System.getProperty("java.io.tmpdir")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, didn't know that existed, changed to use this where appropriate
{ | ||
@JsonProperty | ||
private String schedulerClassName = BasicMonitorScheduler.class.getName(); | ||
|
||
@JsonProperty | ||
private Period emissionPeriod = new Period("PT1M"); | ||
|
||
@JsonProperty | ||
public String getSchedulerClassName() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Do methods need to be annotated too? Would this object need to be serialized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they don't currently get serialized so its not really necessary, not sure why some of the getters here had them, removed them all to make consistent
@@ -46,7 +45,6 @@ public Period getEmissionPeriod() | |||
return emissionPeriod; | |||
} | |||
|
|||
@Override | |||
public Duration getEmitterPeriod() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be renamed to getEmissionDuration
to avoid confusion with the other method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed, though the other method wasn't actually used which became apparent after removing the json annotation, so i removed it too
|
||
@Config({"druid.computation.buffer.size", "${base_path}.buffer.sizeBytes"}) | ||
public HumanReadableBytes intermediateComputeSizeBytesConfigured() | ||
public static long computeMaxMemoryFromMaxHeapSize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is probably not needed, we should just in-line it in initializeBufferSize
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inlined
|
||
public class DruidProcessingConfigModule implements Module | ||
@Deprecated | ||
public class LegacyBrokerParallelMergeConfigModule implements Module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment about why this is still needed and what needs to be done to remove it completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added javadoc here and to the associated config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
if (config.getNumThreadsConfigured() != ExecutorServiceConfig.DEFAULT_NUM_THREADS) { | ||
log.error("numThreads[%d] configured, that is ignored on Router", config.getNumThreadsConfigured()); | ||
if (config.isNumThreadsConfigured()) { | ||
log.error("numThreads[%d] configured, that is ignored on Router", config.getNumThreads()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we even need to log this. Definitely doesn't need to be an error.
log.error("numThreads[%d] configured, that is ignored on Router", config.getNumThreads()); | |
log.warn("Ignoring configured value for 'numThreads'[%d] as it is not used by the Router.", config.getNumThreads()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to warn, iirc the idea was that these configs have no effect on router so logging about it makes it obvious that a config change didn't actually change anything. I don't really feel strongly either way, though i do see some merit to getting feedback when a config is specified that has no effect, however we aren't doing it very consistently
public class DruidProcessingBufferConfig | ||
{ | ||
public static final HumanReadableBytes DEFAULT_PROCESSING_BUFFER_SIZE_BYTES = HumanReadableBytes.valueOf(-1); | ||
public static final int MAX_DEFAULT_PROCESSING_BUFFER_SIZE_BYTES = 1024 * 1024 * 1024; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
public static final int MAX_DEFAULT_PROCESSING_BUFFER_SIZE_BYTES = 1024 * 1024 * 1024; | |
public static final int MAX_PROCESSING_BUFFER_SIZE_BYTES = 1024 * 1024 * 1024; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, it is only a default though, if the user specifies a buffer size we use that instead, so this just specifies the max size we use if the user didn't define the buffer size explicitly and we are on a JVM that supports auto computing the size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iow, i didn't change this for now, but am happy to do so if you feel more strongly about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is fine. We can leave as it is.
For Existing class
|
That seems pretty reasonable to me, since we are switching to JSON config, and a ton of those configs have a
If for some reason we don't get this removed prior to the next release, we should probably fix it to be consistent with the http load queue peon config, and make its path be |
Description
This PR aims to deprecate usage of config-magic (
ConfigProvider
) in favor of usingJsonConfigProvider
everywhere. In the process I have made the config paths a bit more sane (one of the reasons to replaceConfigProvider
is because of how easily devs can make paths that don't make much structural sense due to the free-form nature of how config paths are defined).The main users are
DruidProcessingConfig
andDruidCoordinatorConfig
, the former of which has been reworked to be simple jackson annotated objects which are injected with a fallback to support legacy config-magic paths as needed. After these changes are released, we can consider finally deleting config-magic in a future release.For
DruidProcessingConfig
, the structure was mostly ok, but I have flattened the broker parallel merge config into just living atdruid.processing.merge
(i guess we could change this, i don't feel very strongly), and split it into a totally separate config from the rest ofDruidProcessingConfig
since it is only used by brokers forCachingClusteredClient
.For
DruidCoordinatorConfig
WIP (i haven't done anything to it yet, but it definitely needs reworked...)MonitorSchedulerConfig
was also using config-magic annotations, but was no longer usingConfigProvider
and so seemed unnecessary so I have just flattened it intoDruidMonitorSchedulerConfig
which has moved to druid-processing, because it was already wired up toJsonConfigProvider
.Release note
Broker parallel merge config options at paths
druid.processing.merge.pool.*
anddruid.processing.merge.task.*
have been flattened to use thedruid.processing.merge
prefix. Note that the legacy paths will still function, but will issue a warning log noting that these configs have been deprecated and will be removed in a future release, along with the new paths which should be used to continue configuring these values.This PR has: