VMware GemFire

 View Only

 Can we create multiple custom partition in gemfire ?For e.g need to create a partition by day and a particular group.

Vaidhyanathan Pranatharthiharan's profile image
Vaidhyanathan Pranatharthiharan posted Aug 06, 2019 05:30 PM

 

Vaidhyanathan Pranatharthiharan's profile image
Vaidhyanathan Pranatharthiharan

Also, as part of the custom partition resolver , can i partition based on the field that is not a key.

Juan Cassella's profile image
Juan Cassella

Hello Vaidhyanathan,

 

Thanks for contacting the Pivotal Support Community!.

That said, the answer to both questions can be found directly in Standard Custom Partitioning [1]. Long story short, you can have multiple custom partition resolvers but only one per region, and you can only use the key as the Routing Object within your custom partition resolver.

Hope this helps.

Cheers.

 

[1]: https://gemfire.docs.pivotal.io/98/geode/developing/partitioned_regions/standard_custom_partitioning.html

Vaidhyanathan Pranatharthiharan's profile image
Vaidhyanathan Pranatharthiharan

Thank you .i have abother question.I created custom partition resolver on the gemfire server (spring boot app) , im trying to insert a record to cache via the client app , its giving an error stating ​custom partition resolver class not found, Should i always include the custom partition resolver class both at client and server side ,or is there a better approach that csn be done at the client side so that i dont have to include the custom partirion resolver class

Juan Cassella's profile image
Juan Cassella

Hello Vaidhyanathan,

 

If you use the first approach from the shared document (implement the org.apache.geode.cache.PartitionResolver using a custom class), the resolver itself should only exist on the server's classpath. Are you using that approach?, if you are, does the problem go away when adding the resolver to the client's classpath?.

Best regards.

Vaidhyanathan Pranatharthiharan's profile image
Vaidhyanathan Pranatharthiharan

Yes it goes away if i add to the clients class path, i wanted to know id theres a better approach so that i dont add the resolver to the client class path,For e.g using functions​

Juan Cassella's profile image
Juan Cassella

Hello Vaidhyanathan,

 

Which approach are you using to implement your custom PartitionResolver?, if you're using the key class or the callback approach then the resolver should be part of the client classpath by design.

Using functions is certainly doable, but it seems a bit overkilling if you just want to avoid changing the client's classpath.

Best regards.

Vaidhyanathan Pranatharthiharan's profile image
Vaidhyanathan Pranatharthiharan

Not sure of the approach name, Im implementing partition resolver class and have overrided getRoutingObject and getName methods in my approach.

Juan Cassella's profile image
Juan Cassella

Hello Vaidhyanathan,

 

From Standard Custom Partitioning [1]:

Implement the org.apache.geode.cache.PartitionResolver interface in one of the following ways, listed here in the search order used by GemFire:

  • Using a custom class. Implement the PartitionResolver within your class, and then specify your class as the partition resolver during region creation.
  • Using the key’s class. Have the entry key’s class implement the PartitionResolverinterface.
  • Using the callback argument’s class. Have the class that implements your callback argument implement the PartitionResolver interface. When using this implementation, any and all Region operations must be those that specify the callback argument.

 

You basically need to implement the PartitionResolver in every approach no matter what, my question was basically the following: which class are you actually using as the implementation of PartitionResolver?, a class specifically designed and implemented to act as the Partition Resolver?, the class used as the key for your region?, or the class used as the callback argument?.

Best regards.

 

[1]: https://gemfire.docs.pivotal.io/98/geode/developing/partitioned_regions/standard_custom_partitioning.html