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

Andy Tolbert commented on CASSANDRA-15349:
------------------------------------------

I think a new event for {{REGISTER}} seems adequate if the only information we 
are communicating is that the node is going away.  It seems to fit in that it's 
the only current type that causes messages that aren't bound to a request.  One 
benefit of this is that sending this as an event shouldn't break any existing 
clients that don't support it since they would have to know to {{REGISTER}} for 
it.

Some thoughts about how I think it should work on the server side when it sends 
{{GOING_AWAY}}:
  * The node stops accepting new connections immediately.
  * The node still accepts requests for some time, like 2 seconds.  This gives 
client time to react to the message.  Another alternative is to make this a 
quiet period, similar to Netty's 
[shutdownGracefully|https://netty.io/4.0/api/io/netty/util/concurrent/GlobalEventExecutor.html#shutdownGracefully-long-long-java.util.concurrent.TimeUnit-]
 where it will continue accepting requests until some quiet period or timeout 
has elapsed.
  * After that time, it sends some kind of error, something like 
{{Overloaded}}), which would cause most clients to retry on next host
  * Then after some other configurable period of time (10 seconds?), it closes 
the connections.

On driver side, some ideas, but depends on driver's implementation:

1. If we go register route, each connection would need to register on this when 
its initialized.  This is probably easier to implement than doing it for one 
connection per node I think.
2. When receiving {{GOING_AWAY}}, stop sending new requests to that node, but 
don't consider it DOWN to allow pending requests to complete.  Most drivers 
will mark the host DOWN once all connections to it are closed, and will try 
reconnecting per usual.
3. Don't close connections explicitly, let the server do it for you.

> Add “Going away” message to the client protocol
> -----------------------------------------------
>
>                 Key: CASSANDRA-15349
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15349
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Messaging/Client
>            Reporter: Alex Petrov
>            Priority: Normal
>              Labels: client-impacting
>
> Add “Going away” message that allows node to announce its shutdown and let 
> clients gracefully shutdown and not attempt further requests.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to