From 7da9818dd6bd68f33d1b53445495db152403c841 Mon Sep 17 00:00:00 2001 From: ystaticy Date: Wed, 25 Dec 2024 16:20:03 +0800 Subject: [PATCH] fix if ks meta is nil Signed-off-by: ystaticy --- internal/locate/pd_codec.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/locate/pd_codec.go b/internal/locate/pd_codec.go index 110ea4ca2..f5aa9c18c 100644 --- a/internal/locate/pd_codec.go +++ b/internal/locate/pd_codec.go @@ -74,6 +74,10 @@ func NewCodecPDClientWithKeyspace(mode apicodec.Mode, client pd.Client, keyspace // NewCodecPDClientWithKeyspaceMeta creates a CodecPDClient in API v2 with keyspace name. func NewCodecPDClientWithKeyspaceMeta(mode apicodec.Mode, client pd.Client, keyspaceMeta *keyspacepb.KeyspaceMeta) (*CodecPDClient, error) { + if keyspaceMeta == nil { + return NewCodecPDClient(mode, client), nil + } + codec, err := apicodec.NewCodecV2(mode, keyspaceMeta) if err != nil { return nil, err