Pivotal Knowledge Base

Follow

Working with Fixed Partition and colocated-with

Applies to

GemFire

Purpose

The purpose of this article is to explain how to configure Fixed Partition with "colocated-with" region

Description

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)); 
} 
}

Solution

To enable "fixed-partition" with a collocated region:

  1. The "fixed-partition-attributes" attribute need to be specified only on a parent region --- child regions will inherit the property.

  2. 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>

Comments

Powered by Zendesk