[ 
https://issues.apache.org/jira/browse/GEODE-8700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17230976#comment-17230976
 ] 

ASF GitHub Bot commented on GEODE-8700:
---------------------------------------

gaussianrecurrence commented on pull request #691:
URL: https://github.com/apache/geode-native/pull/691#issuecomment-726352879


   > @gaussianrecurrence on further inspection I have concerns about the 
methods being added to to the internal region since they only apply to 
partitioned regions. I am also concerned about the thread safety of changing 
the resolver after the region is initialized. I have added @pdxcodemonkey as a 
reviewer because I don't have the bandwidth right now to investigate this. I 
would also suggest you look at the Java implementation for inspiration. Can the 
Java version mutate the partition resolver?
   
   Regarding your concern about adding this to RegionInternal, thing is as I've 
seen there is no distinction in NC between partitioned regions and 
no-partitioned regions in terms of modularization, please correct me if I am 
wrong.
   
   ---
   
   Regarding thread safety, it turns out you are right, I originally thought 
that calling reset/operator= on a shared_ptr was thread-safe, but this is not 
the case, as I've read. So that shared_ptr will need to be protected by a RW 
lock. Other than that, is thread safe and let me explain. If **thread A** takes 
a copy of PR1 and **thread B**, replaces the PR by PR2, any thread requesting 
the PR will get PR2 after that, so it would happen that one requests are using 
one PR and others the new one, but that's what's expected.
   
   ---
   
   And as for the Java API, I don't think I've seen any implementation allowing 
to change PR on the fly. Still, I would like to point out that Java has 
reflection, which currently C++ lacks of. The reason why I bring reflection up 
is because, the only way right now to specify a PR while declaratively defining 
a cache is by creating a separate shared library which is not quite much 
elegant.
   
   My first idea for implementing this was to introduce something like a 
generic "ExtensionRegistry" in which you could register "Extensions" uniquely 
identified by a name. But the problem with that approach was that the change 
was too big and implied several additions to the API, which as of we are all 
aware, is not a good thing.
   
   So that's why I went for the attributes mutator approach.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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


> Add the ability to change the partition resolver
> ------------------------------------------------
>
>                 Key: GEODE-8700
>                 URL: https://issues.apache.org/jira/browse/GEODE-8700
>             Project: Geode
>          Issue Type: New Feature
>          Components: native client
>    Affects Versions: 1.13.0
>            Reporter: Mario Salazar de Torres
>            Assignee: Mario Salazar de Torres
>            Priority: Major
>              Labels: pull-request-available
>
> *AS A* native client contributor
> *I WANT* to be able to mutate partition resolver
> *SO THAT* I don't need to create a shared library to specify one.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to