Skip to content

Commit

Permalink
json config based processing and broker merge configs to deprecate co…
Browse files Browse the repository at this point in the history
…nfig-magic
  • Loading branch information
clintropolis committed Jul 29, 2023
1 parent 8232c03 commit 2c1c4fc
Show file tree
Hide file tree
Showing 50 changed files with 732 additions and 575 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import org.apache.druid.java.util.common.io.Closer;
import org.apache.druid.java.util.common.logger.Logger;
import org.apache.druid.math.expr.ExprMacroTable;
import org.apache.druid.query.BrokerParallelMergeConfig;
import org.apache.druid.query.BySegmentQueryRunner;
import org.apache.druid.query.DefaultQueryRunnerFactoryConglomerate;
import org.apache.druid.query.DruidProcessingConfig;
Expand Down Expand Up @@ -258,12 +259,6 @@ public int getNumThreads()
{
return numProcessingThreads;
}

@Override
public boolean useParallelMergePool()
{
return true;
}
};

conglomerate = new DefaultQueryRunnerFactoryConglomerate(
Expand Down Expand Up @@ -339,7 +334,13 @@ public <T, QueryType extends Query<T>> QueryToolChest<T, QueryType> getToolChest
new ForegroundCachePopulator(JSON_MAPPER, new CachePopulatorStats(), 0),
new CacheConfig(),
new DruidHttpClientConfig(),
processingConfig,
new BrokerParallelMergeConfig() {
@Override
public boolean useParallelMergePool()
{
return true;
}
},
forkJoinPool,
QueryStackTests.DEFAULT_NOOP_SCHEDULER,
JoinableFactoryWrapperTest.NOOP_JOINABLE_FACTORY_WRAPPER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,6 @@ public int getNumThreads()
{
return 1;
}

@Override
public boolean useParallelMergePoolConfigured()
{
return true;
}

@Override
public String getFormatString()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,7 @@ public int getNumThreads()
{
return 1;
}

@Override
public boolean useParallelMergePoolConfigured()
{
return true;
}


@Override
public String getFormatString()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import org.apache.druid.java.util.common.guava.Sequences;
import org.apache.druid.java.util.emitter.core.Event;
import org.apache.druid.java.util.emitter.service.ServiceEmitter;
import org.apache.druid.query.DruidProcessingConfig;
import org.apache.druid.query.BrokerParallelMergeConfig;
import org.apache.druid.query.Query;
import org.apache.druid.query.QueryPlus;
import org.apache.druid.query.QueryRunner;
Expand Down Expand Up @@ -363,14 +363,7 @@ public long getMaxQueuedBytes()
return 0L;
}
},
new DruidProcessingConfig()
{
@Override
public String getFormatString()
{
return null;
}
},
new BrokerParallelMergeConfig(),
ForkJoinPool.commonPool(),
QueryStackTests.DEFAULT_NOOP_SCHEDULER,
new JoinableFactoryWrapper(new MapJoinableFactory(ImmutableSet.of(), ImmutableMap.of())),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import org.apache.druid.java.util.emitter.EmittingLogger;
import org.apache.druid.java.util.emitter.service.ServiceEmitter;
import org.apache.druid.segment.incremental.RowIngestionMetersFactory;
import org.apache.druid.server.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.java.util.metrics.DruidMonitorSchedulerConfig;
import org.joda.time.DateTime;

import javax.annotation.Nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.apache.druid.java.util.emitter.service.ServiceEmitter;
import org.apache.druid.segment.incremental.RowIngestionMetersFactory;
import org.apache.druid.segment.indexing.DataSchema;
import org.apache.druid.server.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.java.util.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.server.security.Action;
import org.apache.druid.server.security.Resource;
import org.apache.druid.server.security.ResourceAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.apache.druid.math.expr.ExprMacroTable;
import org.apache.druid.query.expression.LookupEnabledTestExprMacroTable;
import org.apache.druid.segment.incremental.RowIngestionMetersFactory;
import org.apache.druid.server.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.java.util.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.server.metrics.NoopServiceEmitter;
import org.junit.Assert;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
import org.apache.druid.segment.indexing.RealtimeIOConfig;
import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec;
import org.apache.druid.segment.realtime.FireDepartment;
import org.apache.druid.server.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.java.util.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.server.metrics.ExceptionCapturingServiceEmitter;
import org.apache.druid.server.metrics.NoopServiceEmitter;
import org.apache.druid.server.security.Action;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import org.apache.druid.java.util.emitter.service.ServiceEmitter;
import org.apache.druid.segment.incremental.RowIngestionMetersFactory;
import org.apache.druid.segment.indexing.DataSchema;
import org.apache.druid.server.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.java.util.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.server.security.Action;
import org.apache.druid.server.security.Resource;
import org.apache.druid.server.security.ResourceAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
import org.apache.druid.segment.indexing.RealtimeIOConfig;
import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec;
import org.apache.druid.segment.realtime.FireDepartment;
import org.apache.druid.server.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.java.util.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.server.metrics.ExceptionCapturingServiceEmitter;
import org.apache.druid.server.metrics.NoopServiceEmitter;
import org.apache.druid.server.security.Action;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.apache.druid.java.util.emitter.service.ServiceEmitter;
import org.apache.druid.segment.incremental.RowIngestionMetersFactory;
import org.apache.druid.segment.indexing.DataSchema;
import org.apache.druid.server.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.java.util.metrics.DruidMonitorSchedulerConfig;

import javax.annotation.Nullable;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
import org.apache.druid.segment.incremental.RowIngestionMetersFactory;
import org.apache.druid.segment.indexing.DataSchema;
import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec;
import org.apache.druid.server.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.java.util.metrics.DruidMonitorSchedulerConfig;
import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
import org.joda.time.DateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
import org.apache.druid.segment.incremental.RowIngestionMetersFactory;
import org.apache.druid.segment.indexing.DataSchema;
import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec;
import org.apache.druid.server.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.java.util.metrics.DruidMonitorSchedulerConfig;
import org.apache.druid.server.metrics.NoopServiceEmitter;
import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.apache.druid.discovery.DruidNodeDiscoveryProvider;
import org.apache.druid.discovery.NodeRole;
import org.apache.druid.guice.AnnouncerModule;
import org.apache.druid.guice.DruidProcessingConfigModule;
import org.apache.druid.guice.LegacyBrokerParallelMergeConfigModule;
import org.apache.druid.guice.JsonConfigProvider;
import org.apache.druid.guice.LazySingleton;
import org.apache.druid.guice.ManageLifecycle;
Expand Down Expand Up @@ -496,7 +496,7 @@ private static Injector makeInjector(
new AnnouncerModule(),
new DiscoveryModule(),
// Dependencies from other modules
new DruidProcessingConfigModule(),
new LegacyBrokerParallelMergeConfigModule(),
// Dependencies from other modules
new StorageNodeModule(),

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AllocationMetricCollector
* Tests show the call to getThreadAllocatedBytes for a single thread ID out of 500 threads running takes around
* 9000 ns (in the worst case), which for 500 IDs should take 500*9000/1000/1000 = 4.5 ms to the max.
* AllocationMetricCollector takes linear time to calculate delta, for 500 threads it's negligible.
* See the default emitting period {@link MonitorSchedulerConfig#getEmitterPeriod}.
* See the default emitting period {@link DruidMonitorSchedulerConfig#getEmitterPeriod}.
*
* @return all threads summed allocated bytes delta
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class BasicMonitorScheduler extends MonitorScheduler
private final ScheduledExecutorService exec;

public BasicMonitorScheduler(
MonitorSchedulerConfig config,
DruidMonitorSchedulerConfig config,
ServiceEmitter emitter,
List<Monitor> monitors,
ScheduledExecutorService exec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class ClockDriftSafeMonitorScheduler extends MonitorScheduler
private final ExecutorService monitorRunner;

public ClockDriftSafeMonitorScheduler(
MonitorSchedulerConfig config,
DruidMonitorSchedulerConfig config,
ServiceEmitter emitter,
List<Monitor> monitors,
CronScheduler monitorScheduler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,23 @@
* under the License.
*/

package org.apache.druid.server.metrics;
package org.apache.druid.java.util.metrics;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.druid.java.util.metrics.BasicMonitorScheduler;
import org.apache.druid.java.util.metrics.MonitorSchedulerConfig;
import org.joda.time.Duration;
import org.joda.time.Period;

/**
*/
public class DruidMonitorSchedulerConfig extends MonitorSchedulerConfig
public class DruidMonitorSchedulerConfig
{
@JsonProperty
private String schedulerClassName = BasicMonitorScheduler.class.getName();

@JsonProperty
private Period emissionPeriod = new Period("PT1M");

@JsonProperty
public String getSchedulerClassName()
{
return schedulerClassName;
Expand All @@ -46,7 +45,6 @@ public Period getEmissionPeriod()
return emissionPeriod;
}

@Override
public Duration getEmitterPeriod()
{
return emissionPeriod.toStandardDuration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public abstract class MonitorScheduler
{
private static final Logger log = new Logger(MonitorScheduler.class);

private final MonitorSchedulerConfig config;
private final DruidMonitorSchedulerConfig config;
private final ServiceEmitter emitter;
private final Set<Monitor> monitors;
private final Object lock = new Object();

private volatile boolean started = false;

MonitorScheduler(
MonitorSchedulerConfig config,
DruidMonitorSchedulerConfig config,
ServiceEmitter emitter,
List<Monitor> monitors
)
Expand Down Expand Up @@ -135,7 +135,7 @@ boolean hasMonitor(final Monitor monitor)
}
}

MonitorSchedulerConfig getConfig()
DruidMonitorSchedulerConfig getConfig()
{
return config;
}
Expand Down

This file was deleted.

Loading

0 comments on commit 2c1c4fc

Please sign in to comment.