pjain1 commented on a change in pull request #11507: URL: https://github.com/apache/druid/pull/11507#discussion_r680001542
########## File path: indexing-service/src/main/java/org/apache/druid/indexing/worker/shuffle/DeepStorageIntermediaryDataManager.java ########## @@ -0,0 +1,89 @@ +/* + * 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.worker.shuffle; + +import com.google.common.io.ByteSource; +import com.google.inject.Inject; +import org.apache.druid.indexing.common.TaskToolbox; +import org.apache.druid.indexing.common.task.batch.parallel.DeepStoragePartitionStat; +import org.apache.druid.indexing.common.task.batch.parallel.GenericPartitionStat; +import org.apache.druid.segment.loading.DataSegmentPusher; +import org.apache.druid.timeline.DataSegment; +import org.apache.druid.timeline.partition.BucketNumberedShardSpec; +import org.joda.time.Interval; + +import javax.annotation.Nullable; +import java.io.File; +import java.io.IOException; +import java.util.Optional; + +public class DeepStorageIntermediaryDataManager implements IntermediaryDataManager +{ + public static final String SHUFFLE_DATA_DIR_PREFIX = "shuffle-data"; + private final DataSegmentPusher dataSegmentPusher; + + @Override + public DataSegment addSegment(String supervisorTaskId, String subTaskId, DataSegment segment, File segmentDir) + throws IOException + { + final BucketNumberedShardSpec<?> bucketNumberedShardSpec = (BucketNumberedShardSpec<?>) segment.getShardSpec(); + final String partitionFilePath = getPartitionFilePath( + supervisorTaskId, + subTaskId, + segment.getInterval(), + bucketNumberedShardSpec.getBucketId() // we must use the bucket ID instead of partition ID + ); + return dataSegmentPusher.pushToPath(segmentDir, segment, SHUFFLE_DATA_DIR_PREFIX + "/" + partitionFilePath); Review comment: I see what you are saying, the temporary zip file created by `DeepStorageIntermediaryDataManager` will be cleaned up after the push so I don't think it matters. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
