Add support for GRACEFUL_DISCONNECT events#1285
Add support for GRACEFUL_DISCONNECT events#1285omniCoder77 wants to merge 1 commit intoapache:trunkfrom
Conversation
Implement GRACEFUL_DISCONNECT event parsing in protocol.py.
Add connection draining logic to connection.py to prevent new requests while allowing in-flight ones to finish.
Register GRACEFUL_DISCONNECT watchers in ControlConnection.
Update HostConnection and HostConnectionPool to clean up draining connections once empty.
Add a test script to verify advertisement and handling of the new event.
|
@bschoening @absurdfarce requesting your review on this PR. |
|
Thank you for the PR! |
SiyaoIsHiding
left a comment
There was a problem hiding this comment.
Thank you for the PR!
I'm not exactly knowledgeable about the python driver, but I do have some questions in my mind that I left in the comments.
We also need more testing. If the testing can not be automated as integration tests, then we should attach manual testing results in the PR to show that those timeout errors that we want to get rid of are indeed gone.
Also note that we should not merge the python driver PR before the server side CEP-59 implementation gets merged (and maybe more strictly, released).
So we will have plenty of time to polish this PR :)
| if self._connection is None: | ||
| return | ||
| host = self._cluster.metadata.get_host(self._connection.endpoint) | ||
| print("host found:", host) |
There was a problem hiding this comment.
We need to remove those print statements before we merge the PR for sure
| self._socket_writable = False | ||
|
|
||
| with self.lock: | ||
| if self.in_flight == 0: |
There was a problem hiding this comment.
For the several occurrences of if self.in_flight == 0: in this PR,
If self.in_flight == 0 is evaluated as false at that time, will the code wait and evaluate self.in_filght == 0 again?
| locally_supported_compressions[compression_type] | ||
|
|
||
| self._send_startup_message(compression_type, no_compact=self.no_compact) | ||
| self.supports_graceful_disconnect = options_response.options.get('GRACEFUL_DISCONNECT') == ['true'] |
There was a problem hiding this comment.
Wondering where is the code that regsiters to listen on the GRACEFUL_DISCONNECT event?
JIRA