Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,14 @@ jobs:
name: "(Compile=openjdk8, Run=openjdk8) perfect rollup parallel batch index integration test with Indexer"
env: TESTNG_GROUPS='-Dgroups=perfect-rollup-parallel-batch-index' JVM_RUNTIME='-Djvm.runtime=8' USE_INDEXER='indexer'

- <<: *integration_perfect_rollup_parallel_batch_index
name: "(Compile=openjdk8, Run=openjdk8) perfect rollup parallel batch index integration test with deep storage as intermediate store"
env: TESTNG_GROUPS='-Dgroups=shuffle-deep-store' JVM_RUNTIME='-Djvm.runtime=8' USE_INDEXER='middleManager'

- <<: *integration_perfect_rollup_parallel_batch_index
name: "(Compile=openjdk8, Run=openjdk8) perfect rollup parallel batch index integration test with deep storage as intermediate store with indexer"
env: TESTNG_GROUPS='-Dgroups=shuffle-deep-store' JVM_RUNTIME='-Djvm.runtime=8' USE_INDEXER='indexer'

- &integration_kafka_index
name: "(Compile=openjdk8, Run=openjdk8) kafka index integration test"
stage: Tests - phase 2
Expand Down Expand Up @@ -597,13 +605,13 @@ jobs:
stage: Tests - phase 2
jdk: openjdk8
services: *integration_test_services
env: TESTNG_GROUPS='-DexcludedGroups=batch-index,input-format,input-source,perfect-rollup-parallel-batch-index,kafka-index,query,query-retry,query-error,realtime-index,security,ldap-security,s3-deep-storage,gcs-deep-storage,azure-deep-storage,hdfs-deep-storage,s3-ingestion,kinesis-index,kinesis-data-format,kafka-transactional-index,kafka-index-slow,kafka-transactional-index-slow,kafka-data-format,hadoop-s3-to-s3-deep-storage,hadoop-s3-to-hdfs-deep-storage,hadoop-azure-to-azure-deep-storage,hadoop-azure-to-hdfs-deep-storage,hadoop-gcs-to-gcs-deep-storage,hadoop-gcs-to-hdfs-deep-storage,aliyun-oss-deep-storage,append-ingestion,compaction,high-availability,upgrade' JVM_RUNTIME='-Djvm.runtime=8' USE_INDEXER='middleManager'
env: TESTNG_GROUPS='-DexcludedGroups=batch-index,input-format,input-source,perfect-rollup-parallel-batch-index,kafka-index,query,query-retry,query-error,realtime-index,security,ldap-security,s3-deep-storage,gcs-deep-storage,azure-deep-storage,hdfs-deep-storage,s3-ingestion,kinesis-index,kinesis-data-format,kafka-transactional-index,kafka-index-slow,kafka-transactional-index-slow,kafka-data-format,hadoop-s3-to-s3-deep-storage,hadoop-s3-to-hdfs-deep-storage,hadoop-azure-to-azure-deep-storage,hadoop-azure-to-hdfs-deep-storage,hadoop-gcs-to-gcs-deep-storage,hadoop-gcs-to-hdfs-deep-storage,aliyun-oss-deep-storage,append-ingestion,compaction,high-availability,upgrade,shuffle-deep-store' JVM_RUNTIME='-Djvm.runtime=8' USE_INDEXER='middleManager'
script: *run_integration_test
after_failure: *integration_test_diags

- <<: *integration_tests
name: "(Compile=openjdk8, Run=openjdk8) other integration tests with Indexer"
env: TESTNG_GROUPS='-DexcludedGroups=batch-index,input-format,input-source,perfect-rollup-parallel-batch-index,kafka-index,query,query-retry,query-error,realtime-index,security,ldap-security,s3-deep-storage,gcs-deep-storage,azure-deep-storage,hdfs-deep-storage,s3-ingestion,kinesis-index,kinesis-data-format,kafka-transactional-index,kafka-index-slow,kafka-transactional-index-slow,kafka-data-format,hadoop-s3-to-s3-deep-storage,hadoop-s3-to-hdfs-deep-storage,hadoop-azure-to-azure-deep-storage,hadoop-azure-to-hdfs-deep-storage,hadoop-gcs-to-gcs-deep-storage,hadoop-gcs-to-hdfs-deep-storage,aliyun-oss-deep-storage,append-ingestion,compaction,high-availability,upgrade' JVM_RUNTIME='-Djvm.runtime=8' USE_INDEXER='indexer'
env: TESTNG_GROUPS='-DexcludedGroups=batch-index,input-format,input-source,perfect-rollup-parallel-batch-index,kafka-index,query,query-retry,query-error,realtime-index,security,ldap-security,s3-deep-storage,gcs-deep-storage,azure-deep-storage,hdfs-deep-storage,s3-ingestion,kinesis-index,kinesis-data-format,kafka-transactional-index,kafka-index-slow,kafka-transactional-index-slow,kafka-data-format,hadoop-s3-to-s3-deep-storage,hadoop-s3-to-hdfs-deep-storage,hadoop-azure-to-azure-deep-storage,hadoop-azure-to-hdfs-deep-storage,hadoop-gcs-to-gcs-deep-storage,hadoop-gcs-to-hdfs-deep-storage,aliyun-oss-deep-storage,append-ingestion,compaction,high-availability,upgrade,shuffle-deep-store' JVM_RUNTIME='-Djvm.runtime=8' USE_INDEXER='indexer'

- <<: *integration_tests
name: "(Compile=openjdk8, Run=openjdk8) leadership and high availability integration tests"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public interface DataSegmentPusher
*/
DataSegment push(File file, DataSegment segment, boolean useUniquePath) throws IOException;

default DataSegment pushToPath(File indexFilesDir, DataSegment segment, String storageDirSuffix) throws IOException
{
throw new UnsupportedOperationException("not supported");
}

//use map instead of LoadSpec class to avoid dependency pollution.
Map<String, Object> makeLoadSpec(URI finalIndexZipFilePath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public DataSegment push(File file, DataSegment segment, boolean replaceExisting)
return segment;
}

@Override
public DataSegment pushToPath(File file, DataSegment segment, String storageDirSuffix)
{
return segment;
}

@Override
public Map<String, Object> makeLoadSpec(URI uri)
{
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ Processing properties set on the Middlemanager will be passed through to Peons.
|`druid.processing.columnCache.sizeBytes`|Maximum size in bytes for the dimension value lookup cache. Any value greater than `0` enables the cache. It is currently disabled by default. Enabling the lookup cache can significantly improve the performance of aggregators operating on dimension values, such as the JavaScript aggregator, or cardinality aggregator, but can slow things down if the cache hit rate is low (i.e. dimensions with few repeating values). Enabling it may also require additional garbage collection tuning to avoid long GC pauses.|`0` (disabled)|
|`druid.processing.fifo`|If the processing queue should treat tasks of equal priority in a FIFO manner|`false`|
|`druid.processing.tmpDir`|Path where temporary files created while processing a query should be stored. If specified, this configuration takes priority over the default `java.io.tmpdir` path.|path represented by `java.io.tmpdir`|
|`druid.processing.intermediaryData.storage.type`|Storage type for storing intermediary segments of data shuffle between native parallel index tasks. Current choice are only "local" which stores segment files in local storage of Middle Managers (or Indexer).|local|
|`druid.processing.intermediaryData.storage.type`|Storage type for storing intermediary segments of data shuffle between native parallel index tasks. Current choices are "local" which stores segment files in local storage of Middle Managers (or Indexer) or "deepstore" which uses configured deep storage. Note - With "deepstore" type data is stored in `shuffle-data` directory under the configured deep storage path, auto clean up for this directory is not supported yet. One can setup cloud storage lifecycle rules for auto clean up of data at `shuffle-data` prefix location.|local|

The amount of direct memory needed by Druid is at least
`druid.processing.buffer.sizeBytes * (druid.processing.numMergeBuffers + druid.processing.numThreads + 1)`. You can
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,13 @@ public List<String> getAllowedPropertyPrefixesForHadoop()
public DataSegment push(final File indexFilesDir, final DataSegment inSegment, final boolean useUniquePath)
throws IOException
{
final String path = OssUtils.constructSegmentPath(config.getPrefix(), getStorageDir(inSegment, useUniquePath));
return pushToPath(indexFilesDir, inSegment, getStorageDir(inSegment, useUniquePath));
}

@Override
public DataSegment pushToPath(File indexFilesDir, DataSegment inSegment, String storageDirSuffix) throws IOException
{
final String path = OssUtils.constructSegmentPath(config.getPrefix(), storageDirSuffix);
log.debug("Copying segment[%s] to OSS at location[%s]", inSegment.getId(), path);

final File zipOutFile = File.createTempFile("druid", "index.zip");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,16 @@ public String getPathForHadoop(String dataSource)
public DataSegment push(final File indexFilesDir, DataSegment segment, final boolean useUniquePath) throws IOException
{
log.info("Writing [%s] to C*", indexFilesDir);
return pushToPath(indexFilesDir, segment, this.getStorageDir(segment, useUniquePath));
}

@Override
public DataSegment pushToPath(File indexFilesDir, DataSegment segment, String storageDirSuffix) throws IOException
{
String key = JOINER.join(
config.getKeyspace().isEmpty() ? null : config.getKeyspace(),
this.getStorageDir(segment, useUniquePath)
);

storageDirSuffix
);
// Create index
final File compressedIndexFile = File.createTempFile("druid", "index.zip");
long indexSize = CompressionUtils.zip(indexFilesDir, compressedIndexFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,17 @@ public String getPathForHadoop(final String dataSource)

@Override
public DataSegment push(final File indexFilesDir, final DataSegment inSegment, final boolean useUniquePath)
{
return pushToPath(indexFilesDir, inSegment, getStorageDir(inSegment, useUniquePath));
}

@Override
public DataSegment pushToPath(File indexFilesDir, DataSegment inSegment, String storageDirSuffix)
{
final String segmentPath = CloudFilesUtils.buildCloudFilesPath(
this.config.getBasePath(),
getStorageDir(inSegment, useUniquePath)
);

storageDirSuffix
);
File descriptorFile = null;
File zipOutFile = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ public String getPathForHadoop()
@Override
public String getStorageDir(DataSegment dataSegment, boolean useUniquePath)
{
String prefix = segmentConfig.getPrefix();
boolean prefixIsNullOrEmpty = org.apache.commons.lang.StringUtils.isEmpty(prefix);
String seg = JOINER.join(
prefixIsNullOrEmpty ? null : StringUtils.maybeRemoveTrailingSlash(prefix),
dataSegment.getDataSource(),
StringUtils.format(
"%s_%s",
Expand All @@ -107,7 +104,7 @@ public String getStorageDir(DataSegment dataSegment, boolean useUniquePath)
useUniquePath ? DataSegmentPusher.generateUniquePath() : null
);

log.info("DataSegment: [%s]", seg);
log.info("DataSegment Suffix: [%s]", seg);
Comment thread
zachjsh marked this conversation as resolved.

// Replace colons with underscores, since they are not supported through wasb:// prefix
return seg;
Expand All @@ -124,6 +121,19 @@ public DataSegment push(final File indexFilesDir, final DataSegment segment, fin
throws IOException
{
log.info("Uploading [%s] to Azure.", indexFilesDir);
final String azurePathSuffix = getAzurePath(segment, useUniquePath);
return pushToPath(indexFilesDir, segment, azurePathSuffix);
}

@Override
public DataSegment pushToPath(File indexFilesDir, DataSegment segment, String storageDirSuffix) throws IOException
{
String prefix = segmentConfig.getPrefix();
boolean prefixIsNullOrEmpty = org.apache.commons.lang.StringUtils.isEmpty(prefix);
final String azurePath = JOINER.join(
prefixIsNullOrEmpty ? null : StringUtils.maybeRemoveTrailingSlash(prefix),
storageDirSuffix
);

final int binaryVersion = SegmentUtils.getVersionFromDir(indexFilesDir);
File zipOutFile = null;
Expand All @@ -132,8 +142,6 @@ public DataSegment push(final File indexFilesDir, final DataSegment segment, fin
final File outFile = zipOutFile = File.createTempFile("index", ".zip");
final long size = CompressionUtils.zip(indexFilesDir, zipOutFile);

final String azurePath = getAzurePath(segment, useUniquePath);

return AzureUtils.retryAzureOperation(
() -> uploadDataSegment(segment, binaryVersion, size, outFile, azurePath),
accountConfig.getMaxTries()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ public void test_push_nonUniquePathWithPrefix_succeeds() throws Exception
Files.write(DATA, tmp);

String azurePath = pusher.getAzurePath(SEGMENT_TO_PUSH, useUniquePath);
azureStorage.uploadBlob(EasyMock.anyObject(File.class), EasyMock.eq(CONTAINER_NAME), EasyMock.eq(azurePath));
azureStorage.uploadBlob(
EasyMock.anyObject(File.class),
EasyMock.eq(CONTAINER_NAME),
EasyMock.eq(PREFIX + "/" + azurePath)
);
EasyMock.expectLastCall();

replayAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,20 @@ public DataSegment push(final File indexFilesDir, final DataSegment segment, fin
throws IOException
{
log.debug("Uploading [%s] to Google.", indexFilesDir);
final String storageDir = this.getStorageDir(segment, useUniquePath);
return pushToPath(indexFilesDir, segment, storageDir);
}

@Override
public DataSegment pushToPath(File indexFilesDir, DataSegment segment, String storageDirSuffix) throws IOException
{
final int version = SegmentUtils.getVersionFromDir(indexFilesDir);
File indexFile = null;

try {
indexFile = File.createTempFile("index", ".zip");
final long indexSize = CompressionUtils.zip(indexFilesDir, indexFile);
final String storageDir = this.getStorageDir(segment, useUniquePath);
final String indexPath = buildPath(storageDir + "/" + "index.zip");
final String indexPath = buildPath(storageDirSuffix + "/" + "index.zip");

final DataSegment outSegment = segment
.withSize(indexSize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,30 @@ public DataSegment push(final File inDir, final DataSegment segment, final boole
// '{partitionNum}_index.zip' without unique paths and '{partitionNum}_{UUID}_index.zip' with unique paths.
final String storageDir = this.getStorageDir(segment, false);


final String uniquePrefix = useUniquePath ? DataSegmentPusher.generateUniquePath() + "_" : "";
final String outIndexFilePathSuffix = StringUtils.format(
"%s/%d_%sindex.zip",
storageDir,
segment.getShardSpec().getPartitionNum(),
uniquePrefix
);

return pushToPath(inDir, segment, outIndexFilePathSuffix);
}

@Override
public DataSegment pushToPath(File inDir, DataSegment segment, String storageDirSuffix) throws IOException
{
log.debug(
"Copying segment[%s] to HDFS at location[%s/%s]",
segment.getId(),
fullyQualifiedStorageDirectory.get(),
storageDir
storageDirSuffix
);

final String storageDir = StringUtils.format("%s/%s", fullyQualifiedStorageDirectory.get(), storageDirSuffix);

Path tmpIndexFile = new Path(StringUtils.format(
"%s/%s/%s/%s_index.zip",
fullyQualifiedStorageDirectory.get(),
Expand All @@ -130,16 +147,7 @@ public DataSegment push(final File inDir, final DataSegment segment, final boole
try (FSDataOutputStream out = fs.create(tmpIndexFile)) {
size = CompressionUtils.zip(inDir, out);
}

final String uniquePrefix = useUniquePath ? DataSegmentPusher.generateUniquePath() + "_" : "";
final Path outIndexFile = new Path(StringUtils.format(
"%s/%s/%d_%sindex.zip",
fullyQualifiedStorageDirectory.get(),
storageDir,
segment.getShardSpec().getPartitionNum(),
uniquePrefix
));

final Path outIndexFile = new Path(storageDir);
dataSegment = segment.withLoadSpec(makeLoadSpec(outIndexFile.toUri()))
.withSize(size)
.withBinaryVersion(SegmentUtils.getVersionFromDir(inDir));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ public List<String> getAllowedPropertyPrefixesForHadoop()
public DataSegment push(final File indexFilesDir, final DataSegment inSegment, final boolean useUniquePath)
throws IOException
{
final String s3Path = S3Utils.constructSegmentPath(config.getBaseKey(), getStorageDir(inSegment, useUniquePath));
return pushToPath(indexFilesDir, inSegment, getStorageDir(inSegment, useUniquePath));
}

@Override
public DataSegment pushToPath(File indexFilesDir, DataSegment inSegment, String storageDirSuffix) throws IOException
{
final String s3Path = S3Utils.constructSegmentPath(config.getBaseKey(), storageDirSuffix);
log.debug("Copying segment[%s] to S3 at location[%s]", inSegment.getId(), s3Path);

final File zipOutFile = File.createTempFile("druid", "index.zip");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.druid.indexing.common.task.batch.parallel;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.druid.timeline.partition.BuildingShardSpec;
import org.joda.time.Interval;

import java.util.Map;
import java.util.Objects;

/**
* This class represents the intermediary deep storage location where the partition of {@code interval} and {@code shardSpec}
* is stored.
*/
public class DeepStoragePartitionLocation implements PartitionLocation
{
private final String subTaskId;
private final Interval interval;
private final BuildingShardSpec shardSpec;
private final Map<String, Object> loadSpec;

@JsonCreator
public DeepStoragePartitionLocation(
Comment thread
pjain1 marked this conversation as resolved.
@JsonProperty("subTaskId") String subTaskId,
@JsonProperty("interval") Interval interval,
@JsonProperty("shardSpec") BuildingShardSpec shardSpec,
@JsonProperty("loadSpec") Map<String, Object> loadSpec
)
{
this.subTaskId = subTaskId;
this.interval = interval;
this.shardSpec = shardSpec;
this.loadSpec = loadSpec;
}

@JsonIgnore
@Override
public int getBucketId()
{
return shardSpec.getBucketId();
}

@JsonProperty
@Override
public Interval getInterval()
{
return interval;
}

@JsonProperty
@Override
public BuildingShardSpec getShardSpec()
{
return shardSpec;
}

@JsonProperty
@Override
public String getSubTaskId()
{
return subTaskId;
}

@JsonProperty
public Map<String, Object> getLoadSpec()
{
return loadSpec;
}

@Override
public boolean equals(Object o)
{
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DeepStoragePartitionLocation that = (DeepStoragePartitionLocation) o;
return subTaskId.equals(that.subTaskId)
&& interval.equals(that.interval)
&& shardSpec.equals(that.shardSpec)
&& loadSpec.equals(that.loadSpec);
}

@Override
public int hashCode()
{
return Objects.hash(subTaskId, interval, shardSpec, loadSpec);
}

@Override
public String toString()
{
return "DeepStoragePartitionLocation{" +
"subTaskId='" + subTaskId + '\'' +
", interval=" + interval +
", shardSpec=" + shardSpec +
", loadSpec=" + loadSpec +
'}';
}
}
Loading