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

Darrel Schneider edited comment on GEODE-1887 at 5/5/17 6:52 PM:
-----------------------------------------------------------------

The problem with changing the existing behavior of PROXY on a client is that it 
could break existing applications.
When Region methods are done on a client region then it must always decide what 
it will do with two possible spaces:
  1. the region state in the client space
  2. the region state in the server space
The following region methods limit themselves to the client space:
*  public RegionAttributes<K, V> getAttributes();
*  public AttributesMutator<K, V> getAttributesMutator();
*  public CacheStatistics getStatistics();
*  public Entry<K, V> getEntry(Object key);
*  public <SK, SV> Region<SK, SV> getSubregion(String path);
*  public Set<Region<?, ?>> subregions(boolean recursive);
*  public Set<K> keySet();
*  public Collection<V> values();
*  public Set<Region.Entry<?, ?>> entrySet(boolean recursive);
*  public Set<Map.Entry<K, V>> entrySet();
*  public Object getUserAttribute();
*  public void setUserAttribute(Object value);
*  public boolean isDestroyed();
*  public boolean containsValueForKey(Object key);
*  public boolean containsKey(Object key);
*  public boolean containsValue(Object value);
*  public boolean isEmpty();
*  public int size();
*  default void forEach(BiConsumer<? super K, ? super V> action)
*  default void replaceAll(BiFunction<? super K, ? super V, ? extends V> 
function)


Some of these (keySet and containsKey) already have corresponding methods that 
perform the same operation in the server space (keySetOnServer and 
containsKeyOnServer).
For at least some of the other client space methods I think we should also add 
"OnServer" methods. For example "sizeOnServer" and "isEmptyOnServer". I think 
it is easier for a develop to discover the "OnServer" method and it also tells 
them that a client has two different ways of answering the size question. These 
"OnServer" methods will fail with an UnsupportedOperationException if called on 
a non-client region. They will also completely ignore any client state. For 
example sizeOnServer will not consider any entries cached in the client but 
will simply report the size from the server's point of view.



was (Author: dschneider):
The problem with changing the existing behavior of PROXY on a client is that it 
could break existing applications.
When Region methods are done on a client region then it must always decide what 
it will do with two possible spaces:
  1. the region state in the client space
  2. the region state in the server space
The following region methods limit themselves to the client space:
  public RegionAttributes<K, V> getAttributes();
  public AttributesMutator<K, V> getAttributesMutator();
  public CacheStatistics getStatistics();
  public Entry<K, V> getEntry(Object key);
  public <SK, SV> Region<SK, SV> getSubregion(String path);
  public Set<Region<?, ?>> subregions(boolean recursive);
  public Set<K> keySet();
  public Collection<V> values();
  public Set<Region.Entry<?, ?>> entrySet(boolean recursive);
  public Set<Map.Entry<K, V>> entrySet();
  public Object getUserAttribute();
  public void setUserAttribute(Object value);
  public boolean isDestroyed();
  public boolean containsValueForKey(Object key);
  public boolean containsKey(Object key);
  public boolean containsValue(Object value);
  public boolean isEmpty();
  public int size();
  default void forEach(BiConsumer<? super K, ? super V> action)
  default void replaceAll(BiFunction<? super K, ? super V, ? extends V> 
function)

Some of these (keySet and containsKey) already have corresponding methods that 
perform the same operation in the server space (keySetOnServer and 
containsKeyOnServer).
For at least some of the other client space methods I think we should also add 
"OnServer" methods. For example "sizeOnServer" and "isEmptyOnServer". I think 
it is easier for a develop to discover the "OnServer" method and it also tells 
them that a client has two different ways of answering the size question. These 
"OnServer" methods will fail with an UnsupportedOperationException if called on 
a non-client region. They will also completely ignore any client state. For 
example sizeOnServer will not consider any entries cached in the client but 
will simply report the size from the server's point of view.


> Client PROXY region should delegate all operations to server
> ------------------------------------------------------------
>
>                 Key: GEODE-1887
>                 URL: https://issues.apache.org/jira/browse/GEODE-1887
>             Project: Geode
>          Issue Type: Bug
>          Components: regions
>            Reporter: Swapnil Bawaskar
>            Assignee: Avinash Dongre
>
> Currently a ClientRegionShortcut.PROXY region sends operations like put() and 
> get() over to the server, but for operations like size() and isEmpty() it 
> just consults the local state on the client  and returns 0 and true 
> respectively, even though there may be data in the servers for that region.
> A PROXY region should not attempt to consult its local state for any 
> operation. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to