Pivotal Knowledge Base


GemFire Using Default Values, Overriding Custom Named Region Attributes


 Product  Version
 Pivotal GemFire  Any versions


When you configure region attributes in your cache.xml using the Custom Named Region Attributes shortcut, some attributes under the region attributes, such as attributes within the partition attributes, may be overridden unexpectedly by default values. This article provides resolution for this behavior, using the example below to describe the scenario. 


Suppose the following snippet of cache.xml is used to configure some custom named region-attributes, and also a region which uses those region attributes.

<region-attributes id="MY_PARTITIONED_REGION"
<partition-attributes total-num-buckets="631" redundant-copies="1"/>
</region-attributes> <region name="MyPartitionedRegion" refid="MY_PARTITIONED_REGION"> <region-attributes disk-store-name="MyDiskStore"> : <partition-attributes> <partition-listener> <class-name>io.pivotal.akitada.MyPartitionListener</class-name> </partition-listener> </partition-attributes>

As you can see, the MY_PARTITIONED_REGION shortcut includes some partition-attributes, for total-num-buckets, and redundant-copies, respectively. One would think therefore that any region which incorporates the use of this refid="MY_PARTITIONED_REGION" would use 631 buckets and have 1 copy. This is not the case. 


This is due to the fact that the actual region configuration for MyPartitionedRegion also defines its own partition-attributes. So, even though the region uses the custom names region attributes with refid="MY_PARTITIONED_REGION", those partition-attributes are not used for the given region. A completely new set of partition-attributes is established, with all default-values, and one must completely reestablish those attributes where default values are not wanted. In this example, the only attribute defined in the region specific partition-attributes configuration is the partition-listener, so the partition-attributes for total-num-buckets and redundant-copies simply use default values. The default values are 113 buckets and 0 copies.

Currently, this is an expected behavior. When a region defines its own partition-attributes, it will wipe clean partition-attributes defined by a Custom Named Region Attributes shortcut, if any.  


In the above case, your choice is to explicitly specify the total-num-buckets and the redundant-copies attributes within the partition-attributes of the region itself. You could also eliminate the partition-attributes definition within the region itself, thus preserving the set of partition-attributes defined in the custom named region attributes.   

Additional Information

  • Spring Data GemFire - Region Templates: This provides more sophisticated attributes overriding experience and more structured region template feature than Custom Named Region Attributes shortcut. 


Powered by Zendesk