public abstract class LoadRule extends Object implements Rule
| Modifier and Type | Field and Description |
|---|---|
String |
NON_PRIMARY_ASSIGNED_COUNT |
static String |
REQUIRED_CAPACITY |
| Constructor and Description |
|---|
LoadRule() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canLoadSegments()
Return true if this Rule can load segment onto one or more type of Druid node, otherwise return false.
|
abstract int |
getNumReplicants(String tier) |
abstract Map<String,Integer> |
getTieredReplicants() |
CoordinatorStats |
run(DruidCoordinator coordinator,
DruidCoordinatorRuntimeParams params,
DataSegment segment)
DruidCoordinatorRuntimeParams.getUsedSegments() must not be called in Rule's code, because the used
segments are not specified for the DruidCoordinatorRuntimeParams passed into Rule's code. |
void |
updateUnderReplicated(Map<String,it.unimi.dsi.fastutil.objects.Object2LongMap<String>> underReplicatedPerTier,
SegmentReplicantLookup segmentReplicantLookup,
DataSegment segment)
This method should update the with the replication count of the
.
|
void |
updateUnderReplicatedWithClusterView(Map<String,it.unimi.dsi.fastutil.objects.Object2LongMap<String>> underReplicatedPerTier,
SegmentReplicantLookup segmentReplicantLookup,
DruidCluster cluster,
DataSegment segment)
This method should update the with the replication count of the
taking into consideration the number of servers available in cluster that the segment can be
replicated on.
|
protected static void |
validateTieredReplicants(Map<String,Integer> tieredReplicants) |
public final String NON_PRIMARY_ASSIGNED_COUNT
public static final String REQUIRED_CAPACITY
public CoordinatorStats run(DruidCoordinator coordinator, DruidCoordinatorRuntimeParams params, DataSegment segment)
RuleDruidCoordinatorRuntimeParams.getUsedSegments() must not be called in Rule's code, because the used
segments are not specified for the DruidCoordinatorRuntimeParams passed into Rule's code. This is because
DruidCoordinatorRuntimeParams entangles two slightly different (nonexistent yet) abstractions:
"CoordinatorDutyParams" and "RuleParams" which contain params that only CoordinatorDuty objects and Rules need, respectively. For example,
ReplicationThrottler needs to belong only to "RuleParams", but not to
"CoordinatorDutyParams". The opposite for the collection of used segments and DataSourcesSnapshot.
See https://github.com/apache/druid/issues/7228public boolean canLoadSegments()
RuleRule.updateUnderReplicated(java.util.Map<java.lang.String, it.unimi.dsi.fastutil.objects.Object2LongMap<java.lang.String>>, org.apache.druid.server.coordinator.SegmentReplicantLookup, org.apache.druid.timeline.DataSegment)canLoadSegments in interface Rulepublic void updateUnderReplicated(Map<String,it.unimi.dsi.fastutil.objects.Object2LongMap<String>> underReplicatedPerTier, SegmentReplicantLookup segmentReplicantLookup, DataSegment segment)
RuleRule.canLoadSegments() must override this method.
Note that is a map of tier -> { dataSource -> underReplicationCount }updateUnderReplicated in interface Rulepublic void updateUnderReplicatedWithClusterView(Map<String,it.unimi.dsi.fastutil.objects.Object2LongMap<String>> underReplicatedPerTier, SegmentReplicantLookup segmentReplicantLookup, DruidCluster cluster, DataSegment segment)
RuleRule.canLoadSegments() must override this method.
Note that is a map of tier -> { dataSource -> underReplicationCount }updateUnderReplicatedWithClusterView in interface Ruleprotected static void validateTieredReplicants(Map<String,Integer> tieredReplicants)
public abstract int getNumReplicants(String tier)
Copyright © 2011–2021 The Apache Software Foundation. All rights reserved.