You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bb...@apache.org on 2021/06/29 21:58:49 UTC

[geode-native] branch develop updated: GEODE-9406: Report DSCode (type) for PDX values in gnmsg (#827)

This is an automated email from the ASF dual-hosted git repository.

bbender pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new f261b10  GEODE-9406: Report DSCode (type) for PDX values in gnmsg (#827)
f261b10 is described below

commit f261b10877bcd4f09f1af373d005d400fd4e2c4b
Author: Blake Bender <bb...@pivotal.io>
AuthorDate: Tue Jun 29 14:58:41 2021 -0700

    GEODE-9406: Report DSCode (type) for PDX values in gnmsg (#827)
---
 tools/gnmsg/client_messages.py | 15 ++++++++++++++-
 tools/gnmsg/modified_utf8.py   |  1 +
 tools/gnmsg/read_values.py     |  4 ++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/tools/gnmsg/client_messages.py b/tools/gnmsg/client_messages.py
index 0463046..19980d1 100644
--- a/tools/gnmsg/client_messages.py
+++ b/tools/gnmsg/client_messages.py
@@ -239,7 +239,20 @@ def read_put_message(properties, message_bytes, offset):
 
     (properties["Value"], offset) = parse_key_or_value(message_bytes, offset)
 
-    (properties["EventId"], offset) = parse_event_id_part(message_bytes, offset)
+    # This is a little weird, so here's the explanation: the geode-native logger has a buffer size limit of 8KB, so we
+    # can't fully parse any message that's longer than that.  At the same time, we would really like to extract as much
+    # information as we can from such a message.  Since the first 5 parts of the PUT message are trivial in size, the
+    # actual value being PUT is the thing that we can't decode.  Even then, we would like to know as much about the
+    # "Value" part of the message as we can, so we will attempt to parse the value, and catch any exceptions above this
+    # level.  In the case of large values that we don't attempt to parse, such as PDX, we will still inform that the
+    # value is of size (n), is or is not an object, and the type is (PDX or whatever).  Great so far, but what about the
+    # EventId part, that sits at the very end of the PUT message?  Well, we shouldn't bother with it if the length of
+    # the message is > the logger size limit, because we're guaranteed it's not in the log.  So that's what we do here,
+    # just skip the EventId.
+    if properties["Length"] < 8192:
+        (properties["EventId"], offset) = parse_event_id_part(message_bytes, offset)
+    else:
+        properties["EventId"] = {"Data": "Unavailable - message is too long"}
 
 
 def read_request_message(properties, message_bytes, offset):
diff --git a/tools/gnmsg/modified_utf8.py b/tools/gnmsg/modified_utf8.py
index 6fe922a..a895966 100644
--- a/tools/gnmsg/modified_utf8.py
+++ b/tools/gnmsg/modified_utf8.py
@@ -16,6 +16,7 @@
 # translated from: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/94cc251d0c45/src/share/npt/utf.c
 # Source:  https://gist.github.com/BarelyAliveMau5/000e7e453b6d4ebd0cb06f39bc2e7aec
 
+
 def utf8s_to_utf8m(string):
     """
     :param string: utf8 encoded string
diff --git a/tools/gnmsg/read_values.py b/tools/gnmsg/read_values.py
index 08962b0..2f18ab5 100644
--- a/tools/gnmsg/read_values.py
+++ b/tools/gnmsg/read_values.py
@@ -116,6 +116,10 @@ def read_cacheable(message_bytes, offset):
         # and if you read 1 byte of payload like it says to you'll blow the
         # message parse.
         value["Value"] = "<<null>>"
+    elif value["DSCode"] == "PDX":
+        value["Value"] = "<<Unreadable - no type info available in gnmsg>>"
+        # This is here for completion, but not actually necessary.
+        offset = len(message_bytes)
     else:
         raise Exception("Unknown DSCode")