public class FixedPartitionHelper extends Object
FixedPartitionDescription. Methods are
thread-safe.| Constructor and Description |
|---|
FixedPartitionHelper() |
| Modifier and Type | Method and Description |
|---|---|
static List<com.gemstone.gemfire.cache.FixedPartitionAttributes> |
assignRoundRobin(String regionName,
FixedPartitionDescription fpd,
int redundantCopies)
Returns a list of fixed partition attributes for this JVM for the region
with the specified name, or, if that is null, for the region configured
in the given region description, or, if that is null, for the default
region,
RegionPrms.DEFAULT_REGION_NAME. |
public static List<com.gemstone.gemfire.cache.FixedPartitionAttributes> assignRoundRobin(String regionName, FixedPartitionDescription fpd, int redundantCopies)
RegionPrms.DEFAULT_REGION_NAME.
Primary and secondary partitions are assigned round robin, but in a way that prevents the same partition from being mapped to the same node twice. It constructs a list of FixedPartitionAttributes that includes the primaries and N copies of the secondaries, where N is the number of redundant copies. It then deals them out to datastores like cards. If a datastore has already been assigned a partition of the same name as the current "card", that card is skipped until an appropriate card is found. The next datastore then starts with the skipped card. An exception is thrown if it is impossible to legally deal all cards.
For example, if there are 3 datastores and 4 fixed partitions with redundancy 1, the set of assignments would look like this (bucket counts are omitted here for brevity): datastore 1: P1 primary P4 primary P3 secondary datastore 2: P2 primary P1 secondary P4 secondary datastore 3: P3 primary P2 secondary
Or, for 2 datastores and 4 fixed partitions with redundancy 1, the set of assignments would look like this: datastore 1: P1 primary P3 primary P2 secondary P4 secondary datastore 2: P2 primary P4 primary P1 secondary P3 secondary
Or, for 2 datastores and 2 fixed partitions with redundancy 2, an exception would be thrown since it is impossible to map all redundant copies to nodes that do not already contain either a primary or secondary for the same partition.
This is a suitable FixedPartitionPrms.mappingAlgorithm for most
tests, tests that create the same region in multiple WAN sites. However,
if the test creates multiple regions using the same logical region
configuration, then it must make sure that the actual region names are
passed in by invoking appropriate methods in RegionHelper.
HydraRuntimeException - if it is impossible to map the partitions
without mapping the same partition to the same datastore.Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.