/** * Validate that same partition is not defined as primary on more that one * datastore */ private void validatePrimaryFixedPartitionAttributes() { List<FixedPartitionAttributesImpl> remotePrimaryFPAs = this.pr.getRegionAdvisor().adviseRemotePrimaryFPAs(); for (FixedPartitionAttributes fpa : this.pr.getFixedPartitionAttributesImpl()) { if (fpa.isPrimary() && remotePrimaryFPAs.contains(fpa)) { Object[] prms = new Object[]{this.pr.getName(), fpa.getPartitionName()}; throw new DuplicatePrimaryPartitionException( LocalizedStrings.PartitionedRegionConfigValidator_FOR_REGION_0_SAME_PARTITION_NAME_1_CANNOT_BE_DEFINED_AS_PRIMARY_ON_MORE_THAN_ONE_NODE .toString(prms)); } } }
/** * Validate that same partition is not defined as primary on more that one * datastore */ private void validatePrimaryFixedPartitionAttributes() { List<FixedPartitionAttributesImpl> remotePrimaryFPAs = this.pr.getRegionAdvisor().adviseRemotePrimaryFPAs(); for (FixedPartitionAttributes fpa : this.pr.getFixedPartitionAttributesImpl()) { if (fpa.isPrimary() && remotePrimaryFPAs.contains(fpa)) { Object[] prms = new Object[]{this.pr.getName(), fpa.getPartitionName()}; throw new DuplicatePrimaryPartitionException( LocalizedStrings.PartitionedRegionConfigValidator_FOR_REGION_0_SAME_PARTITION_NAME_1_CANNOT_BE_DEFINED_AS_PRIMARY_ON_MORE_THAN_ONE_NODE .toString(prms)); } } }
public static void createPrimaryBucketsBelongingToOtherPartition( String regionName, Boolean destroyExistingRemote, Boolean destroyExistingLocal) { region_FPR = (PartitionedRegion)cache.getRegion(regionName); assertNotNull(region_FPR); int bucketId = 13; List<FixedPartitionAttributesImpl> fpas = region_FPR.getRegionAdvisor() .adviseRemotePrimaryFPAs(); for (FixedPartitionAttributesImpl fpa : fpas) { if (fpa.isPrimary()) { bucketId = fpa.getStartingBucketID(); } } try { PartitionManager.createPrimaryBucket(region_FPR, bucketId, destroyExistingRemote, destroyExistingLocal); fail("PartitionManager created primary bucket not belonging to the node."); } catch (Exception expected) { if (!((expected instanceof IllegalArgumentException) && (expected .getMessage() .contains( "not part of any primary partition on this node for the FixedPartitionRegion")))) { fail("Expected IllegalArgumentException ", expected); } } }