@@ -76,11 +76,13 @@ import (
76
76
"github.com/pingcap/tidb/pkg/util/format"
77
77
"github.com/pingcap/tidb/pkg/util/hack"
78
78
"github.com/pingcap/tidb/pkg/util/hint"
79
+ "github.com/pingcap/tidb/pkg/util/logutil"
79
80
"github.com/pingcap/tidb/pkg/util/memory"
80
81
"github.com/pingcap/tidb/pkg/util/sem"
81
82
"github.com/pingcap/tidb/pkg/util/set"
82
83
"github.com/pingcap/tidb/pkg/util/sqlexec"
83
84
"github.com/pingcap/tidb/pkg/util/stringutil"
85
+ "go.uber.org/zap"
84
86
)
85
87
86
88
var etcdDialTimeout = 5 * time .Second
@@ -2285,18 +2287,25 @@ func (e *ShowExec) fetchShowSessionStates(ctx context.Context) error {
2285
2287
// The token may be leaked without secure transport, but the cloud can ensure security in some situations,
2286
2288
// so we don't enforce secure connections.
2287
2289
if token , err = sessionstates .CreateSessionToken (user .Username ); err != nil {
2288
- return err
2290
+ // Some users deploy TiProxy after the cluster is running and configuring signing certs will restart TiDB.
2291
+ // The users may don't need connection migration, e.g. they only want traffic replay, which requires session states
2292
+ // but not session tokens. So we don't return errors, just log it.
2293
+ logutil .Logger (ctx ).Warn ("create session token failed" , zap .Error (err ))
2289
2294
}
2290
2295
}
2291
- tokenBytes , err := gjson .Marshal (token )
2292
- if err != nil {
2293
- return errors .Trace (err )
2294
- }
2295
- tokenJSON := types.BinaryJSON {}
2296
- if err = tokenJSON .UnmarshalJSON (tokenBytes ); err != nil {
2297
- return err
2296
+ if token != nil {
2297
+ tokenBytes , err := gjson .Marshal (token )
2298
+ if err != nil {
2299
+ return errors .Trace (err )
2300
+ }
2301
+ tokenJSON := types.BinaryJSON {}
2302
+ if err = tokenJSON .UnmarshalJSON (tokenBytes ); err != nil {
2303
+ return err
2304
+ }
2305
+ e .appendRow ([]any {stateJSON , tokenJSON })
2306
+ } else {
2307
+ e .appendRow ([]any {stateJSON , nil })
2298
2308
}
2299
- e .appendRow ([]any {stateJSON , tokenJSON })
2300
2309
return nil
2301
2310
}
2302
2311
0 commit comments