When configuring fixed partition with colocated-with
it executes the below validation, which causes the process to fail to start server if "fixed-partition-attributes" and "colocated-with" are set on the same region:
public void validateWhenAllAttributesAreSet(boolean isDeclarative) { if (this.colocatedRegionName != null) { if (this.fixedPAttrs != null) { throw new IllegalStateException( LocalizedStrings.PartitionAttributesImpl_IF_COLOCATED_WITH_IS_SPECFIED_THEN_FIXED_PARTITION_ATTRIBUTES_CAN_NOT_BE_SPECIFIED .toLocalizedString(this.fixedPAttrs)); } }
To enable "fixed-partition" with a collocated region:
The "fixed-partition-attributes" attribute need to be specified only on a parent region --- child regions will inherit the property.
You need to implement same partition-resolver on all co-located region
<cache> <region name="exampleRegion"> <region-attributes refid="PARTITION" async-event-queue-ids="sampleQueue"> <partition-attributes local-max-memory="50" redundant-copies="1" > <partition-resolver name="QuarterPartitionResolver"> <class-name>test.QuarterPartitionResolver</class-name> </partition-resolver> <fixed-partition-attributes partition-name="Q1" is-primary="true" num-buckets="6"/> <fixed-partition-attributes partition-name="Q2" is-primary="false" num-buckets="6"/> </partition-attributes> </region-attributes> </region> <region name="exampleRegion1"> <region-attributes refid="PARTITION" > <partition-attributes local-max-memory="50" redundant-copies="1" colocated-with="exampleRegion"> <partition-resolver name="QuarterPartitionResolver"> <class-name>test.QuarterPartitionResolver</class-name> </partition-resolver> </partition-attributes> </region-attributes> </region> <region name="exampleRegion2"> <region-attributes refid="PARTITION" > <partition-attributes local-max-memory="50" redundant-copies="1" colocated-with="exampleRegion"> <partition-resolver name="QuarterPartitionResolver"> <class-name>test.QuarterPartitionResolver</class-name> </partition-resolver> </partition-attributes> </region-attributes> </region> </cache>