@InterfaceAudience.Private public class RegionReplicaUtil extends Object
Modifier and Type | Field and Description |
---|---|
protected static boolean |
DEFAULT_REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH |
(package private) static int |
DEFAULT_REPLICA_ID
The default replicaId for the region
|
static String |
REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH_CONF_KEY
Whether or not the secondary region will wait for observing a flush / region open event from
the primary region via async wal replication before enabling read requests.
|
Constructor and Description |
---|
RegionReplicaUtil() |
Modifier and Type | Method and Description |
---|---|
static List<RegionInfo> |
addReplicas(List<RegionInfo> regions,
int oldReplicaCount,
int newReplicaCount)
Create any replicas for the regions (the default replicas that was already created is passed to
the method)
|
private static int |
compareRegionInfosWithoutReplicaId(RegionInfo regionInfoA,
RegionInfo regionInfoB) |
static RegionInfo |
getRegionInfoForDefaultReplica(RegionInfo regionInfo)
Returns the RegionInfo for the default replicaId (0).
|
static RegionInfo |
getRegionInfoForReplica(RegionInfo regionInfo,
int replicaId)
Returns the RegionInfo for the given replicaId.
|
static boolean |
isDefaultReplica(int replicaId)
Returns true if this replicaId corresponds to default replica for the region
|
static boolean |
isDefaultReplica(RegionInfo hri)
Returns true if this region is a default replica for the region
|
static boolean |
isReplicasForSameRegion(RegionInfo regionInfoA,
RegionInfo regionInfoB) |
static void |
removeNonDefaultRegions(Collection<RegionInfo> regions)
Removes the non-default replicas from the passed regions collection n
|
public static final String REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH_CONF_KEY
protected static final boolean DEFAULT_REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH
static final int DEFAULT_REPLICA_ID
public RegionReplicaUtil()
public static RegionInfo getRegionInfoForReplica(RegionInfo regionInfo, int replicaId)
public static RegionInfo getRegionInfoForDefaultReplica(RegionInfo regionInfo)
public static boolean isDefaultReplica(int replicaId)
public static boolean isDefaultReplica(RegionInfo hri)
public static void removeNonDefaultRegions(Collection<RegionInfo> regions)
public static boolean isReplicasForSameRegion(RegionInfo regionInfoA, RegionInfo regionInfoB)
private static int compareRegionInfosWithoutReplicaId(RegionInfo regionInfoA, RegionInfo regionInfoB)
public static List<RegionInfo> addReplicas(List<RegionInfo> regions, int oldReplicaCount, int newReplicaCount)
regions
- existing regionsoldReplicaCount
- existing replica countnewReplicaCount
- updated replica count due to modify tableCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.