[ https://issues.apache.org/jira/browse/GEODE-3063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16259842#comment-16259842 ]
ASF GitHub Bot commented on GEODE-3063: --------------------------------------- joeymcallister commented on a change in pull request #1077: GEODE-3063 partition resolver doc revisions URL: https://github.com/apache/geode/pull/1077#discussion_r152110009 ########## File path: geode-docs/developing/partitioned_regions/using_custom_partition_resolvers.html.md.erb ########## @@ -243,21 +273,85 @@ program the resolver's `getRoutingObject` method to return the routing object fo </region> ``` **Java API:** - + ``` pre PartitionAttributes attrs = new PartitionAttributesFactory() .setPartitionResolver("StringPrefixPartitionResolver").create(); - + Cache c = new CacheFactory().create(); - + Region r = c.createRegionFactory() .setPartitionAttributes(attrs) .create("customers"); ``` **gfsh:** - + Add the option `--partition-resolver=org.apache.geode.cache.util.StringPrefixPartitionResolver` to the `gfsh create region` command. -6. If your colocated data is in a server system, add the `PartitionResolver` implementation class to the `CLASSPATH` of your Java clients. The resolver is used for single hop access to partitioned region data in the servers. +- For colocated data, add the `StringPrefixPartitionResolver` +implementation class to the `CLASSPATH` of your Java clients. +The resolver will work with Java single hop clients. + +**Configuring Fixed Partitioning** + +- Set the fixed partition attributes for each member. + + These attributes define the data stored for the region by the member and must be different for different members. See `org.apache.geode.cache.FixedPartitionAttributes` for definitions of the attributes. Define each `partition-name` in your data host members for the region. For each partition name, in the member you want to host the primary copy, define it with `is-primary` set to `true`. In every member you want to host the secondary copy, define it with `is-primary` set to `false` (the default). The number of secondaries must match the number of redundant copies you have defined for the region. See [Configure High Availability for a Partitioned Region](configuring_ha_for_pr.html). + + **Note:** + Buckets for a partition are hosted only by the members that have defined the partition name in their `FixedPartitionAttributes`. + + These examples set the partition attributes for a member to be the primary host for the "Q1" partition data and a secondary host for "Q3" partition data. + - XML: + + ``` pre + <cache> + <region name="Trades"> + <region-attributes> + <partition-attributes redundant-copies="1"> + <partition-resolver> + <class-name>myPackage.QuarterFixedPartitionResolver</class-name> + </partition-resolver> + <fixed-partition-attributes partition-name="Q1" is-primary="true"/> + <fixed-partition-attributes partition-name="Q3" is-primary="false" + num-buckets="6"/> + </partition-attributes> + </region-attributes> + </region> + </cache> + ``` + - Java: + + + ``` pre + FixedPartitionAttribute fpa1 = FixedPartitionAttributes + .createFixedPartition("Q1", true); + FixedPartitionAttribute fpa3 = FixedPartitionAttributes + .createFixedPartition("Q3", false, 6); + + PartitionAttributesFactory paf = new PartitionAttributesFactory() + .setPartitionResolver(new QuarterFixedPartitionResolver()) + .setTotalNumBuckets(12) + .setRedundantCopies(2) + .addFixedPartitionAttribute(fpa1) + .addFixedPartitionAttribute(fpa3); + + Cache c = new CacheFactory().create(); + + Region r = c.createRegionFactory() + .setPartitionAttributes(paf.create()) + .create("Trades"); + ``` + - gfsh: + + You cannot specify a fixed partition resolver using gfsh. + +- If your colocated data is in a server system, +add the class that implements the `FixedPartitionResolver` interface +to the `CLASSPATH` of your Java clients. +For Java single hop access to work, Review comment: hyphenate "single-hop access" ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Improve docs on default string-based partition resolver > ------------------------------------------------------- > > Key: GEODE-3063 > URL: https://issues.apache.org/jira/browse/GEODE-3063 > Project: Geode > Issue Type: Bug > Components: docs > Reporter: Karen Smoler Miller > Assignee: Karen Smoler Miller > > The new default partition resolver at > org.apache.geode.cache.util.StringPrefixPartitionResolver > needs more detailed documentation. > - An example of a string specifying a key in a region operation when this > partition resolver is used. > - What happens if the string specifying a key doesn't have a '|' delimiter. > - An example of using this partition resolver to colocate two regions. -- This message was sent by Atlassian JIRA (v6.4.14#64029)