@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(TableDescriptor tableDescriptor,
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) |
static boolean |
isDefaultReplica(RegionInfo hri) |
static boolean |
isReplicasForSameRegion(RegionInfo regionInfoA,
RegionInfo regionInfoB) |
static void |
removeNonDefaultRegions(Collection<RegionInfo> regions)
Removes the non-default replicas from the passed regions collection
|
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)
regionInfo
- replicaId
- the replicaId to usepublic static RegionInfo getRegionInfoForDefaultReplica(RegionInfo regionInfo)
public static boolean isDefaultReplica(int replicaId)
public static boolean isDefaultReplica(RegionInfo hri)
public static void removeNonDefaultRegions(Collection<RegionInfo> regions)
regions
- public static boolean isReplicasForSameRegion(RegionInfo regionInfoA, RegionInfo regionInfoB)
private static int compareRegionInfosWithoutReplicaId(RegionInfo regionInfoA, RegionInfo regionInfoB)
public static List<RegionInfo> addReplicas(TableDescriptor tableDescriptor, List<RegionInfo> regions, int oldReplicaCount, int newReplicaCount)
tableDescriptor
- descriptor to useregions
- existing regionsoldReplicaCount
- existing replica countnewReplicaCount
- updated replica count due to modify tableCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.