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

Jason Brown commented on CASSANDRA-14335:
-----------------------------------------

We already store the {{ProtocolVersion}} along with the channel in 
{{Connection}}. We also store a reference to the {{Connection}} in the 
{{Channel}}, as a channel attribute. Thus, it seems to me you could just add a 
method like this to {{Server.ConnectionTracker}} (I changed the return type to 
make the example simpler):

{code:java}
        public Map<ProtocolVersion, Set<SocketAddress>> 
getClientsByProtocolVersion()
        {
            Map<ProtocolVersion, Set<SocketAddress>> result = new 
EnumMap<>(ProtocolVersion.class);
            for (Channel c : allChannels)
            {
                Attribute<Connection> attrConn = 
c.attr(Connection.attributeKey);
                Connection connection = attrConn.get();
                if (connection != null)
                {
                    ProtocolVersion version = connection.getVersion();
                    SocketAddress addr = c.remoteAddress();
                    result.computeIfAbsent(version, protocolVersion -> new 
HashSet<>());
                    result.get(version).add(addr);
                }
            }
            return result;
        }
{code}

(Note: {{ConnectionTracker#allChannels}} is a {{DefaultChannelGroup}}, whose 
{{Iterator()}} method wraps two {{ConcurrentHashMap}} s, so I think you are 
safe concurrency-wise.) This gives you a snapshot of everything that is 
currently connected. Is this sufficient, [~djoshi3]?

> C* nodetool should report the lowest of the highest CQL protocol version 
> supported by all clients connecting to it
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-14335
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14335
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Dinesh Joshi
>            Assignee: Dinesh Joshi
>            Priority: Major
>
> While upgrading C*, it makes it hard to tell whether any client will be 
> affected if C* is upgraded. C* should internally store the highest protocol 
> version of all clients connecting to it. The lowest supported version will 
> help determining if any client will be adversely affected by the upgrade.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to