For this reason:
But since the user has to always add this delimiter to their string keys
perhaps it is better for them to have to explicitly configure what it is.

I would vote for a single configuration.



On Wed, May 31, 2017 at 4:17 PM Darrel Schneider <dschnei...@pivotal.io>
wrote:

> The partition-by-prefix feature can be configured with gfsh, cache.xml, or
> apis.
>
> We did not want it to be configured as a PartitionResolver because that
> ends up with overly verbose configuration.
> You end up with something like: gfsh create region "foo"
> --partition-resolver=org.apache.geode.resolvers.PartitionByPrefix.class
> instead of: gfsh create region "foo" --partition-by-prefix=true
>
> The reason for two configuration attributes (a boolean to enable the
> feature, and a string to customize the default delimiter) was for clarity.
> We thought that most use cases would just use the boolean and set it to
> true because they could use the default delimiter.
> The configuration of the delimiter is only needed when your existing prefix
> string contains the default delimiter.
> If we have just one configuration attribute (the delimiter) then it needs
> to default to the empty string which means the feature is disabled.
> I originally was pushing for the single configuration attribute but was
> convinced by others that the two config attribute was better. I like the
> idea of geode having a predefined delimiter like ":" instead of it always
> needed to be configured if you are going to use it. But since the customer
> has to always add this delimiter to their string keys perhaps it is better
> for them to have to explicitly configure what it is.
>
> I do not like the idea of returning the entire key if no delimiter is
> found. This seems error prone. If a developer forgets to put the correct
> delimiter in a key I think it is better for it to fail fast then to just
> instead use the default hash of the entire key.
> In the example of a Customer and Customer.Orders region you would just use
> the normal "partition-by-key" policy on the Customer region and then
> configure "partition-by-prefix" on the Customer.Orders region. You have no
> need for both regions to be configured with "partition-by-prefix".
>
> If someone does want to have a mix of keys, some with prefixes and some
> without, on the same region then they could just implement their own
> PartitionResolver and have it support this mix. I don't see that
> "partition-by-prefix" needs to support this use case unless it is very
> common.
>
> On Wed, May 31, 2017 at 10:15 AM, Michael Stolz <mst...@pivotal.io> wrote:
>
> > I don't really see a need for new Region api for this except to be able
> to
> > specify the delimeter.
> >
> > A developer can just specify the provided PartionByPrefix class for his
> > PartitionResolver during region creation?
> >
> > Providing a String key with no delimiter should just return the entire
> key,
> > NOT throw an error. That way the same PartitionResolver can be used for
> > both the Customer region and the Customer.Orders region and it just
> works.
> >
> > One more thing, we need to be able to specify a partition resolver via
> > gfsh.
> >
> > --
> > Mike Stolz
> > Principal Engineer - Gemfire Product Manager
> > Mobile: 631-835-4771 <(631)%20835-4771> <(631)%20835-4771>
> >
> > On May 30, 2017 3:26 PM, "Fred Krone (JIRA)" <j...@apache.org> wrote:
> >
> > >
> > >      [ https://issues.apache.org/jira/browse/GEODE-3005?page=com.at
> > > lassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
> > >
> > > Fred Krone updated GEODE-3005:
> > > ------------------------------
> > >     Description:
> > > A user should be able to set partition by prefix programmatically when
> > > creating a partitioned region.
> > >
> > > This can only be done when creating a Region type PARTITION
> > >
> > > Acceptance:
> > > Partitioned region can be created using new 'partition by prefix'
> > > attributes (on/off, delimiter)
> > > Only String keys work -- all other keys throw an error
> > > Providing a key with the correct delimiter routes the entry to the
> > correct
> > > node
> > > Providing a key with no delimiter throws an error
> > >
> > >
> > >   was:
> > > A user should be able to set partition by prefix programmatically when
> > > creating a partitioned region.
> > >
> > > This can only be done when creating a Region type PARTITION
> > >
> > >
> > > > A developer can create a Region with Partition Resolution using Java
> > API
> > > > ------------------------------------------------------------
> > ------------
> > > >
> > > >                 Key: GEODE-3005
> > > >                 URL:
> https://issues.apache.org/jira/browse/GEODE-3005
> > > >             Project: Geode
> > > >          Issue Type: Wish
> > > >          Components: regions
> > > >            Reporter: Fred Krone
> > > >            Assignee: Fred Krone
> > > >
> > > > A user should be able to set partition by prefix programmatically
> when
> > > creating a partitioned region.
> > > > This can only be done when creating a Region type PARTITION
> > > > Acceptance:
> > > > Partitioned region can be created using new 'partition by prefix'
> > > attributes (on/off, delimiter)
> > > > Only String keys work -- all other keys throw an error
> > > > Providing a key with the correct delimiter routes the entry to the
> > > correct node
> > > > Providing a key with no delimiter throws an error
> > >
> > >
> > >
> > > --
> > > This message was sent by Atlassian JIRA
> > > (v6.3.15#6346)
> > >
> >
>

Reply via email to