Skip to content

Commit

Permalink
Merge branch 'apache:master' into ashibhardwaj/CVE-2024-47535
Browse files Browse the repository at this point in the history
  • Loading branch information
ashibhardwaj authored Jan 6, 2025
2 parents f6a3897 + 311e68f commit 77ef534
Show file tree
Hide file tree
Showing 67 changed files with 1,003 additions and 708 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
import org.apache.druid.client.CachingClusteredClient;
import org.apache.druid.client.DruidServer;
import org.apache.druid.client.ImmutableDruidServer;
import org.apache.druid.client.QueryableDruidServer;
import org.apache.druid.client.TimelineServerView;
import org.apache.druid.client.cache.CacheConfig;
import org.apache.druid.client.cache.CachePopulatorStats;
import org.apache.druid.client.cache.ForegroundCachePopulator;
import org.apache.druid.client.cache.MapCache;
import org.apache.druid.client.selector.HighestPriorityTierSelectorStrategy;
import org.apache.druid.client.selector.QueryableDruidServer;
import org.apache.druid.client.selector.RandomServerSelectorStrategy;
import org.apache.druid.client.selector.ServerSelector;
import org.apache.druid.client.selector.TierSelectorStrategy;
Expand Down Expand Up @@ -579,7 +579,7 @@ public Sequence<Object> run(QueryPlus<Object> queryPlus, ResponseContext respons
}
}

private static class SingleSegmentDruidServer extends QueryableDruidServer<SimpleQueryRunner>
private static class SingleSegmentDruidServer extends QueryableDruidServer
{
SingleSegmentDruidServer(DruidServer server, SimpleQueryRunner runner)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,14 @@

package org.apache.druid.compressedbigdecimal;

import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.common.collect.ImmutableList;
import com.google.inject.Injector;
import org.apache.druid.compressedbigdecimal.CompressedBigDecimalSqlAggregatorTestBase.CompressedBigDecimalComponentSupplier;
import org.apache.druid.data.input.InputRow;
import org.apache.druid.data.input.InputRowSchema;
import org.apache.druid.data.input.impl.DimensionsSpec;
import org.apache.druid.data.input.impl.TimestampSpec;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.query.Druids;
Expand All @@ -48,6 +45,7 @@
import org.apache.druid.sql.calcite.TempDirProducer;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.util.CalciteTests;
import org.apache.druid.sql.calcite.util.DruidModuleCollection;
import org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier;
import org.apache.druid.sql.calcite.util.TestDataBuilder;
import org.apache.druid.timeline.DataSegment;
Expand Down Expand Up @@ -80,10 +78,9 @@ public CompressedBigDecimalComponentSupplier(TempDirProducer tempFolderProducer)
TestDataBuilder.RAW_ROWS1.stream().map(m -> TestDataBuilder.createRow(m, SCHEMA)).collect(Collectors.toList());

@Override
public void configureGuice(DruidInjectorBuilder builder)
public DruidModule getCoreModule()
{
super.configureGuice(builder);
builder.addModule(new CompressedBigDecimalModule());
return DruidModuleCollection.of(super.getCoreModule(), new CompressedBigDecimalModule());
}

@Override
Expand Down Expand Up @@ -120,13 +117,6 @@ public SpecificSegmentsQuerySegmentWalker createQuerySegmentWalker(
index
);
}

@Override
public void configureJsonMapper(ObjectMapper objectMapper)
{
objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
objectMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ public void start()
public void stop()
{
log.debug("Stopping KubernetesTaskRunner");
// Stop managing the running k8s jobs
exec.shutdownNow();
cleanupExecutor.shutdownNow();
log.debug("Stopped KubernetesTaskRunner");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -759,4 +760,20 @@ public void test_getUsedCapacity()
runner.tasks.remove(task.getId());
Assert.assertEquals(0, runner.getUsedCapacity());
}

@Test
public void test_stop()
{

KubernetesTaskRunner kubernetesTaskRunner = new KubernetesTaskRunner(
taskAdapter,
config,
peonClient,
httpClient,
new TestPeonLifecycleFactory(kubernetesPeonLifecycle),
emitter
);
kubernetesTaskRunner.stop();
Assert.assertThrows(RejectedExecutionException.class, () -> kubernetesTaskRunner.run(task));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.google.common.collect.ImmutableList;
import com.google.inject.Injector;
import org.apache.druid.common.config.NullHandling;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.math.expr.ExprMacroTable;
import org.apache.druid.query.Druids;
Expand Down Expand Up @@ -52,6 +52,7 @@
import org.apache.druid.sql.calcite.TempDirProducer;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.util.CalciteTests;
import org.apache.druid.sql.calcite.util.DruidModuleCollection;
import org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier;
import org.apache.druid.sql.calcite.util.TestDataBuilder;
import org.apache.druid.timeline.DataSegment;
Expand All @@ -71,10 +72,9 @@ public TDigestComponentSupplier(TempDirProducer tempFolderProducer)
}

@Override
public void configureGuice(DruidInjectorBuilder builder)
public DruidModule getCoreModule()
{
super.configureGuice(builder);
builder.addModule(new TDigestSketchModule());
return DruidModuleCollection.of(super.getCoreModule(), new TDigestSketchModule());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.google.inject.Injector;
import org.apache.druid.common.config.NullHandling;
import org.apache.druid.error.DruidException;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.java.util.common.Intervals;
import org.apache.druid.java.util.common.StringEncoding;
import org.apache.druid.java.util.common.StringUtils;
Expand Down Expand Up @@ -82,6 +82,7 @@
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.util.CacheTestHelperModule.ResultCacheMode;
import org.apache.druid.sql.calcite.util.CalciteTests;
import org.apache.druid.sql.calcite.util.DruidModuleCollection;
import org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier;
import org.apache.druid.sql.calcite.util.TestDataBuilder;
import org.apache.druid.sql.guice.SqlModule;
Expand Down Expand Up @@ -260,10 +261,9 @@ public void gatherProperties(Properties properties)
}

@Override
public void configureGuice(DruidInjectorBuilder builder)
public DruidModule getCoreModule()
{
super.configureGuice(builder);
builder.addModule(new HllSketchModule());
return DruidModuleCollection.of(super.getCoreModule(), new HllSketchModule());
}

@SuppressWarnings("resource")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.inject.Injector;
import org.apache.druid.common.config.NullHandling;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.java.util.common.Intervals;
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.query.Druids;
Expand Down Expand Up @@ -69,6 +69,7 @@
import org.apache.druid.sql.calcite.TempDirProducer;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.util.CalciteTests;
import org.apache.druid.sql.calcite.util.DruidModuleCollection;
import org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier;
import org.apache.druid.sql.calcite.util.TestDataBuilder;
import org.apache.druid.timeline.DataSegment;
Expand All @@ -91,10 +92,9 @@ public DoublesSketchComponentSupplier(TempDirProducer tempFolderProducer)
}

@Override
public void configureGuice(DruidInjectorBuilder builder)
public DruidModule getCoreModule()
{
super.configureGuice(builder);
builder.addModule(new DoublesSketchModule());
return DruidModuleCollection.of(super.getCoreModule(), new DoublesSketchModule());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.google.inject.Injector;
import org.apache.druid.common.config.NullHandling;
import org.apache.druid.error.DruidException;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.java.util.common.Intervals;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.granularity.Granularities;
Expand Down Expand Up @@ -68,6 +68,7 @@
import org.apache.druid.sql.calcite.TempDirProducer;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.util.CalciteTests;
import org.apache.druid.sql.calcite.util.DruidModuleCollection;
import org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier;
import org.apache.druid.sql.calcite.util.TestDataBuilder;
import org.apache.druid.sql.guice.SqlModule;
Expand Down Expand Up @@ -114,10 +115,9 @@ public void gatherProperties(Properties properties)
}

@Override
public void configureGuice(DruidInjectorBuilder builder)
public DruidModule getCoreModule()
{
super.configureGuice(builder);
builder.addModule(new SketchModule());
return DruidModuleCollection.of(super.getCoreModule(), new SketchModule());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.inject.Injector;
import org.apache.druid.data.input.InputRow;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.query.Druids;
Expand Down Expand Up @@ -52,6 +52,7 @@
import org.apache.druid.sql.calcite.TempDirProducer;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.util.CalciteTests;
import org.apache.druid.sql.calcite.util.DruidModuleCollection;
import org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier;
import org.apache.druid.sql.calcite.util.TestDataBuilder;
import org.apache.druid.timeline.DataSegment;
Expand Down Expand Up @@ -111,10 +112,9 @@ public ArrayOfDoublesComponentSupplier(TempDirProducer tempFolderProducer)
}

@Override
public void configureGuice(DruidInjectorBuilder builder)
public DruidModule getCoreModule()
{
super.configureGuice(builder);
builder.addModule(new ArrayOfDoublesSketchModule());
return DruidModuleCollection.of(super.getCoreModule(), new ArrayOfDoublesSketchModule());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.druid.common.config.NullHandling;
import org.apache.druid.data.input.InputRow;
import org.apache.druid.guice.BloomFilterExtensionModule;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.query.Druids;
import org.apache.druid.query.QueryRunnerFactoryConglomerate;
Expand Down Expand Up @@ -54,6 +54,7 @@
import org.apache.druid.sql.calcite.TempDirProducer;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.util.CalciteTests;
import org.apache.druid.sql.calcite.util.DruidModuleCollection;
import org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier;
import org.apache.druid.sql.calcite.util.TestDataBuilder;
import org.apache.druid.timeline.DataSegment;
Expand All @@ -77,10 +78,9 @@ public BloomFilterSqlAggComponentSupplier(TempDirProducer tempFolderProducer)
}

@Override
public void configureGuice(DruidInjectorBuilder builder)
public DruidModule getCoreModule()
{
super.configureGuice(builder);
builder.addModule(new BloomFilterExtensionModule());
return DruidModuleCollection.of(super.getCoreModule(), new BloomFilterExtensionModule());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.druid.common.config.NullHandling;
import org.apache.druid.guice.BloomFilterExtensionModule;
import org.apache.druid.guice.BloomFilterSerializersModule;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.query.Druids;
Expand All @@ -41,6 +41,7 @@
import org.apache.druid.sql.calcite.TempDirProducer;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.util.CalciteTests;
import org.apache.druid.sql.calcite.util.DruidModuleCollection;
import org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier;
import org.apache.druid.sql.http.SqlParameter;
import org.junit.jupiter.api.Disabled;
Expand All @@ -59,10 +60,12 @@ public BloomDimFilterComponentSupplier(TempDirProducer tempFolderProducer)
}

@Override
public void configureGuice(DruidInjectorBuilder builder)
public DruidModule getCoreModule()
{
super.configureGuice(builder);
builder.addModule(new BloomFilterExtensionModule());
return DruidModuleCollection.of(
super.getCoreModule(),
new BloomFilterExtensionModule()
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.inject.Injector;
import org.apache.druid.common.config.NullHandling;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.query.Druids;
import org.apache.druid.query.QueryContexts;
Expand Down Expand Up @@ -56,6 +56,7 @@
import org.apache.druid.sql.calcite.TempDirProducer;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.util.CalciteTests;
import org.apache.druid.sql.calcite.util.DruidModuleCollection;
import org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier;
import org.apache.druid.sql.calcite.util.TestDataBuilder;
import org.apache.druid.timeline.DataSegment;
Expand All @@ -75,10 +76,9 @@ public FixedBucketsHistogramComponentSupplier(TempDirProducer tempFolderProducer
}

@Override
public void configureGuice(DruidInjectorBuilder builder)
public DruidModule getCoreModule()
{
super.configureGuice(builder);
builder.addModule(new ApproximateHistogramDruidModule());
return DruidModuleCollection.of(super.getCoreModule(), new ApproximateHistogramDruidModule());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.google.common.collect.ImmutableList;
import com.google.inject.Injector;
import org.apache.druid.common.config.NullHandling;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.math.expr.ExprMacroTable;
import org.apache.druid.query.Druids;
Expand Down Expand Up @@ -55,6 +55,7 @@
import org.apache.druid.sql.calcite.TempDirProducer;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.util.CalciteTests;
import org.apache.druid.sql.calcite.util.DruidModuleCollection;
import org.apache.druid.sql.calcite.util.SqlTestFramework.StandardComponentSupplier;
import org.apache.druid.sql.calcite.util.TestDataBuilder;
import org.apache.druid.timeline.DataSegment;
Expand All @@ -74,13 +75,11 @@ public QuantileComponentSupplier(TempDirProducer tempFolderProducer)
}

@Override
public void configureGuice(DruidInjectorBuilder builder)
public DruidModule getCoreModule()
{
super.configureGuice(builder);
builder.addModule(new ApproximateHistogramDruidModule());
return DruidModuleCollection.of(super.getCoreModule(), new ApproximateHistogramDruidModule());
}


@Override
public SpecificSegmentsQuerySegmentWalker createQuerySegmentWalker(
final QueryRunnerFactoryConglomerate conglomerate,
Expand Down
Loading

0 comments on commit 77ef534

Please sign in to comment.