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

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

pivotal-jbarrett commented on pull request #800:
URL: https://github.com/apache/geode-native/pull/800#issuecomment-832003876


   I don’t think there is any way for the region type to change on the server 
without the region being torn down and recreated.
   
   In the ClientMetadataService::enqueueForMetadataRefresh method it looks up 
the Region already. It doesn’t keep a reference to it. If ThinClientRegion has 
type enumeration or bucket count we can do the check there and ignore the 
enqueue the name. No need to enqueue the reference.
   
   For extra credit there are some ugly bugs in this code.
   
   
   On May 4, 2021, at 7:24 AM, Blake Bender ***@***.******@***.***>> wrote:
   
   
   
   Sending GET_CLIENT_PR_METADATA to a server for a replicated region generated 
an EXCEPTION response message, which the native client would then ignore. 
Convention in the Java client is to check for a bucket count of -1, indicating 
replicated region, and skip the metadata request in that case.
   
   
@gaussianrecurrence<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgaussianrecurrence&data=04%7C01%7Cjabarrett%40vmware.com%7Cc0f1071a318e44dd4fe308d90f085a92%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637557350831814485%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=OFHeGCttJY1H%2FzDS%2FIWi8VOdQjNzmx38bjKRxo%2FxMMY%3D&reserved=0>
   
   I wonder if it's best to add this behaviour to enqueueForMetadataRefresh 
instead. Maybe that function could be refactored, so instead of accepting the 
full path, it accepts the region object. This way it can be check if the region 
is partitioned or replicated. And if replicated, then don't add the request to 
the queue.
   
   Given the complexity of our dependency graph, I'm reluctant to pass around 
yet another reference to a region object that must be accounted for at 
shutdown, esp to a thread with dubious timing like the metadata service. We 
could, however, potentially save some network traffic by storing a map of 
region name to server region type in ClientMetadataService if we knew it was 
not possible for server region type to change "on the fly". 
@pivotal-jbarrett<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpivotal-jbarrett&data=04%7C01%7Cjabarrett%40vmware.com%7Cc0f1071a318e44dd4fe308d90f085a92%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637557350831824478%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=84l7Qqp200eDrs2R%2FInN16L5YAz2F0Tdd%2FNlFCPR6k4%3D&reserved=0>
 do you know if this is the case? If so, we could save the server region type 
and never send GET_CLIENT_PARTITION_ATTRIBUTES for a known region with 
replicated type. I also wonder if the optimization is worth the effort, though, 
since metadata refresh isn't intended to be a high-frequency event.
   
   —
   You are receiving this because you were mentioned.
   Reply to this email directly, view it on 
GitHub<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fgeode-native%2Fpull%2F800%23issuecomment-831982865&data=04%7C01%7Cjabarrett%40vmware.com%7Cc0f1071a318e44dd4fe308d90f085a92%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637557350831834473%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=hQbH4tX7ix7V00VnEc1Q9Leejr5UikPabM44J0ZP2pA%3D&reserved=0>,
 or 
unsubscribe<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABT4LF725BDPCF4WS2UPQNTTL77SRANCNFSM435O3ZJQ&data=04%7C01%7Cjabarrett%40vmware.com%7Cc0f1071a318e44dd4fe308d90f085a92%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637557350831834473%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ru2LPIR9XorxW0JwCDxbhQbg85JsQTTJyzSbL6LRW9Q%3D&reserved=0>.
   
   


-- 
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


> Native Client asks for metadata for replicated region, causes server exception
> ------------------------------------------------------------------------------
>
>                 Key: GEODE-8405
>                 URL: https://issues.apache.org/jira/browse/GEODE-8405
>             Project: Geode
>          Issue Type: Bug
>          Components: native client
>            Reporter: Blake Bender
>            Priority: Major
>              Labels: pull-request-available
>
> For some reason, Geode Native is not checking region attributes on the server 
> prior to issuing a GET_CLIENT_PR_METADATA message.  It does, in fact, get the 
> region attributes from the server, as you can see from this message dump:
> {code:java}
> {
>   "Timestamp": "2020-08-05 15:37:42.595294",
>   "Connection": "0x7fb1f89042d0",
>   "Direction": "--->",
>   "Type": "GET_CLIENT_PARTITION_ATTRIBUTES",
>   "Length": 22,
>   "Parts": 1,
>   "TransactionId": -1,
>   "SecurityFlag": 0,
>   "RegionPart": {    
>     "Size": 17,     
>     "IsObject": 0,     
>     "Name": "/example_userinfo"   
>   }
> }
> ,{
>   "Timestamp": "15:37:42.595590",
>   "Connection": "0",
>   "Direction": "<---",
>   "Type": "RESPONSE_CLIENT_PARTITION_ATTRIBUTES",
>   "Length": 35,
>   "Parts": 2,
>   "TransactionId": -1,
>   "SecurityFlag": 0,
>   "BucketCount": {
>     "Size": 5,
>     "IsObject": 1,
>     "Data":{       
>       "DSCode": "CacheableInt32",
>       "Value": -1    
>     } 
>   },
>   "ColocatedWith": {
>     "Size": 20,
>     "IsObject": 1,
>     "Data":{
>        "DSCode": "CacheableASCIIString",
>        "StringLength": 17,
>        "Value": "/example_userinfo"
>     }
>   }
> }
>   {code}
>  
> The critical value here is `BucketCount` in the 
> `RESPONSE_CLIENT_PARTITION_ATTRIBUTES` message.  If this value is -1, the 
> region is replicated rather than partitioned, and we should not be querying 
> for PR metadata.
>  



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

Reply via email to