You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/10/06 21:29:40 UTC

[GitHub] [geode-native] alb3rtobr commented on a change in pull request #669: GEODE-8578: Parse partition resolver in RESPONSE_CLIENT_PARTITION_ATTRIBUTES message

alb3rtobr commented on a change in pull request #669:
URL: https://github.com/apache/geode-native/pull/669#discussion_r500607157



##########
File path: tools/gnmsg/server_messages.py
##########
@@ -36,16 +36,20 @@ def read_bucket_count(message_bytes, offset):
 
 
 def read_partition_attributes(properties, message_bytes, offset):
-    if properties["Parts"] != 2 and properties["Parts"] != 4:
-        raise Exception(
-            "Don't know how to parse a RESPONSE_CLIENT_PARTITION_ATTRIBUTES message with "
-            + properties["Parts"]
-            + " parts (should have 2 or 4 only)."
-        )
-
     (properties["BucketCount"], offset) = read_bucket_count(message_bytes, offset)
     (properties["ColocatedWith"], offset) = parse_key_or_value(message_bytes, offset)
-    # TODO: parse parts 3 and 4 (partition resolver and list of partition attributes), if they exist
+    if properties["Parts"] == 4:
+        (properties["PartitionResolverName"], offset) = parse_key_or_value(message_bytes, offset)
+        # TODO: parse part 4 (list of partition attributes)
+    elif properties["Parts"] == 3:
+        try:
+            (properties["PartitionResolverName"], offset) = parse_key_or_value(message_bytes, offset)
+        except:
+            raise Exception(
+                "Don't know how to parse a RESPONSE_CLIENT_PARTITION_ATTRIBUTES message with "
+                + "3 parts and fpa attribute."
+            )
+        # TODO: parse part 3 if it is not partition resolver but list of partition attributes

Review comment:
       I used this code of `GetClientPartitionAttributesOp` Java class as reference:
   
   ```
   ...
   int bucketCount;
   String colocatedWith;
   String partitionResolverName = null;
   Set<FixedPartitionAttributes> fpaSet = null;
   bucketCount = (Integer) msg.getPart(0).getObject();
   colocatedWith = (String) msg.getPart(1).getObject();
   if (msg.getNumberOfParts() == 4) {
     partitionResolverName = (String) msg.getPart(2).getObject();
     fpaSet = (Set<FixedPartitionAttributes>) msg.getPart(3).getObject();
   } else if (msg.getNumberOfParts() == 3) {
     Object obj = msg.getPart(2).getObject();
     if (obj instanceof String) {
       partitionResolverName = (String) obj;
     } else {
       fpaSet = (Set<FixedPartitionAttributes>) obj;
     }
   ...
   ```
   




----------------------------------------------------------------
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:
users@infra.apache.org