Skip to content

Commit

Permalink
ccl/sqlproxyccl: add helpers related to connection migration
Browse files Browse the repository at this point in the history
Informs cockroachdb#76000. Extracted from cockroachdb#76805.

This commit adds helpers related to connection migration. This includes support
for retrieving the transfer state through SHOW TRANSFER STATE, as well as
deserializing the session through crdb_internal.deserialize_session.

We also introduce a new error marker for errors that denote connections which
are recoverable. In our case, we convert SQL errors from first column of the
SHOW TRANSFER STATE query (e.g. serialization errors) to Go errors, and mark
them with the errConnRecoverableSentinel sentinel.

Release note: None
  • Loading branch information
jaylim-crl committed Feb 28, 2022
1 parent 723b7ee commit 87fdfde
Show file tree
Hide file tree
Showing 5 changed files with 1,250 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/ccl/sqlproxyccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ go_library(
srcs = [
"authentication.go",
"backend_dialer.go",
"conn_migration.go",
"connector.go",
"error.go",
"forwarder.go",
Expand All @@ -28,7 +29,9 @@ go_library(
"//pkg/security/certmgr",
"//pkg/sql/pgwire",
"//pkg/sql/pgwire/pgcode",
"//pkg/sql/pgwire/pgwirebase",
"//pkg/util/contextutil",
"//pkg/util/encoding",
"//pkg/util/grpcutil",
"//pkg/util/httputil",
"//pkg/util/log",
Expand All @@ -52,6 +55,7 @@ go_test(
size = "small",
srcs = [
"authentication_test.go",
"conn_migration_test.go",
"connector_test.go",
"forwarder_test.go",
"frontend_admitter_test.go",
Expand All @@ -65,6 +69,7 @@ go_test(
"//pkg/base",
"//pkg/ccl/kvccl/kvtenantccl",
"//pkg/ccl/sqlproxyccl/denylist",
"//pkg/ccl/sqlproxyccl/interceptor",
"//pkg/ccl/sqlproxyccl/tenantdirsvr",
"//pkg/ccl/sqlproxyccl/throttler",
"//pkg/ccl/utilccl",
Expand All @@ -75,6 +80,7 @@ go_test(
"//pkg/sql",
"//pkg/sql/pgwire",
"//pkg/sql/pgwire/pgerror",
"//pkg/sql/pgwire/pgwirebase",
"//pkg/testutils",
"//pkg/testutils/serverutils",
"//pkg/testutils/skip",
Expand Down
Loading

0 comments on commit 87fdfde

Please sign in to comment.