forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ccl/sqlproxyccl: replace ConnectionCopy logic in forwarder with inter…
…ceptors Informs cockroachdb#76000. Previously, we were using io.Copy through ConnectionCopy to forward messages between the client and SQL server. Now that the interceptors have been merged, we will update the forwarder to use these interceptors instead of the old approach. There are a few notable changes in this commit: 1. We wrap clientConn with the a readTimeoutConn that was exposed in the previous commit. This allows us to unblock on Read whenever an activity occurs (e.g. context cancellation, and in the future, when transfer is requested). 2. There are two goroutines per connection within the forwarder: one for the request processor (client to server), and the other for the response processor (server to client). 3. We also removed unnecessary checks for codeExpiredClientConnection and codeIdleDisconnect errors when copying from server to client. These are already handled by the idle monitor's callback as well as the denylist watcher's callback. When those constructs were implemented back then, we did not remove them from ConnectionCopy. We need to clean up error messages, and how we propagate them back to the user because today we just close the connection without returning a response, resulting in, I believe, a broken pipe error. Release note: None
- Loading branch information
1 parent
0262907
commit d700758
Showing
5 changed files
with
251 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.