Github user aweisberg commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/184#discussion_r163086238
  
    --- Diff: src/java/org/apache/cassandra/net/MessageIn.java ---
    @@ -89,37 +88,39 @@ private MessageIn(InetAddress from,
     
         public static <T2> MessageIn<T2> read(DataInputPlus in, int version, 
int id, long constructionTime) throws IOException
         {
    -        InetAddress from = 
CompactEndpointSerializationHelper.deserialize(in);
    +        InetAddressAndPort from = 
CompactEndpointSerializationHelper.instance.deserialize(in, version);
     
             MessagingService.Verb verb = 
MessagingService.Verb.fromId(in.readInt());
    -        Map<String, byte[]> parameters = readParameters(in);
    +        Map<ParameterType, Object> parameters = readParameters(in, 
version);
             int payloadSize = in.readInt();
             return read(in, version, id, constructionTime, from, payloadSize, 
verb, parameters);
         }
     
    -    public static Map<String, byte[]> readParameters(DataInputPlus in) 
throws IOException
    +    public static Map<ParameterType, Object> readParameters(DataInputPlus 
in, int version) throws IOException
         {
             int parameterCount = in.readInt();
    +        Map<ParameterType, Object> parameters;
             if (parameterCount == 0)
             {
                 return Collections.emptyMap();
             }
             else
             {
    -            ImmutableMap.Builder<String, byte[]> builder = 
ImmutableMap.builder();
    +            ImmutableMap.Builder<ParameterType, Object> builder = 
ImmutableMap.builder();
                 for (int i = 0; i < parameterCount; i++)
                 {
                     String key = in.readUTF();
    +                ParameterType type = ParameterType.byName.get(key);
    --- End diff --
    
    You are right we should throw or skip it and not try to use null as a key. 
Now silently go ahead and skip? It's a useful behavior for a protocol.
    
    But this illustrates a larger issue. The key used to be a string so we 
could pass around parameters we didn't recognize. Now we can't we can only drop 
them.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to