Class NumberedOverwriteShardSpec
- java.lang.Object
-
- org.apache.druid.timeline.partition.NumberedOverwriteShardSpec
-
- All Implemented Interfaces:
OverwriteShardSpec,ShardSpec
public class NumberedOverwriteShardSpec extends Object implements OverwriteShardSpec
This shardSpec is used only for the segments created by overwriting tasks with segment lock enabled. When the segment lock is used, there is a concept of atomic update group which is a set of segments atomically becoming queryable together in Brokers. It is a similar concept to the core partition set (explainedNumberedShardSpec), but different in a sense that there is only one core partition set per time chunk while there could be multiple atomic update groups in one time chunk. The atomic update group has the root partition range and the minor version to determine the visibility between atomic update groups; the group of the highest minor version in the same root partition range becomes queryable when they have the same major version (DataSegment.getVersion()). Note that this shardSpec is used only when you overwrite existing segments with segment lock enabled. If the task doesn't overwrite segments, it will use NumberedShardSpec instead even when segment lock is used. Similar to NumberedShardSpec, the size of the atomic update group is determined when the task publishes segments at the end of ingestion. As a result,atomicUpdateGroupSizeis set toPartitionIds.UNKNOWN_ATOMIC_UPDATE_GROUP_SIZEfirst, and updated when publishing segments inSegmentPublisherHelper#annotateShardSpec.- See Also:
AtomicUpdateGroup
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.druid.timeline.partition.ShardSpec
ShardSpec.Type
-
-
Constructor Summary
Constructors Constructor Description NumberedOverwriteShardSpec(int partitionId, int startRootPartitionId, int endRootPartitionId, short minorVersion)NumberedOverwriteShardSpec(int partitionId, int startRootPartitionId, int endRootPartitionId, short minorVersion, short atomicUpdateGroupSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> PartitionChunk<T>createChunk(T obj)booleanequals(Object o)shortgetAtomicUpdateGroupSize()Returns the atomic update group size which this segment belongs to.List<String>getDomainDimensions()Get dimensions who have possible range for the rows this shard contains.intgetEndRootPartitionId()Returns the end root partition ID of the atomic update group which this segment belongs to.ShardSpecLookupgetLookup(List<? extends ShardSpec> shardSpecs)shortgetMinorVersion()Returns the minor version associated to the atomic update group which this segment belongs to.intgetPartitionNum()Returns the partition ID of this segment.intgetStartRootPartitionId()Returns the start root partition ID of the atomic update group which this segment belongs to.StringgetType()Get the type name of this ShardSpec.inthashCode()booleanpossibleInDomain(Map<String,com.google.common.collect.RangeSet<String>> domain)if given domain ranges are not possible in this shard, return false; otherwise return true;StringtoString()OverwriteShardSpecwithAtomicUpdateGroupSize(short atomicUpdateGroupSize)-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.druid.timeline.partition.OverwriteShardSpec
getNumCorePartitions, sharePartitionSpace, withAtomicUpdateGroupSize
-
-
-
-
Constructor Detail
-
NumberedOverwriteShardSpec
public NumberedOverwriteShardSpec(int partitionId, int startRootPartitionId, int endRootPartitionId, short minorVersion, short atomicUpdateGroupSize)
-
NumberedOverwriteShardSpec
public NumberedOverwriteShardSpec(int partitionId, int startRootPartitionId, int endRootPartitionId, short minorVersion)
-
-
Method Detail
-
withAtomicUpdateGroupSize
public OverwriteShardSpec withAtomicUpdateGroupSize(short atomicUpdateGroupSize)
- Specified by:
withAtomicUpdateGroupSizein interfaceOverwriteShardSpec
-
createChunk
public <T> PartitionChunk<T> createChunk(T obj)
- Specified by:
createChunkin interfaceShardSpec
-
getPartitionNum
public int getPartitionNum()
Description copied from interface:ShardSpecReturns the partition ID of this segment.- Specified by:
getPartitionNumin interfaceShardSpec
-
getStartRootPartitionId
public int getStartRootPartitionId()
Description copied from interface:ShardSpecReturns the start root partition ID of the atomic update group which this segment belongs to.- Specified by:
getStartRootPartitionIdin interfaceShardSpec- See Also:
AtomicUpdateGroup
-
getEndRootPartitionId
public int getEndRootPartitionId()
Description copied from interface:ShardSpecReturns the end root partition ID of the atomic update group which this segment belongs to.- Specified by:
getEndRootPartitionIdin interfaceShardSpec- See Also:
AtomicUpdateGroup
-
getMinorVersion
public short getMinorVersion()
Description copied from interface:ShardSpecReturns the minor version associated to the atomic update group which this segment belongs to.- Specified by:
getMinorVersionin interfaceShardSpec- See Also:
AtomicUpdateGroup
-
getAtomicUpdateGroupSize
public short getAtomicUpdateGroupSize()
Description copied from interface:ShardSpecReturns the atomic update group size which this segment belongs to.- Specified by:
getAtomicUpdateGroupSizein interfaceShardSpec- See Also:
AtomicUpdateGroup
-
getLookup
public ShardSpecLookup getLookup(List<? extends ShardSpec> shardSpecs)
-
getDomainDimensions
public List<String> getDomainDimensions()
Description copied from interface:ShardSpecGet dimensions who have possible range for the rows this shard contains.- Specified by:
getDomainDimensionsin interfaceShardSpec- Returns:
- list of dimensions who has its possible range. Dimensions with unknown possible range are not listed
-
possibleInDomain
public boolean possibleInDomain(Map<String,com.google.common.collect.RangeSet<String>> domain)
Description copied from interface:ShardSpecif given domain ranges are not possible in this shard, return false; otherwise return true;- Specified by:
possibleInDomainin interfaceShardSpec- Returns:
- possibility of in domain
-
getType
public String getType()
Description copied from interface:ShardSpecGet the type name of this ShardSpec.
-
-