Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-23.2: pgwire: add more test logs to debug flaky test #133695

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions pkg/sql/pgwire/pre_serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ func (s *PreServeConnHandler) maybeUpgradeToSecureConn(
// TODO(knz): Remove this condition - see
// https://github.com/cockroachdb/cockroach/issues/53404
if s.cfg.Insecure {
if buildutil.CrdbTestBuild {
log.Infof(ctx, "using insecure mode since version=%d and cfg.Insecure=true", version)
}
return
}

Expand All @@ -450,6 +453,9 @@ func (s *PreServeConnHandler) maybeUpgradeToSecureConn(
log.Warningf(ctx, "client cannot connect since version=%d AcceptSQLWithoutTLS=false and connType=%s", version, connType)
}
}
if buildutil.CrdbTestBuild {
log.Infof(ctx, "client did not request SSL version=%d AcceptSQLWithoutTLS=false and connType=%s", version, connType)
}
return
}

Expand All @@ -470,6 +476,9 @@ func (s *PreServeConnHandler) maybeUpgradeToSecureConn(
// Protocol sanity check.
if len(buf.Msg) > 0 {
serverErr = errors.Errorf("unexpected data after SSLRequest: %q", buf.Msg)
if buildutil.CrdbTestBuild {
log.Warningf(ctx, "protocol error err=%v", serverErr)
}
return
}

Expand All @@ -479,6 +488,9 @@ func (s *PreServeConnHandler) maybeUpgradeToSecureConn(
// Do we have a TLS configuration?
tlsConfig, serverErr := s.getTLSConfig()
if serverErr != nil {
if buildutil.CrdbTestBuild {
log.Warningf(ctx, "could not get TLS config err=%v", serverErr)
}
return
}

Expand All @@ -491,12 +503,21 @@ func (s *PreServeConnHandler) maybeUpgradeToSecureConn(
}
n, serverErr = conn.Write(sslUnsupported)
if serverErr != nil {
if buildutil.CrdbTestBuild {
log.Warningf(ctx, "error while sending sslUnsupported message to client err=%v", serverErr)
}
return
}
} else {
if buildutil.CrdbTestBuild {
log.Infof(ctx, "sending sslSupported message to client")
}
// We have a TLS configuration. Upgrade the connection.
n, serverErr = conn.Write(sslSupported)
if serverErr != nil {
if buildutil.CrdbTestBuild {
log.Warningf(ctx, "error while sending sslSupported message to client err=%v", serverErr)
}
return
}
newConn = tls.Server(conn, tlsConfig)
Expand All @@ -506,6 +527,9 @@ func (s *PreServeConnHandler) maybeUpgradeToSecureConn(

// Finally, re-read the version/command from the client.
newVersion, *buf, serverErr = s.readVersion(newConn)
if buildutil.CrdbTestBuild && serverErr != nil {
log.Warningf(ctx, "error when reading version err=%v", serverErr)
}
return
}

Expand Down