From b274f5db482540ba16cc2c5eb15913a85db0227d Mon Sep 17 00:00:00 2001 From: disksing Date: Thu, 18 Jun 2026 23:59:03 +0800 Subject: [PATCH 01/17] Add API V3 keyspace identity to PD client Signed-off-by: disksing --- client/client.go | 122 ++++++++++++++++++ client/clients/tso/dispatcher.go | 3 +- client/clients/tso/dispatcher_test.go | 3 + client/clients/tso/stream.go | 34 +++-- client/clients/tso/stream_test.go | 9 +- client/go.mod | 2 +- client/go.sum | 4 +- client/inner_client.go | 6 +- client/resource_manager_client_test.go | 17 ++- .../mock_service_discovery.go | 7 + client/servicediscovery/service_discovery.go | 30 ++++- .../servicediscovery/tso_service_discovery.go | 31 ++++- 12 files changed, 233 insertions(+), 35 deletions(-) diff --git a/client/client.go b/client/client.go index 583d4ba9c91..cb56ba30da1 100644 --- a/client/client.go +++ b/client/client.go @@ -28,6 +28,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/apipb" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/routerpb" @@ -231,6 +232,20 @@ func NewClientWithKeyspace( svrAddrs, security, opts...) } +// NewClientWithKeyspaceIdentity creates a client with context and the specified API V3 keyspace identity. +func NewClientWithKeyspaceIdentity( + ctx context.Context, + callerComponent caller.Component, + identity *apipb.KeyspaceIdentity, svrAddrs []string, + security SecurityOption, opts ...opt.ClientOption, +) (Client, error) { + if err := validateKeyspaceIdentity(identity); err != nil { + return nil, err + } + return createClientWithKeyspaceIdentity(ctx, callerComponent, identity, + svrAddrs, security, opts...) +} + // createClientWithKeyspace creates a client with context and the specified keyspace id. func createClientWithKeyspace( ctx context.Context, @@ -272,6 +287,73 @@ func createClientWithKeyspace( return c, c.inner.init(nil) } +// createClientWithKeyspaceIdentity creates a client with context and the specified API V3 keyspace identity. +func createClientWithKeyspaceIdentity( + ctx context.Context, + callerComponent caller.Component, + identity *apipb.KeyspaceIdentity, svrAddrs []string, + security SecurityOption, opts ...opt.ClientOption, +) (Client, error) { + tlsCfg, err := tlsutil.TLSConfig{ + CAPath: security.CAPath, + CertPath: security.CertPath, + KeyPath: security.KeyPath, + + SSLCABytes: security.SSLCABytes, + SSLCertBytes: security.SSLCertBytes, + SSLKEYBytes: security.SSLKEYBytes, + }.ToTLSConfig() + if err != nil { + return nil, err + } + clientCtx, clientCancel := context.WithCancel(ctx) + c := &client{ + callerComponent: adjustCallerComponent(callerComponent), + inner: &innerClient{ + keyspaceID: identity.GetKeyspaceId(), + keyspaceIdentity: cloneKeyspaceIdentity(identity), + svrUrls: svrAddrs, + updateTokenConnectionCh: make(chan struct{}, 1), + ctx: clientCtx, + cancel: clientCancel, + tlsCfg: tlsCfg, + option: opt.NewOption(), + }, + } + + // Inject the client options. + for _, opt := range opts { + opt(c.inner.option) + } + + return c, c.inner.init(nil) +} + +func validateKeyspaceIdentity(identity *apipb.KeyspaceIdentity) error { + if identity == nil { + return errors.New("missing keyspace identity") + } + if identity.GetNamespaceId() == 0 { + return errors.New("keyspace identity namespace id must be non-zero") + } + keyspaceID := identity.GetKeyspaceId() + if keyspaceID == 0 || keyspaceID > constants.MaxKeyspaceID { + return errors.Errorf("invalid keyspace id %d. It must be in the range of [1, %d]", + keyspaceID, constants.MaxKeyspaceID) + } + return nil +} + +func cloneKeyspaceIdentity(identity *apipb.KeyspaceIdentity) *apipb.KeyspaceIdentity { + if identity == nil { + return nil + } + return &apipb.KeyspaceIdentity{ + NamespaceId: identity.GetNamespaceId(), + KeyspaceId: identity.GetKeyspaceId(), + } +} + // APIVersion is the API version the server and the client is using. // See more details in https://github.com/tikv/rfcs/blob/master/text/0069-api-v2.md#kvproto type APIVersion int @@ -282,6 +364,7 @@ const ( V1 APIVersion = iota _ V2 + V3 ) // APIContext is the context for API version. @@ -290,6 +373,10 @@ type APIContext interface { GetKeyspaceName() (keyspaceName string) } +type keyspaceIdentityAPIContext interface { + GetKeyspaceIdentity() *apipb.KeyspaceIdentity +} + type apiContextV1 struct{} // NewAPIContextV1 creates a API context for V1. @@ -329,6 +416,34 @@ func (apiCtx *apiContextV2) GetKeyspaceName() (keyspaceName string) { return apiCtx.keyspaceName } +type apiContextV3 struct { + keyspaceName string + keyspaceIdentity *apipb.KeyspaceIdentity +} + +// NewAPIContextV3 creates an API context with the specified keyspace identity for V3. +func NewAPIContextV3(keyspaceName string, identity *apipb.KeyspaceIdentity) APIContext { + return &apiContextV3{ + keyspaceName: keyspaceName, + keyspaceIdentity: cloneKeyspaceIdentity(identity), + } +} + +// GetAPIVersion returns the API version. +func (*apiContextV3) GetAPIVersion() (version APIVersion) { + return V3 +} + +// GetKeyspaceName returns the keyspace name. +func (apiCtx *apiContextV3) GetKeyspaceName() (keyspaceName string) { + return apiCtx.keyspaceName +} + +// GetKeyspaceIdentity returns the keyspace identity. +func (apiCtx *apiContextV3) GetKeyspaceIdentity() *apipb.KeyspaceIdentity { + return cloneKeyspaceIdentity(apiCtx.keyspaceIdentity) +} + // NewClientWithAPIContext creates a client according to the API context. func NewClientWithAPIContext( ctx context.Context, apiCtx APIContext, @@ -344,6 +459,13 @@ func NewClientWithAPIContext( case V2: return newClientWithKeyspaceName(ctx, callerComponent, keyspaceName, svrAddrs, security, opts...) + case V3: + identityCtx, ok := apiCtx.(keyspaceIdentityAPIContext) + if !ok { + return nil, errors.New("[pd] API V3 context missing keyspace identity") + } + return NewClientWithKeyspaceIdentity(ctx, callerComponent, + identityCtx.GetKeyspaceIdentity(), svrAddrs, security, opts...) default: return nil, errors.Errorf("[pd] invalid API version %d", apiVersion) } diff --git a/client/clients/tso/dispatcher.go b/client/clients/tso/dispatcher.go index 09ba0b219db..67157d90788 100644 --- a/client/clients/tso/dispatcher.go +++ b/client/clients/tso/dispatcher.go @@ -430,6 +430,7 @@ func (td *tsoDispatcher) processRequests( svcDiscovery = td.provider.getServiceDiscovery() clusterID = svcDiscovery.GetClusterID() keyspaceID = svcDiscovery.GetKeyspaceID() + keyspaceIdentity = svcDiscovery.GetKeyspaceIdentity() reqKeyspaceGroupID = svcDiscovery.GetKeyspaceGroupID() ) @@ -464,7 +465,7 @@ func (td *tsoDispatcher) processRequests( } err := stream.processRequests( - clusterID, keyspaceID, reqKeyspaceGroupID, + clusterID, keyspaceID, reqKeyspaceGroupID, keyspaceIdentity, count, tbc.GetExtraBatchingStartTime(), cb) if err != nil { close(done) diff --git a/client/clients/tso/dispatcher_test.go b/client/clients/tso/dispatcher_test.go index 8e7110e4c71..39a2633fdb7 100644 --- a/client/clients/tso/dispatcher_test.go +++ b/client/clients/tso/dispatcher_test.go @@ -29,6 +29,7 @@ import ( "google.golang.org/grpc" "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/apipb" "github.com/pingcap/log" "github.com/tikv/pd/client/errs" @@ -199,6 +200,8 @@ func (*countingServiceDiscovery) Close() func (*countingServiceDiscovery) GetClusterID() uint64 { return 0 } func (*countingServiceDiscovery) GetKeyspaceID() uint32 { return 0 } func (*countingServiceDiscovery) SetKeyspaceID(uint32) {} +func (*countingServiceDiscovery) GetKeyspaceIdentity() *apipb.KeyspaceIdentity { return nil } +func (*countingServiceDiscovery) SetKeyspaceIdentity(*apipb.KeyspaceIdentity) {} func (*countingServiceDiscovery) GetKeyspaceGroupID() uint32 { return 0 } func (*countingServiceDiscovery) GetServiceURLs() []string { return nil } func (*countingServiceDiscovery) GetServingEndpointClientConn() *grpc.ClientConn { return nil } diff --git a/client/clients/tso/stream.go b/client/clients/tso/stream.go index 898cb1fa02d..16f2550f35a 100644 --- a/client/clients/tso/stream.go +++ b/client/clients/tso/stream.go @@ -29,6 +29,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/apipb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" @@ -124,7 +125,7 @@ type tsoRequestResult struct { } type grpcTSOStreamAdapter interface { - Send(clusterID uint64, keyspaceID, keyspaceGroupID uint32, count int64) error + Send(clusterID uint64, keyspaceID, keyspaceGroupID uint32, keyspaceIdentity *apipb.KeyspaceIdentity, count int64) error Recv() (tsoRequestResult, error) } @@ -133,12 +134,13 @@ type pdTSOStreamAdapter struct { } // Send implements the grpcTSOStreamAdapter interface. -func (s pdTSOStreamAdapter) Send(clusterID uint64, _, _ uint32, count int64) error { +func (s pdTSOStreamAdapter) Send(clusterID uint64, _, _ uint32, keyspaceIdentity *apipb.KeyspaceIdentity, count int64) error { req := &pdpb.TsoRequest{ Header: &pdpb.RequestHeader{ ClusterId: clusterID, }, - Count: uint32(count), + Count: uint32(count), + KeyspaceIdentity: cloneKeyspaceIdentity(keyspaceIdentity), } return s.stream.Send(req) } @@ -163,13 +165,14 @@ type tsoTSOStreamAdapter struct { } // Send implements the grpcTSOStreamAdapter interface. -func (s tsoTSOStreamAdapter) Send(clusterID uint64, keyspaceID, keyspaceGroupID uint32, count int64) error { +func (s tsoTSOStreamAdapter) Send(clusterID uint64, keyspaceID, keyspaceGroupID uint32, keyspaceIdentity *apipb.KeyspaceIdentity, count int64) error { req := &tsopb.TsoRequest{ Header: &tsopb.RequestHeader{ - ClusterId: clusterID, - KeyspaceId: keyspaceID, - KeyspaceGroupId: keyspaceGroupID, - CalleeId: s.calleeID, + ClusterId: clusterID, + KeyspaceId: keyspaceID, + KeyspaceGroupId: keyspaceGroupID, + CalleeId: s.calleeID, + KeyspaceIdentity: cloneKeyspaceIdentity(keyspaceIdentity), }, Count: uint32(count), } @@ -274,7 +277,8 @@ func (s *tsoStream) getServerURL() string { // It's guaranteed that the `callback` will be called, but when the request is failed to be scheduled, the callback // will be ignored. func (s *tsoStream) processRequests( - clusterID uint64, keyspaceID, keyspaceGroupID uint32, count int64, batchStartTime time.Time, callback onFinishedCallback, + clusterID uint64, keyspaceID, keyspaceGroupID uint32, keyspaceIdentity *apipb.KeyspaceIdentity, + count int64, batchStartTime time.Time, callback onFinishedCallback, ) error { start := time.Now() @@ -312,7 +316,7 @@ func (s *tsoStream) processRequests( s.state.Store(prevState) failpoint.InjectCall("pauseAfterTSORequestAttachedToStream") - if err := s.stream.Send(clusterID, keyspaceID, keyspaceGroupID, count); err != nil { + if err := s.stream.Send(clusterID, keyspaceID, keyspaceGroupID, keyspaceIdentity, count); err != nil { // As the request is already put into `pendingRequests`, the request should finally be canceled by the recvLoop. // So skip returning error here to avoid // if err == io.EOF { @@ -327,6 +331,16 @@ func (s *tsoStream) processRequests( return nil } +func cloneKeyspaceIdentity(identity *apipb.KeyspaceIdentity) *apipb.KeyspaceIdentity { + if identity == nil { + return nil + } + return &apipb.KeyspaceIdentity{ + NamespaceId: identity.GetNamespaceId(), + KeyspaceId: identity.GetKeyspaceId(), + } +} + func (s *tsoStream) recvLoop(ctx context.Context) { var finishWithErr error var currentReq batchedRequests diff --git a/client/clients/tso/stream_test.go b/client/clients/tso/stream_test.go index 7b05715f04b..6febeaa06cd 100644 --- a/client/clients/tso/stream_test.go +++ b/client/clients/tso/stream_test.go @@ -26,6 +26,7 @@ import ( "go.uber.org/zap/zapcore" "github.com/pingcap/errors" + "github.com/pingcap/kvproto/pkg/apipb" "github.com/pingcap/log" "github.com/tikv/pd/client/errs" @@ -79,7 +80,7 @@ func newMockTSOStreamImpl(ctx context.Context, resultMode resultMode) *mockTSOSt } } -func (s *mockTSOStreamImpl) Send(clusterID uint64, _keyspaceID, keyspaceGroupID uint32, count int64) error { +func (s *mockTSOStreamImpl) Send(clusterID uint64, _keyspaceID, keyspaceGroupID uint32, _keyspaceIdentity *apipb.KeyspaceIdentity, count int64) error { select { case <-s.ctx.Done(): return s.ctx.Err() @@ -306,7 +307,7 @@ func (s *testTSOStreamSuite) getResult(ch <-chan callbackInvocation) callbackInv func (s *testTSOStreamSuite) processRequestWithResultCh(count int64) (<-chan callbackInvocation, error) { ch := make(chan callbackInvocation, 1) - err := s.stream.processRequests(1, 2, 3, count, time.Now(), func(result tsoRequestResult, reqKeyspaceGroupID uint32, err error) { + err := s.stream.processRequests(1, 2, 3, nil, count, time.Now(), func(result tsoRequestResult, reqKeyspaceGroupID uint32, err error) { if err == nil { s.re.Equal(uint32(3), reqKeyspaceGroupID) } @@ -358,7 +359,7 @@ func (s *testTSOStreamSuite) TestTSOStreamBasic() { // After an error from the (simulated) RPC stream, the tsoStream should be in a broken status and can't accept // new request anymore. testutil.Eventually(s.re, func() bool { - return s.stream.processRequests(1, 2, 3, 1, time.Now(), func(_result tsoRequestResult, _reqKeyspaceGroupID uint32, err error) { + return s.stream.processRequests(1, 2, 3, nil, 1, time.Now(), func(_result tsoRequestResult, _reqKeyspaceGroupID uint32, err error) { s.re.Error(err) }) != nil }) @@ -622,7 +623,7 @@ func BenchmarkTSOStreamSendRecv(b *testing.B) { b.ResetTimer() for range b.N { - err := stream.processRequests(1, 1, 1, 1, now, func(result tsoRequestResult, _ uint32, err error) { + err := stream.processRequests(1, 1, 1, nil, 1, now, func(result tsoRequestResult, _ uint32, err error) { if err != nil { panic(err) } diff --git a/client/go.mod b/client/go.mod index 875566a8c53..90f94b3895a 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260514102340-daa7c864b473 + github.com/pingcap/kvproto v0.0.0-20260608022438-934094768e0f github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 diff --git a/client/go.sum b/client/go.sum index 9af00e05f28..4e815357dc8 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260514102340-daa7c864b473 h1:n6QWAac97mv2NJhn17iFPFnsE5fMgtPLNmsGZeqq78o= -github.com/pingcap/kvproto v0.0.0-20260514102340-daa7c864b473/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260608022438-934094768e0f h1:hfFWu4+tdYMlzwF1W04vEH13hJX+OggQIcSlwQYl7Io= +github.com/pingcap/kvproto v0.0.0-20260608022438-934094768e0f/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/client/inner_client.go b/client/inner_client.go index 3c7d2f5f928..9496c587731 100644 --- a/client/inner_client.go +++ b/client/inner_client.go @@ -26,6 +26,7 @@ import ( "google.golang.org/grpc/status" "github.com/pingcap/errors" + "github.com/pingcap/kvproto/pkg/apipb" "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" @@ -45,6 +46,7 @@ const ( type innerClient struct { keyspaceID uint32 + keyspaceIdentity *apipb.KeyspaceIdentity keyspaceMeta *keyspacepb.KeyspaceMeta // keyspace metadata svrUrls []string serviceDiscovery sd.ServiceDiscovery @@ -66,7 +68,7 @@ type innerClient struct { func (c *innerClient) init(updateKeyspaceIDCb sd.UpdateKeyspaceIDFunc) error { c.serviceDiscovery = sd.NewServiceDiscovery( c.ctx, c.cancel, &c.wg, c.setServiceMode, - updateKeyspaceIDCb, c.keyspaceID, c.svrUrls, c.tlsCfg, c.option) + updateKeyspaceIDCb, c.keyspaceID, c.keyspaceIdentity, c.svrUrls, c.tlsCfg, c.option) if err := c.setup(); err != nil { c.cancel() if c.serviceDiscovery != nil { @@ -174,7 +176,7 @@ func (c *innerClient) resetTSOClientLocked(mode pdpb.ServiceMode) { case pdpb.ServiceMode_API_SVC_MODE: newTSOSvcDiscovery = sd.NewTSOServiceDiscovery( c.ctx, c, c.serviceDiscovery, - c.keyspaceID, c.keyspaceMeta, c.tlsCfg, c.option) + c.keyspaceID, c.keyspaceIdentity, c.keyspaceMeta, c.tlsCfg, c.option) // At this point, the keyspace group isn't known yet. Starts from the default keyspace group, // and will be updated later. newTSOCli = tso.NewClient(c.ctx, c.option, diff --git a/client/resource_manager_client_test.go b/client/resource_manager_client_test.go index 84674dcca4b..4302a333f2b 100644 --- a/client/resource_manager_client_test.go +++ b/client/resource_manager_client_test.go @@ -28,6 +28,7 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/grpc" + "github.com/pingcap/kvproto/pkg/apipb" "github.com/pingcap/kvproto/pkg/meta_storagepb" rmpb "github.com/pingcap/kvproto/pkg/resource_manager" @@ -52,13 +53,15 @@ func newTestServiceDiscovery(servingURL string, conn *grpc.ClientConn) *testServ return t } -func (*testServiceDiscovery) Init() error { return nil } -func (*testServiceDiscovery) Close() {} -func (*testServiceDiscovery) GetClusterID() uint64 { return 0 } -func (t *testServiceDiscovery) GetKeyspaceID() uint32 { return t.keyspaceID } -func (t *testServiceDiscovery) SetKeyspaceID(id uint32) { t.keyspaceID = id } -func (*testServiceDiscovery) GetKeyspaceGroupID() uint32 { return 0 } -func (t *testServiceDiscovery) GetServiceURLs() []string { return []string{t.servingURL} } +func (*testServiceDiscovery) Init() error { return nil } +func (*testServiceDiscovery) Close() {} +func (*testServiceDiscovery) GetClusterID() uint64 { return 0 } +func (t *testServiceDiscovery) GetKeyspaceID() uint32 { return t.keyspaceID } +func (t *testServiceDiscovery) SetKeyspaceID(id uint32) { t.keyspaceID = id } +func (*testServiceDiscovery) GetKeyspaceIdentity() *apipb.KeyspaceIdentity { return nil } +func (*testServiceDiscovery) SetKeyspaceIdentity(*apipb.KeyspaceIdentity) {} +func (*testServiceDiscovery) GetKeyspaceGroupID() uint32 { return 0 } +func (t *testServiceDiscovery) GetServiceURLs() []string { return []string{t.servingURL} } func (t *testServiceDiscovery) GetServingEndpointClientConn() *grpc.ClientConn { conn, _ := t.clientConns.Load(t.servingURL) if conn == nil { diff --git a/client/servicediscovery/mock_service_discovery.go b/client/servicediscovery/mock_service_discovery.go index a4bd2065a41..e84a42dc39b 100644 --- a/client/servicediscovery/mock_service_discovery.go +++ b/client/servicediscovery/mock_service_discovery.go @@ -18,6 +18,7 @@ import ( "crypto/tls" "sync" + "github.com/pingcap/kvproto/pkg/apipb" "google.golang.org/grpc" ) @@ -65,6 +66,12 @@ func (*mockServiceDiscovery) GetKeyspaceID() uint32 { return 0 } // SetKeyspaceID implements the ServiceDiscovery interface. func (*mockServiceDiscovery) SetKeyspaceID(uint32) {} +// GetKeyspaceIdentity implements the ServiceDiscovery interface. +func (*mockServiceDiscovery) GetKeyspaceIdentity() *apipb.KeyspaceIdentity { return nil } + +// SetKeyspaceIdentity implements the ServiceDiscovery interface. +func (*mockServiceDiscovery) SetKeyspaceIdentity(*apipb.KeyspaceIdentity) {} + // GetKeyspaceGroupID implements the ServiceDiscovery interface. func (*mockServiceDiscovery) GetKeyspaceGroupID() uint32 { return 0 } diff --git a/client/servicediscovery/service_discovery.go b/client/servicediscovery/service_discovery.go index 5716c24125c..f7bbf1cc185 100644 --- a/client/servicediscovery/service_discovery.go +++ b/client/servicediscovery/service_discovery.go @@ -35,6 +35,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/apipb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" @@ -97,6 +98,10 @@ type ServiceDiscovery interface { GetKeyspaceID() uint32 // SetKeyspaceID sets the ID of the keyspace SetKeyspaceID(id uint32) + // GetKeyspaceIdentity returns the API V3 identity of the keyspace, if any. + GetKeyspaceIdentity() *apipb.KeyspaceIdentity + // SetKeyspaceIdentity sets the API V3 identity of the keyspace. + SetKeyspaceIdentity(identity *apipb.KeyspaceIdentity) // GetKeyspaceGroupID returns the ID of the keyspace group GetKeyspaceGroupID() uint32 // GetServiceURLs returns the URLs of the servers providing the service @@ -448,6 +453,7 @@ type serviceDiscovery struct { updateKeyspaceIDFunc UpdateKeyspaceIDFunc keyspaceID uint32 + keyspaceIdentity *apipb.KeyspaceIdentity tlsCfg *tls.Config // Client option. option *opt.Option @@ -461,7 +467,7 @@ func NewDefaultServiceDiscovery( urls []string, tlsCfg *tls.Config, ) ServiceDiscovery { var wg sync.WaitGroup - return NewServiceDiscovery(ctx, cancel, &wg, nil, nil, constants.DefaultKeyspaceID, urls, tlsCfg, opt.NewOption()) + return NewServiceDiscovery(ctx, cancel, &wg, nil, nil, constants.DefaultKeyspaceID, nil, urls, tlsCfg, opt.NewOption()) } // NewServiceDiscovery returns a new service discovery-based client. @@ -471,6 +477,7 @@ func NewServiceDiscovery( serviceModeUpdateCb func(pdpb.ServiceMode), updateKeyspaceIDFunc UpdateKeyspaceIDFunc, keyspaceID uint32, + keyspaceIdentity *apipb.KeyspaceIdentity, urls []string, tlsCfg *tls.Config, option *opt.Option, ) ServiceDiscovery { pdsd := &serviceDiscovery{ @@ -482,6 +489,7 @@ func NewServiceDiscovery( callbacks: newServiceCallbacks(), updateKeyspaceIDFunc: updateKeyspaceIDFunc, keyspaceID: keyspaceID, + keyspaceIdentity: cloneKeyspaceIdentity(keyspaceIdentity), tlsCfg: tlsCfg, option: option, flight: singleflight.Group{}, @@ -676,6 +684,26 @@ func (c *serviceDiscovery) SetKeyspaceID(keyspaceID uint32) { c.keyspaceID = keyspaceID } +// GetKeyspaceIdentity returns the API V3 identity of the keyspace, if any. +func (c *serviceDiscovery) GetKeyspaceIdentity() *apipb.KeyspaceIdentity { + return cloneKeyspaceIdentity(c.keyspaceIdentity) +} + +// SetKeyspaceIdentity sets the API V3 identity of the keyspace. +func (c *serviceDiscovery) SetKeyspaceIdentity(identity *apipb.KeyspaceIdentity) { + c.keyspaceIdentity = cloneKeyspaceIdentity(identity) +} + +func cloneKeyspaceIdentity(identity *apipb.KeyspaceIdentity) *apipb.KeyspaceIdentity { + if identity == nil { + return nil + } + return &apipb.KeyspaceIdentity{ + NamespaceId: identity.GetNamespaceId(), + KeyspaceId: identity.GetKeyspaceId(), + } +} + // GetKeyspaceGroupID returns the ID of the keyspace group func (*serviceDiscovery) GetKeyspaceGroupID() uint32 { // PD only supports the default keyspace group diff --git a/client/servicediscovery/tso_service_discovery.go b/client/servicediscovery/tso_service_discovery.go index fd1f49a397a..127fa7878c1 100644 --- a/client/servicediscovery/tso_service_discovery.go +++ b/client/servicediscovery/tso_service_discovery.go @@ -31,6 +31,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/apipb" "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/tsopb" @@ -123,6 +124,7 @@ type tsoServiceDiscovery struct { serviceDiscovery ServiceDiscovery clusterID uint64 keyspaceID atomic.Uint32 + keyspaceIdentity *apipb.KeyspaceIdentity keyspaceMeta *keyspacepb.KeyspaceMeta // keyspace metadata // defaultDiscoveryKey is the etcd path used for discovering the serving endpoints of @@ -156,7 +158,7 @@ type tsoServiceDiscovery struct { // NewTSOServiceDiscovery returns a new client-side service discovery for the independent TSO service. func NewTSOServiceDiscovery( ctx context.Context, metacli metastorage.Client, serviceDiscovery ServiceDiscovery, - keyspaceID uint32, keyspaceMeta *keyspacepb.KeyspaceMeta, tlsCfg *tls.Config, option *opt.Option, + keyspaceID uint32, keyspaceIdentity *apipb.KeyspaceIdentity, keyspaceMeta *keyspacepb.KeyspaceMeta, tlsCfg *tls.Config, option *opt.Option, ) ServiceDiscovery { ctx, cancel := context.WithCancel(ctx) c := &tsoServiceDiscovery{ @@ -165,6 +167,7 @@ func NewTSOServiceDiscovery( metacli: metacli, serviceDiscovery: serviceDiscovery, clusterID: serviceDiscovery.GetClusterID(), + keyspaceIdentity: cloneKeyspaceIdentity(keyspaceIdentity), keyspaceMeta: keyspaceMeta, tlsCfg: tlsCfg, option: option, @@ -267,6 +270,16 @@ func (c *tsoServiceDiscovery) SetKeyspaceID(keyspaceID uint32) { c.keyspaceID.Store(keyspaceID) } +// GetKeyspaceIdentity returns the API V3 identity of the keyspace, if any. +func (c *tsoServiceDiscovery) GetKeyspaceIdentity() *apipb.KeyspaceIdentity { + return cloneKeyspaceIdentity(c.keyspaceIdentity) +} + +// SetKeyspaceIdentity sets the API V3 identity of the keyspace. +func (c *tsoServiceDiscovery) SetKeyspaceIdentity(identity *apipb.KeyspaceIdentity) { + c.keyspaceIdentity = cloneKeyspaceIdentity(identity) +} + // GetKeyspaceGroupID returns the ID of the keyspace group. If the keyspace group is unknown, // it returns the default keyspace group ID. func (c *tsoServiceDiscovery) GetKeyspaceGroupID() uint32 { @@ -633,14 +646,18 @@ func (c *tsoServiceDiscovery) findGroupByKeyspaceID( return nil, 0, err } + header := &tsopb.RequestHeader{ + ClusterId: c.clusterID, + KeyspaceId: keyspaceID, + KeyspaceGroupId: constants.DefaultKeyspaceGroupID, + CalleeId: grpcutil.GetCalleeID(tsoSrvURL), + } + if c.keyspaceIdentity != nil { + header.KeyspaceIdentity = cloneKeyspaceIdentity(c.keyspaceIdentity) + } resp, err := tsopb.NewTSOClient(cc).FindGroupByKeyspaceID( ctx, &tsopb.FindGroupByKeyspaceIDRequest{ - Header: &tsopb.RequestHeader{ - ClusterId: c.clusterID, - KeyspaceId: keyspaceID, - KeyspaceGroupId: constants.DefaultKeyspaceGroupID, - CalleeId: grpcutil.GetCalleeID(tsoSrvURL), - }, + Header: header, KeyspaceId: keyspaceID, ModRevision: modRevision, }) From 663ce147ff41e0b965baf4b9a206fa6bcb605c3a Mon Sep 17 00:00:00 2001 From: disksing Date: Fri, 19 Jun 2026 00:37:02 +0800 Subject: [PATCH 02/17] Use API V3 TSO keyspace group lookup Signed-off-by: disksing --- .../servicediscovery/tso_service_discovery.go | 60 ++++++++++++++----- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/client/servicediscovery/tso_service_discovery.go b/client/servicediscovery/tso_service_discovery.go index 127fa7878c1..d4a6b3929e5 100644 --- a/client/servicediscovery/tso_service_discovery.go +++ b/client/servicediscovery/tso_service_discovery.go @@ -652,41 +652,71 @@ func (c *tsoServiceDiscovery) findGroupByKeyspaceID( KeyspaceGroupId: constants.DefaultKeyspaceGroupID, CalleeId: grpcutil.GetCalleeID(tsoSrvURL), } + tsoClient := tsopb.NewTSOClient(cc) + var ( + keyspaceGroup *tsopb.KeyspaceGroup + respHeader *tsopb.ResponseHeader + respRevision uint64 + findErr error + ) if c.keyspaceIdentity != nil { - header.KeyspaceIdentity = cloneKeyspaceIdentity(c.keyspaceIdentity) + resp, err := tsoClient.FindGroupByKeyspace( + ctx, &tsopb.FindGroupByKeyspaceRequest{ + Header: header, + KeyspaceIdentity: cloneKeyspaceIdentity(c.keyspaceIdentity), + ModRevision: modRevision, + }) + findErr = err + if resp != nil { + keyspaceGroup = resp.GetKeyspaceGroup() + respHeader = resp.GetHeader() + respRevision = resp.GetModRevision() + } + } else { + resp, err := tsoClient.FindGroupByKeyspaceID( + ctx, &tsopb.FindGroupByKeyspaceIDRequest{ + Header: header, + KeyspaceId: keyspaceID, + ModRevision: modRevision, + }) + findErr = err + if resp != nil { + keyspaceGroup = resp.GetKeyspaceGroup() + respHeader = resp.GetHeader() + respRevision = resp.GetModRevision() + } } - resp, err := tsopb.NewTSOClient(cc).FindGroupByKeyspaceID( - ctx, &tsopb.FindGroupByKeyspaceIDRequest{ - Header: header, - KeyspaceId: keyspaceID, - ModRevision: modRevision, - }) - if err != nil { + if findErr != nil { + attachErr := errors.Errorf("error:%s target:%s status:%s", + findErr, cc.Target(), cc.GetState().String()) + return nil, 0, errs.ErrClientFindGroupByKeyspaceID.Wrap(attachErr).GenWithStackByCause() + } + if respHeader == nil { attachErr := errors.Errorf("error:%s target:%s status:%s", - err, cc.Target(), cc.GetState().String()) + "empty find group response", cc.Target(), cc.GetState().String()) return nil, 0, errs.ErrClientFindGroupByKeyspaceID.Wrap(attachErr).GenWithStackByCause() } - if err := resp.GetHeader().GetError(); err != nil { + if err := respHeader.GetError(); err != nil { if strings.Contains(err.GetMessage(), errs.MismatchCalleeIDErr) { // If the callee ID mismatches, the existing gRPC connection is stale and must be recreated. c.RemoveClientConn(tsoSrvURL) } attachErr := errors.Errorf("error:%s target:%s status:%s", - resp.GetHeader().GetError().String(), cc.Target(), cc.GetState().String()) + err.String(), cc.Target(), cc.GetState().String()) return nil, 0, errs.ErrClientFindGroupByKeyspaceID.Wrap(attachErr).GenWithStackByCause() } - if resp.KeyspaceGroup == nil { + if keyspaceGroup == nil { attachErr := errors.Errorf("error:%s target:%s status:%s", "no keyspace group found", cc.Target(), cc.GetState().String()) return nil, 0, errs.ErrClientFindGroupByKeyspaceID.Wrap(attachErr).GenWithStackByCause() } - if resp.ModRevision < modRevision { + if respRevision < modRevision { attachErr := errors.Errorf("error:%s target:%s response mod revision:%d current mod revision:%d", - "response mod revision less than the given mod revision", cc.Target(), resp.ModRevision, modRevision) + "response mod revision less than the given mod revision", cc.Target(), respRevision, modRevision) return nil, 0, errs.ErrClientFindGroupByKeyspaceID.Wrap(attachErr).GenWithStackByCause() } - return resp.KeyspaceGroup, resp.GetModRevision(), nil + return keyspaceGroup, respRevision, nil } func (c *tsoServiceDiscovery) getTSOServer(sd ServiceDiscovery) (string, error) { From 729ea141b819082a2a31df4f6043ecbdfcd08cba Mon Sep 17 00:00:00 2001 From: disksing Date: Fri, 19 Jun 2026 03:46:02 +0800 Subject: [PATCH 03/17] Align API V3 TSO lookup with keyspace identity Signed-off-by: disksing --- client/clients/tso/stream.go | 24 ++++++++++------ client/gc_client.go | 26 +++++++++-------- client/go.mod | 2 +- client/go.sum | 4 +-- client/http/types.go | 2 +- client/keyspace_client.go | 14 +++++----- .../servicediscovery/tso_service_discovery.go | 28 +++++++++++++------ 7 files changed, 62 insertions(+), 38 deletions(-) diff --git a/client/clients/tso/stream.go b/client/clients/tso/stream.go index 16f2550f35a..0857c585e6e 100644 --- a/client/clients/tso/stream.go +++ b/client/clients/tso/stream.go @@ -166,15 +166,23 @@ type tsoTSOStreamAdapter struct { // Send implements the grpcTSOStreamAdapter interface. func (s tsoTSOStreamAdapter) Send(clusterID uint64, keyspaceID, keyspaceGroupID uint32, keyspaceIdentity *apipb.KeyspaceIdentity, count int64) error { - req := &tsopb.TsoRequest{ - Header: &tsopb.RequestHeader{ - ClusterId: clusterID, - KeyspaceId: keyspaceID, - KeyspaceGroupId: keyspaceGroupID, - CalleeId: s.calleeID, + header := &tsopb.RequestHeader{ + ClusterId: clusterID, + KeyspaceGroupId: keyspaceGroupID, + CalleeId: s.calleeID, + } + if keyspaceIdentity != nil { + header.Keyspace = &tsopb.RequestHeader_KeyspaceIdentity{ KeyspaceIdentity: cloneKeyspaceIdentity(keyspaceIdentity), - }, - Count: uint32(count), + } + } else { + header.Keyspace = &tsopb.RequestHeader_KeyspaceId{ + KeyspaceId: keyspaceID, + } + } + req := &tsopb.TsoRequest{ + Header: header, + Count: uint32(count), } return s.stream.Send(req) } diff --git a/client/gc_client.go b/client/gc_client.go index bd1b0433367..d41773a9405 100644 --- a/client/gc_client.go +++ b/client/gc_client.go @@ -44,9 +44,11 @@ func (c *client) updateGCSafePointV2(ctx context.Context, keyspaceID uint32, saf ctx, cancel := context.WithTimeout(ctx, c.inner.option.Timeout) //nolint:staticcheck req := &pdpb.UpdateGCSafePointV2Request{ - Header: c.requestHeader(), - KeyspaceId: keyspaceID, - SafePoint: safePoint, + Header: c.requestHeader(), + Keyspace: &pdpb.UpdateGCSafePointV2Request_KeyspaceId{ + KeyspaceId: keyspaceID, + }, + SafePoint: safePoint, } protoClient, ctx := c.getClientAndContext(ctx) if protoClient == nil { @@ -75,11 +77,13 @@ func (c *client) updateServiceSafePointV2(ctx context.Context, keyspaceID uint32 ctx, cancel := context.WithTimeout(ctx, c.inner.option.Timeout) //nolint:staticcheck req := &pdpb.UpdateServiceSafePointV2Request{ - Header: c.requestHeader(), - KeyspaceId: keyspaceID, - ServiceId: []byte(serviceID), - SafePoint: safePoint, - Ttl: ttl, + Header: c.requestHeader(), + Keyspace: &pdpb.UpdateServiceSafePointV2Request_KeyspaceId{ + KeyspaceId: keyspaceID, + }, + ServiceId: []byte(serviceID), + SafePoint: safePoint, + Ttl: ttl, } protoClient, ctx := c.getClientAndContext(ctx) if protoClient == nil { @@ -109,7 +113,7 @@ func newGCInternalController(client *client, keyspaceID uint32) *gcInternalContr func wrapKeyspaceScope(keyspaceID uint32) *pdpb.KeyspaceScope { return &pdpb.KeyspaceScope{ - KeyspaceId: keyspaceID, + Keyspace: &pdpb.KeyspaceScope_KeyspaceId{KeyspaceId: keyspaceID}, } } @@ -332,7 +336,7 @@ func (c gcStatesClient) GetGCState(ctx context.Context, opts ...gc.GCStatesAPIOp func pbToGCState(pb *pdpb.GCState, reqStartTime time.Time, excludeGCBarriers bool) gc.GCState { keyspaceID := constants.NullKeyspaceID if pb.KeyspaceScope != nil { - keyspaceID = pb.KeyspaceScope.KeyspaceId + keyspaceID = pb.KeyspaceScope.GetKeyspaceId() } if excludeGCBarriers { return gc.NewGCStateWithoutGCBarriers(keyspaceID, pb.GetTxnSafePoint(), pb.GetGcSafePoint()) @@ -436,7 +440,7 @@ func (c gcStatesClient) GetAllKeyspacesGCStates(ctx context.Context, opts ...gc. if state.KeyspaceScope == nil { keyspaceID = constants.NullKeyspaceID } else { - keyspaceID = state.KeyspaceScope.KeyspaceId + keyspaceID = state.KeyspaceScope.GetKeyspaceId() } gcStates[keyspaceID] = pbToGCState(state, start, options.ExcludeGCBarriers) } diff --git a/client/go.mod b/client/go.mod index 90f94b3895a..99f4684b8a5 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260608022438-934094768e0f + github.com/pingcap/kvproto v0.0.0-20260611143855-3566665c9104 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 diff --git a/client/go.sum b/client/go.sum index 4e815357dc8..d1ae89ecddb 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260608022438-934094768e0f h1:hfFWu4+tdYMlzwF1W04vEH13hJX+OggQIcSlwQYl7Io= -github.com/pingcap/kvproto v0.0.0-20260608022438-934094768e0f/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260611143855-3566665c9104 h1:sNjYPcGD6V+CZl3Txt1b+VQkX6KkJXk8AxBUDizPZVo= +github.com/pingcap/kvproto v0.0.0-20260611143855-3566665c9104/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/client/http/types.go b/client/http/types.go index 9b26f889509..c6764978795 100644 --- a/client/http/types.go +++ b/client/http/types.go @@ -704,7 +704,7 @@ func (meta *tempKeyspaceMeta) toPB() (*keyspacepb.KeyspaceMeta, error) { return &keyspacepb.KeyspaceMeta{ Name: meta.Name, - Id: meta.ID, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: meta.ID}, Config: meta.Config, CreatedAt: meta.CreatedAt, StateChangedAt: meta.StateChangedAt, diff --git a/client/keyspace_client.go b/client/keyspace_client.go index f116ad7c684..cdaf1c323c3 100644 --- a/client/keyspace_client.go +++ b/client/keyspace_client.go @@ -66,7 +66,7 @@ func (c *client) LoadKeyspace(ctx context.Context, name string) (*keyspacepb.Key // Create a hardcoded keyspace meta for keyspace_1 now := time.Now().Unix() mockKeyspaceMeta := &keyspacepb.KeyspaceMeta{ - Id: 1, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 1}, Name: name, CreatedAt: now, StateChangedAt: now, @@ -132,9 +132,9 @@ func (c *client) UpdateKeyspaceState(ctx context.Context, id uint32, state keysp defer func() { metrics.CmdDurationUpdateKeyspaceState.Observe(time.Since(start).Seconds()) }() ctx, cancel := context.WithTimeout(ctx, c.inner.option.Timeout) req := &keyspacepb.UpdateKeyspaceStateRequest{ - Header: c.requestHeader(), - Id: id, - State: state, + Header: c.requestHeader(), + Keyspace: &keyspacepb.UpdateKeyspaceStateRequest_Id{Id: id}, + State: state, } protoClient := c.keyspaceClient() if protoClient == nil { @@ -176,9 +176,9 @@ func (c *client) GetAllKeyspaces(ctx context.Context, startID uint32, limit uint defer func() { metrics.CmdDurationGetAllKeyspaces.Observe(time.Since(start).Seconds()) }() ctx, cancel := context.WithTimeout(ctx, c.inner.option.Timeout) req := &keyspacepb.GetAllKeyspacesRequest{ - Header: c.requestHeader(), - StartId: startID, - Limit: limit, + Header: c.requestHeader(), + StartKeyspace: &keyspacepb.GetAllKeyspacesRequest_StartId{StartId: startID}, + Limit: limit, } protoClient := c.keyspaceClient() if protoClient == nil { diff --git a/client/servicediscovery/tso_service_discovery.go b/client/servicediscovery/tso_service_discovery.go index d4a6b3929e5..7b642a31b82 100644 --- a/client/servicediscovery/tso_service_discovery.go +++ b/client/servicediscovery/tso_service_discovery.go @@ -648,10 +648,18 @@ func (c *tsoServiceDiscovery) findGroupByKeyspaceID( header := &tsopb.RequestHeader{ ClusterId: c.clusterID, - KeyspaceId: keyspaceID, KeyspaceGroupId: constants.DefaultKeyspaceGroupID, CalleeId: grpcutil.GetCalleeID(tsoSrvURL), } + if c.keyspaceIdentity != nil { + header.Keyspace = &tsopb.RequestHeader_KeyspaceIdentity{ + KeyspaceIdentity: cloneKeyspaceIdentity(c.keyspaceIdentity), + } + } else { + header.Keyspace = &tsopb.RequestHeader_KeyspaceId{ + KeyspaceId: keyspaceID, + } + } tsoClient := tsopb.NewTSOClient(cc) var ( keyspaceGroup *tsopb.KeyspaceGroup @@ -660,11 +668,13 @@ func (c *tsoServiceDiscovery) findGroupByKeyspaceID( findErr error ) if c.keyspaceIdentity != nil { - resp, err := tsoClient.FindGroupByKeyspace( - ctx, &tsopb.FindGroupByKeyspaceRequest{ - Header: header, - KeyspaceIdentity: cloneKeyspaceIdentity(c.keyspaceIdentity), - ModRevision: modRevision, + resp, err := tsoClient.FindGroupByKeyspaceID( + ctx, &tsopb.FindGroupByKeyspaceIDRequest{ + Header: header, + Keyspace: &tsopb.FindGroupByKeyspaceIDRequest_KeyspaceIdentity{ + KeyspaceIdentity: cloneKeyspaceIdentity(c.keyspaceIdentity), + }, + ModRevision: modRevision, }) findErr = err if resp != nil { @@ -675,8 +685,10 @@ func (c *tsoServiceDiscovery) findGroupByKeyspaceID( } else { resp, err := tsoClient.FindGroupByKeyspaceID( ctx, &tsopb.FindGroupByKeyspaceIDRequest{ - Header: header, - KeyspaceId: keyspaceID, + Header: header, + Keyspace: &tsopb.FindGroupByKeyspaceIDRequest_KeyspaceId{ + KeyspaceId: keyspaceID, + }, ModRevision: modRevision, }) findErr = err From 01329a3b15e5fb2443f52de9424adb6085af311c Mon Sep 17 00:00:00 2001 From: disksing Date: Tue, 30 Jun 2026 15:32:57 +0800 Subject: [PATCH 04/17] Update APIV3 kvproto dependency Signed-off-by: disksing --- client/go.mod | 2 +- client/go.sum | 4 ++-- client/keyspace_client_test.go | 6 +++--- go.mod | 2 +- go.sum | 4 ++-- tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 ++-- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/client/go.mod b/client/go.mod index 99f4684b8a5..e947a46863a 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260611143855-3566665c9104 + github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 diff --git a/client/go.sum b/client/go.sum index d1ae89ecddb..13e620a1a77 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260611143855-3566665c9104 h1:sNjYPcGD6V+CZl3Txt1b+VQkX6KkJXk8AxBUDizPZVo= -github.com/pingcap/kvproto v0.0.0-20260611143855-3566665c9104/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 h1:ADLAQh5Ij75HFiD5Y3JKkN7qS9FahmdgjuJ3qxKEYlY= +github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/client/keyspace_client_test.go b/client/keyspace_client_test.go index 4d3ca0deaca..2ab9e80244a 100644 --- a/client/keyspace_client_test.go +++ b/client/keyspace_client_test.go @@ -114,9 +114,9 @@ func TestLoadKeyspaceByID(t *testing.T) { re := require.New(t) ctx := context.Background() expected := &keyspacepb.KeyspaceMeta{ - Id: 42, - Name: "test-keyspace", - State: keyspacepb.KeyspaceState_ENABLED, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 42}, + Name: "test-keyspace", + State: keyspacepb.KeyspaceState_ENABLED, } keyspaceServer := &testKeyspaceServer{meta: expected} addr, cleanup := startTestKeyspaceServer(t, keyspaceServer) diff --git a/go.mod b/go.mod index 8485ba4f7d9..5497c7ce996 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/pingcap/errcode v0.3.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260622063236-b41e86365ce0 + github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/metering_sdk v0.0.0-20260203082503-b9f282339654 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 diff --git a/go.sum b/go.sum index 217d222f916..0f3817a5b24 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260622063236-b41e86365ce0 h1:MalBpLjhK/cS9ndCoSAg2C7aBzVojAqFVfzTKmuy0ho= -github.com/pingcap/kvproto v0.0.0-20260622063236-b41e86365ce0/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 h1:ADLAQh5Ij75HFiD5Y3JKkN7qS9FahmdgjuJ3qxKEYlY= +github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index a0a42b0aa8f..eafc74669a6 100644 --- a/tests/integrations/go.mod +++ b/tests/integrations/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260622063236-b41e86365ce0 + github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/tests/integrations/go.sum b/tests/integrations/go.sum index 1dc8d3d220d..39981014d42 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -473,8 +473,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260622063236-b41e86365ce0 h1:MalBpLjhK/cS9ndCoSAg2C7aBzVojAqFVfzTKmuy0ho= -github.com/pingcap/kvproto v0.0.0-20260622063236-b41e86365ce0/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 h1:ADLAQh5Ij75HFiD5Y3JKkN7qS9FahmdgjuJ3qxKEYlY= +github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tools/go.mod b/tools/go.mod index 9b09abe5a39..be94a403704 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -23,7 +23,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260622063236-b41e86365ce0 + github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang v1.20.5 diff --git a/tools/go.sum b/tools/go.sum index 08164908997..c0648bb8087 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -478,8 +478,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260622063236-b41e86365ce0 h1:MalBpLjhK/cS9ndCoSAg2C7aBzVojAqFVfzTKmuy0ho= -github.com/pingcap/kvproto v0.0.0-20260622063236-b41e86365ce0/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 h1:ADLAQh5Ij75HFiD5Y3JKkN7qS9FahmdgjuJ3qxKEYlY= +github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= From 6a988df46ea5e92cebab15d5748369c66ec03192 Mon Sep 17 00:00:00 2001 From: disksing Date: Tue, 30 Jun 2026 15:37:52 +0800 Subject: [PATCH 05/17] Bump APIV3 kvproto after client-go sync Signed-off-by: disksing --- client/go.mod | 2 +- client/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 ++-- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/go.mod b/client/go.mod index e947a46863a..3a23e025b27 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 + github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 diff --git a/client/go.sum b/client/go.sum index 13e620a1a77..d53fe263034 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 h1:ADLAQh5Ij75HFiD5Y3JKkN7qS9FahmdgjuJ3qxKEYlY= -github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f h1:skWUH+QXkckaSQtjq4g6cxhKrJuHpVoj8qen6ryTP3o= +github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/go.mod b/go.mod index 5497c7ce996..ced7b53515d 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/pingcap/errcode v0.3.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 + github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/metering_sdk v0.0.0-20260203082503-b9f282339654 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 diff --git a/go.sum b/go.sum index 0f3817a5b24..9ea2dfbfd8d 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 h1:ADLAQh5Ij75HFiD5Y3JKkN7qS9FahmdgjuJ3qxKEYlY= -github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f h1:skWUH+QXkckaSQtjq4g6cxhKrJuHpVoj8qen6ryTP3o= +github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index eafc74669a6..ae6d66eca60 100644 --- a/tests/integrations/go.mod +++ b/tests/integrations/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 + github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/tests/integrations/go.sum b/tests/integrations/go.sum index 39981014d42..4cb223131ad 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -473,8 +473,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 h1:ADLAQh5Ij75HFiD5Y3JKkN7qS9FahmdgjuJ3qxKEYlY= -github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f h1:skWUH+QXkckaSQtjq4g6cxhKrJuHpVoj8qen6ryTP3o= +github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tools/go.mod b/tools/go.mod index be94a403704..df059ad12b2 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -23,7 +23,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 + github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang v1.20.5 diff --git a/tools/go.sum b/tools/go.sum index c0648bb8087..b3e03bd97c5 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -478,8 +478,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96 h1:ADLAQh5Ij75HFiD5Y3JKkN7qS9FahmdgjuJ3qxKEYlY= -github.com/pingcap/kvproto v0.0.0-20260630073048-2aab4d2c4b96/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f h1:skWUH+QXkckaSQtjq4g6cxhKrJuHpVoj8qen6ryTP3o= +github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= From 129846144d69afe27b459b181be28a659cc3d125 Mon Sep 17 00:00:00 2001 From: disksing Date: Tue, 30 Jun 2026 15:43:28 +0800 Subject: [PATCH 06/17] Bump APIV3 kvproto for request origin Signed-off-by: disksing --- client/go.mod | 2 +- client/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 ++-- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/go.mod b/client/go.mod index 3a23e025b27..a4ba67d64ee 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f + github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 diff --git a/client/go.sum b/client/go.sum index d53fe263034..e644202976a 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f h1:skWUH+QXkckaSQtjq4g6cxhKrJuHpVoj8qen6ryTP3o= -github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 h1:UMa8GAEMvG7OURMrjX13hfcSzDnn4wqB37Ln4q91kLg= +github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/go.mod b/go.mod index ced7b53515d..d6c7a6d5048 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/pingcap/errcode v0.3.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f + github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/metering_sdk v0.0.0-20260203082503-b9f282339654 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 diff --git a/go.sum b/go.sum index 9ea2dfbfd8d..503aec10694 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f h1:skWUH+QXkckaSQtjq4g6cxhKrJuHpVoj8qen6ryTP3o= -github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 h1:UMa8GAEMvG7OURMrjX13hfcSzDnn4wqB37Ln4q91kLg= +github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index ae6d66eca60..c335f888980 100644 --- a/tests/integrations/go.mod +++ b/tests/integrations/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f + github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/tests/integrations/go.sum b/tests/integrations/go.sum index 4cb223131ad..446288504a6 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -473,8 +473,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f h1:skWUH+QXkckaSQtjq4g6cxhKrJuHpVoj8qen6ryTP3o= -github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 h1:UMa8GAEMvG7OURMrjX13hfcSzDnn4wqB37Ln4q91kLg= +github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tools/go.mod b/tools/go.mod index df059ad12b2..afc5bfd6a67 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -23,7 +23,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f + github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang v1.20.5 diff --git a/tools/go.sum b/tools/go.sum index b3e03bd97c5..9f8d07bee14 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -478,8 +478,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f h1:skWUH+QXkckaSQtjq4g6cxhKrJuHpVoj8qen6ryTP3o= -github.com/pingcap/kvproto v0.0.0-20260630073522-cb308be8cc4f/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 h1:UMa8GAEMvG7OURMrjX13hfcSzDnn4wqB37Ln4q91kLg= +github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= From 6a84fbc0a17d42a2b66ee238ac82cb372eeca0d0 Mon Sep 17 00:00:00 2001 From: disksing Date: Tue, 30 Jun 2026 15:49:24 +0800 Subject: [PATCH 07/17] Bump APIV3 kvproto for client-go compatibility Signed-off-by: disksing --- client/go.mod | 2 +- client/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 ++-- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/go.mod b/client/go.mod index a4ba67d64ee..653dadfe444 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 + github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 diff --git a/client/go.sum b/client/go.sum index e644202976a..daf0a03ec88 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 h1:UMa8GAEMvG7OURMrjX13hfcSzDnn4wqB37Ln4q91kLg= -github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 h1:bu/I8ght7XPLOqdndPU8PekKBrzo5xTPu8FLOaKh8Y8= +github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/go.mod b/go.mod index d6c7a6d5048..fc07435069f 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/pingcap/errcode v0.3.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 + github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/metering_sdk v0.0.0-20260203082503-b9f282339654 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 diff --git a/go.sum b/go.sum index 503aec10694..b24a7aedacb 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 h1:UMa8GAEMvG7OURMrjX13hfcSzDnn4wqB37Ln4q91kLg= -github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 h1:bu/I8ght7XPLOqdndPU8PekKBrzo5xTPu8FLOaKh8Y8= +github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index c335f888980..f313fc28a1e 100644 --- a/tests/integrations/go.mod +++ b/tests/integrations/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 + github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/tests/integrations/go.sum b/tests/integrations/go.sum index 446288504a6..0185f4bf289 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -473,8 +473,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 h1:UMa8GAEMvG7OURMrjX13hfcSzDnn4wqB37Ln4q91kLg= -github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 h1:bu/I8ght7XPLOqdndPU8PekKBrzo5xTPu8FLOaKh8Y8= +github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tools/go.mod b/tools/go.mod index afc5bfd6a67..50a36a72a0c 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -23,7 +23,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 + github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang v1.20.5 diff --git a/tools/go.sum b/tools/go.sum index 9f8d07bee14..fc43f404925 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -478,8 +478,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769 h1:UMa8GAEMvG7OURMrjX13hfcSzDnn4wqB37Ln4q91kLg= -github.com/pingcap/kvproto v0.0.0-20260630074108-97976be60769/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 h1:bu/I8ght7XPLOqdndPU8PekKBrzo5xTPu8FLOaKh8Y8= +github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= From d678f56b9373c92d2fc1aa5e6dd2f8672de201e4 Mon Sep 17 00:00:00 2001 From: disksing Date: Tue, 30 Jun 2026 15:54:19 +0800 Subject: [PATCH 08/17] Bump APIV3 kvproto for latest client-go fields Signed-off-by: disksing --- client/go.mod | 2 +- client/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 ++-- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/go.mod b/client/go.mod index 653dadfe444..b4dd7a879b8 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 + github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 diff --git a/client/go.sum b/client/go.sum index daf0a03ec88..1154bfdac9c 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 h1:bu/I8ght7XPLOqdndPU8PekKBrzo5xTPu8FLOaKh8Y8= -github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d h1:xbdYApJxTu4qCNAddpR4cLqU7ryM+M9icDZhwQEJzug= +github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/go.mod b/go.mod index fc07435069f..d2f85013611 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/pingcap/errcode v0.3.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 + github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/metering_sdk v0.0.0-20260203082503-b9f282339654 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 diff --git a/go.sum b/go.sum index b24a7aedacb..afb51979e4f 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 h1:bu/I8ght7XPLOqdndPU8PekKBrzo5xTPu8FLOaKh8Y8= -github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d h1:xbdYApJxTu4qCNAddpR4cLqU7ryM+M9icDZhwQEJzug= +github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index f313fc28a1e..e7ba4b59ff3 100644 --- a/tests/integrations/go.mod +++ b/tests/integrations/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 + github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/tests/integrations/go.sum b/tests/integrations/go.sum index 0185f4bf289..497419ff091 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -473,8 +473,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 h1:bu/I8ght7XPLOqdndPU8PekKBrzo5xTPu8FLOaKh8Y8= -github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d h1:xbdYApJxTu4qCNAddpR4cLqU7ryM+M9icDZhwQEJzug= +github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tools/go.mod b/tools/go.mod index 50a36a72a0c..18f07e452b5 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -23,7 +23,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 + github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang v1.20.5 diff --git a/tools/go.sum b/tools/go.sum index fc43f404925..f4e87e58bc3 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -478,8 +478,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68 h1:bu/I8ght7XPLOqdndPU8PekKBrzo5xTPu8FLOaKh8Y8= -github.com/pingcap/kvproto v0.0.0-20260630074726-edbd86e08a68/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d h1:xbdYApJxTu4qCNAddpR4cLqU7ryM+M9icDZhwQEJzug= +github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= From ca46ac3e79e590fa42c0a71092e2180fa15dea91 Mon Sep 17 00:00:00 2001 From: disksing Date: Tue, 30 Jun 2026 16:00:20 +0800 Subject: [PATCH 09/17] Bump APIV3 kvproto for mockstore sync Signed-off-by: disksing --- client/go.mod | 2 +- client/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 ++-- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/go.mod b/client/go.mod index b4dd7a879b8..0bbfeed96c9 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d + github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 diff --git a/client/go.sum b/client/go.sum index 1154bfdac9c..62ea997dc46 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d h1:xbdYApJxTu4qCNAddpR4cLqU7ryM+M9icDZhwQEJzug= -github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce h1:EO5cYY5GqjaedbIImR7BL6P3gCOkUJ7nu9ApkLLP9kM= +github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/go.mod b/go.mod index d2f85013611..91cdbfe840e 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/pingcap/errcode v0.3.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d + github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/metering_sdk v0.0.0-20260203082503-b9f282339654 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 diff --git a/go.sum b/go.sum index afb51979e4f..5ccb09c83ea 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d h1:xbdYApJxTu4qCNAddpR4cLqU7ryM+M9icDZhwQEJzug= -github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce h1:EO5cYY5GqjaedbIImR7BL6P3gCOkUJ7nu9ApkLLP9kM= +github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index e7ba4b59ff3..0adae481786 100644 --- a/tests/integrations/go.mod +++ b/tests/integrations/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d + github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/tests/integrations/go.sum b/tests/integrations/go.sum index 497419ff091..f28ca68d955 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -473,8 +473,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d h1:xbdYApJxTu4qCNAddpR4cLqU7ryM+M9icDZhwQEJzug= -github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce h1:EO5cYY5GqjaedbIImR7BL6P3gCOkUJ7nu9ApkLLP9kM= +github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tools/go.mod b/tools/go.mod index 18f07e452b5..fe6627801b7 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -23,7 +23,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d + github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang v1.20.5 diff --git a/tools/go.sum b/tools/go.sum index f4e87e58bc3..0c2a51a186f 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -478,8 +478,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d h1:xbdYApJxTu4qCNAddpR4cLqU7ryM+M9icDZhwQEJzug= -github.com/pingcap/kvproto v0.0.0-20260630075339-75ecdbe2473d/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce h1:EO5cYY5GqjaedbIImR7BL6P3gCOkUJ7nu9ApkLLP9kM= +github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= From de0d6e82573380eb2f9360ecb6ec54b8746e59f8 Mon Sep 17 00:00:00 2001 From: disksing Date: Tue, 30 Jun 2026 16:07:29 +0800 Subject: [PATCH 10/17] Bump APIV3 kvproto for TiCI estimate count Signed-off-by: disksing --- client/go.mod | 2 +- client/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 ++-- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/go.mod b/client/go.mod index 0bbfeed96c9..96150adc7e0 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce + github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 diff --git a/client/go.sum b/client/go.sum index 62ea997dc46..3455b0a31f5 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce h1:EO5cYY5GqjaedbIImR7BL6P3gCOkUJ7nu9ApkLLP9kM= -github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb h1:DttW0t8mMW2TYoGflOV1gOIUkd7qRbnaTNS0qQj7dzo= +github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/go.mod b/go.mod index 91cdbfe840e..f0876920c87 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/pingcap/errcode v0.3.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce + github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/metering_sdk v0.0.0-20260203082503-b9f282339654 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 diff --git a/go.sum b/go.sum index 5ccb09c83ea..e7d55a545f0 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce h1:EO5cYY5GqjaedbIImR7BL6P3gCOkUJ7nu9ApkLLP9kM= -github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb h1:DttW0t8mMW2TYoGflOV1gOIUkd7qRbnaTNS0qQj7dzo= +github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index 0adae481786..c1cddc5b205 100644 --- a/tests/integrations/go.mod +++ b/tests/integrations/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce + github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/tests/integrations/go.sum b/tests/integrations/go.sum index f28ca68d955..4a9e2df3536 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -473,8 +473,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce h1:EO5cYY5GqjaedbIImR7BL6P3gCOkUJ7nu9ApkLLP9kM= -github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb h1:DttW0t8mMW2TYoGflOV1gOIUkd7qRbnaTNS0qQj7dzo= +github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tools/go.mod b/tools/go.mod index fe6627801b7..9591dc4d2d8 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -23,7 +23,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce + github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang v1.20.5 diff --git a/tools/go.sum b/tools/go.sum index 0c2a51a186f..dd6f3abb161 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -478,8 +478,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce h1:EO5cYY5GqjaedbIImR7BL6P3gCOkUJ7nu9ApkLLP9kM= -github.com/pingcap/kvproto v0.0.0-20260630075800-a0891f1b18ce/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb h1:DttW0t8mMW2TYoGflOV1gOIUkd7qRbnaTNS0qQj7dzo= +github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= From 425af4339e3f0b0f71baf97651936a3ff60ec602 Mon Sep 17 00:00:00 2001 From: disksing Date: Wed, 8 Jul 2026 11:25:17 +0800 Subject: [PATCH 11/17] Update APIV3 kvproto dependency --- client/go.mod | 2 +- client/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- pkg/keyspace/keyspace_test.go | 29 +++++++++++++---------------- pkg/keyspace/util_test.go | 26 +++++--------------------- tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 ++-- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 10 files changed, 30 insertions(+), 49 deletions(-) diff --git a/client/go.mod b/client/go.mod index 96150adc7e0..4d52e7b86f5 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb + github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 diff --git a/client/go.sum b/client/go.sum index 3455b0a31f5..7f1eeaa2253 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb h1:DttW0t8mMW2TYoGflOV1gOIUkd7qRbnaTNS0qQj7dzo= -github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb h1:AlDoRaIvnfSk7CnKmgOX5CZkRGBbJqoCjdR+IyyR9Ro= +github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/go.mod b/go.mod index ebf2353d148..57a891261e8 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/pingcap/errcode v0.3.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb + github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/metering_sdk v0.0.0-20260203082503-b9f282339654 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 diff --git a/go.sum b/go.sum index ca23b1eb814..68cf80ce79b 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb h1:DttW0t8mMW2TYoGflOV1gOIUkd7qRbnaTNS0qQj7dzo= -github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb h1:AlDoRaIvnfSk7CnKmgOX5CZkRGBbJqoCjdR+IyyR9Ro= +github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/pkg/keyspace/keyspace_test.go b/pkg/keyspace/keyspace_test.go index 3223d9b1b69..e6852d0aabf 100644 --- a/pkg/keyspace/keyspace_test.go +++ b/pkg/keyspace/keyspace_test.go @@ -33,6 +33,8 @@ import ( "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/keyspace/constant" + "github.com/tikv/pd/pkg/mock/mockcluster" + "github.com/tikv/pd/pkg/mock/mockconfig" "github.com/tikv/pd/pkg/mock/mockid" "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/storage/kv" @@ -102,7 +104,8 @@ func (suite *keyspaceTestSuite) SetupTest() { store := endpoint.NewStorageEndpoint(kv.NewMemoryKV(), nil) allocator := mockid.NewIDAllocator() kgm := NewKeyspaceGroupManager(suite.ctx, store, nil) - suite.manager = NewKeyspaceManager(suite.ctx, store, nil, allocator, &mockConfig{}, kgm, nil) + cluster := mockcluster.NewCluster(suite.ctx, mockconfig.NewTestOptions()) + suite.manager = NewKeyspaceManager(suite.ctx, store, cluster, allocator, &mockConfig{}, kgm, nil) re.NoError(kgm.Bootstrap(suite.ctx)) re.NoError(suite.manager.Bootstrap()) } @@ -250,28 +253,21 @@ func (suite *keyspaceTestSuite) TestGCManagementTypeDefaultValue() { manager := suite.manager now := time.Now().Unix() - const classic = `return(false)` - const nextGen = `return(true)` - type testCase struct { - nextGenFlag string gcManagementType string expect string } + defaultGCManagementType := "" + if kerneltype.IsNextGen() { + defaultGCManagementType = KeyspaceLevelGC + } cases := []testCase{ - {classic, "", ""}, - {classic, UnifiedGC, UnifiedGC}, - {classic, KeyspaceLevelGC, KeyspaceLevelGC}, - {nextGen, "", KeyspaceLevelGC}, - {nextGen, UnifiedGC, UnifiedGC}, - {classic, KeyspaceLevelGC, KeyspaceLevelGC}, + {"", defaultGCManagementType}, + {UnifiedGC, UnifiedGC}, + {KeyspaceLevelGC, KeyspaceLevelGC}, } - defer func() { - re.NoError(failpoint.Disable("github.com/tikv/pd/pkg/versioninfo/kerneltype/mockNextGenBuildFlag")) - }() for idx, tc := range cases { - re.NoError(failpoint.Enable("github.com/tikv/pd/pkg/versioninfo/kerneltype/mockNextGenBuildFlag", tc.nextGenFlag)) cfg := make(map[string]string) if tc.gcManagementType != "" { cfg[GCManagementType] = tc.gcManagementType @@ -958,7 +954,8 @@ func TestIterateKeyspaces(t *testing.T) { store := endpoint.NewStorageEndpoint(kv.NewMemoryKV(), nil) allocator := mockid.NewIDAllocator() kgm := NewKeyspaceGroupManager(ctx, store, nil) - manager := NewKeyspaceManager(ctx, store, nil, allocator, &mockConfig{}, kgm, nil) + cluster := mockcluster.NewCluster(ctx, mockconfig.NewTestOptions()) + manager := NewKeyspaceManager(ctx, store, cluster, allocator, &mockConfig{}, kgm, nil) re.NoError(kgm.Bootstrap(ctx)) re.NoError(manager.Bootstrap()) diff --git a/pkg/keyspace/util_test.go b/pkg/keyspace/util_test.go index e30a8488313..a85f6fa0943 100644 --- a/pkg/keyspace/util_test.go +++ b/pkg/keyspace/util_test.go @@ -23,8 +23,6 @@ import ( "github.com/stretchr/testify/require" - "github.com/pingcap/failpoint" - "github.com/tikv/pd/pkg/codec" coreconstant "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/keyspace/constant" @@ -207,37 +205,23 @@ func TestValidateName(t *testing.T) { func TestProtectedKeyspaceValidation(t *testing.T) { re := require.New(t) - defer func() { - re.NoError(failpoint.Disable("github.com/tikv/pd/pkg/versioninfo/kerneltype/mockNextGenBuildFlag")) - }() - const classic = `return(false)` - const nextGen = `return(true)` cases := []struct { name string - nextGenFlag string idToTest uint32 nameToTest string expectErrID bool expectErrName bool }{ - // classic - {"classic_default_id", classic, constant.DefaultKeyspaceID, "", true, false}, - {"classic_default_name", classic, 1, constant.DefaultKeyspaceName, false, true}, - {"classic_system_id_allowed", classic, constant.SystemKeyspaceID, "", false, false}, - {"classic_system_name_allowed", classic, 1, constant.SystemKeyspaceName, false, false}, - {"classic_normal_case", classic, 100, "normal_keyspace", false, false}, - // next-gen - {"nextgen_system_id", nextGen, constant.SystemKeyspaceID, "", true, false}, - {"nextgen_system_name", nextGen, 1, constant.SystemKeyspaceName, false, true}, - {"nextgen_default_id_allowed", nextGen, constant.DefaultKeyspaceID, "", false, false}, - {"nextgen_default_name_allowed", nextGen, 1, constant.DefaultKeyspaceName, false, false}, - {"nextgen_normal_case", nextGen, 100, "normal_keyspace", false, false}, + {"default_id", constant.DefaultKeyspaceID, "", !kerneltype.IsNextGen(), false}, + {"default_name", 1, constant.DefaultKeyspaceName, false, !kerneltype.IsNextGen()}, + {"system_id", constant.SystemKeyspaceID, "", kerneltype.IsNextGen(), false}, + {"system_name", 1, constant.SystemKeyspaceName, false, kerneltype.IsNextGen()}, + {"normal_case", 100, "normal_keyspace", false, false}, } for _, c := range cases { t.Run(c.name, func(_ *testing.T) { - re.NoError(failpoint.Enable("github.com/tikv/pd/pkg/versioninfo/kerneltype/mockNextGenBuildFlag", c.nextGenFlag)) errID := validateID(c.idToTest) if c.expectErrID { re.Error(errID) diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index 66202c132db..a7e47473bf4 100644 --- a/tests/integrations/go.mod +++ b/tests/integrations/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb + github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/tests/integrations/go.sum b/tests/integrations/go.sum index 26e7f7d0729..4d03fa38762 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -473,8 +473,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb h1:DttW0t8mMW2TYoGflOV1gOIUkd7qRbnaTNS0qQj7dzo= -github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb h1:AlDoRaIvnfSk7CnKmgOX5CZkRGBbJqoCjdR+IyyR9Ro= +github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tools/go.mod b/tools/go.mod index 09f0d25cc29..cd35947b5b3 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -23,7 +23,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb + github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang v1.20.5 diff --git a/tools/go.sum b/tools/go.sum index a64d80093a2..2c4046ef4d3 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -478,8 +478,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb h1:DttW0t8mMW2TYoGflOV1gOIUkd7qRbnaTNS0qQj7dzo= -github.com/pingcap/kvproto v0.0.0-20260630080527-b4ca3f1805fb/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb h1:AlDoRaIvnfSk7CnKmgOX5CZkRGBbJqoCjdR+IyyR9Ro= +github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= From 9d454233bd458b8eae22263c215dc23a40ab60d8 Mon Sep 17 00:00:00 2001 From: disksing Date: Wed, 8 Jul 2026 11:33:15 +0800 Subject: [PATCH 12/17] Fix APIV3 keyspace meta compatibility in client --- client/http/types.go | 2 +- client/keyspace_client.go | 2 +- client/keyspace_client_test.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/http/types.go b/client/http/types.go index c6764978795..9b26f889509 100644 --- a/client/http/types.go +++ b/client/http/types.go @@ -704,7 +704,7 @@ func (meta *tempKeyspaceMeta) toPB() (*keyspacepb.KeyspaceMeta, error) { return &keyspacepb.KeyspaceMeta{ Name: meta.Name, - Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: meta.ID}, + Id: meta.ID, Config: meta.Config, CreatedAt: meta.CreatedAt, StateChangedAt: meta.StateChangedAt, diff --git a/client/keyspace_client.go b/client/keyspace_client.go index 9d34b18897e..3f2b4f8443b 100644 --- a/client/keyspace_client.go +++ b/client/keyspace_client.go @@ -68,7 +68,7 @@ func (c *client) LoadKeyspace(ctx context.Context, name string) (*keyspacepb.Key // Create a hardcoded keyspace meta for keyspace_1 now := time.Now().Unix() mockKeyspaceMeta := &keyspacepb.KeyspaceMeta{ - Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 1}, + Id: 1, Name: name, CreatedAt: now, StateChangedAt: now, diff --git a/client/keyspace_client_test.go b/client/keyspace_client_test.go index 2ab9e80244a..4d3ca0deaca 100644 --- a/client/keyspace_client_test.go +++ b/client/keyspace_client_test.go @@ -114,9 +114,9 @@ func TestLoadKeyspaceByID(t *testing.T) { re := require.New(t) ctx := context.Background() expected := &keyspacepb.KeyspaceMeta{ - Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 42}, - Name: "test-keyspace", - State: keyspacepb.KeyspaceState_ENABLED, + Id: 42, + Name: "test-keyspace", + State: keyspacepb.KeyspaceState_ENABLED, } keyspaceServer := &testKeyspaceServer{meta: expected} addr, cleanup := startTestKeyspaceServer(t, keyspaceServer) From a8622f626f6f0a11b66fd310d72e5b4efcd8682f Mon Sep 17 00:00:00 2001 From: disksing Date: Wed, 8 Jul 2026 11:46:06 +0800 Subject: [PATCH 13/17] Update APIV3 kvproto AutoID compatibility --- client/go.mod | 2 +- client/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 ++-- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/go.mod b/client/go.mod index 4d52e7b86f5..07e203f3fd5 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb + github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.9.0 diff --git a/client/go.sum b/client/go.sum index 7f1eeaa2253..5e09434ddef 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb h1:AlDoRaIvnfSk7CnKmgOX5CZkRGBbJqoCjdR+IyyR9Ro= -github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff h1:kt7e4oQ9e1s2nMR7UkBJpmxrhi59vRrOE5kNY6TMRks= +github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/go.mod b/go.mod index 57a891261e8..e60e70c732b 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/pingcap/errcode v0.3.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb + github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/metering_sdk v0.0.0-20260203082503-b9f282339654 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 diff --git a/go.sum b/go.sum index 68cf80ce79b..907e4f56ac4 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb h1:AlDoRaIvnfSk7CnKmgOX5CZkRGBbJqoCjdR+IyyR9Ro= -github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff h1:kt7e4oQ9e1s2nMR7UkBJpmxrhi59vRrOE5kNY6TMRks= +github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index a7e47473bf4..be13842ffd3 100644 --- a/tests/integrations/go.mod +++ b/tests/integrations/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb + github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/tests/integrations/go.sum b/tests/integrations/go.sum index 4d03fa38762..e1ce0012999 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -473,8 +473,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb h1:AlDoRaIvnfSk7CnKmgOX5CZkRGBbJqoCjdR+IyyR9Ro= -github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff h1:kt7e4oQ9e1s2nMR7UkBJpmxrhi59vRrOE5kNY6TMRks= +github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tools/go.mod b/tools/go.mod index cd35947b5b3..5da0c72b28d 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -23,7 +23,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb + github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang v1.20.5 diff --git a/tools/go.sum b/tools/go.sum index 2c4046ef4d3..bf6b3caf2e9 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -478,8 +478,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb h1:AlDoRaIvnfSk7CnKmgOX5CZkRGBbJqoCjdR+IyyR9Ro= -github.com/pingcap/kvproto v0.0.0-20260708031257-57eabd0545bb/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff h1:kt7e4oQ9e1s2nMR7UkBJpmxrhi59vRrOE5kNY6TMRks= +github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= From 74035dba1454bc2f1836548ae196ca2df0735b64 Mon Sep 17 00:00:00 2001 From: disksing Date: Wed, 8 Jul 2026 12:41:46 +0800 Subject: [PATCH 14/17] fix: adapt pd server to keyspace proto oneofs --- pkg/utils/tsoutil/tso_proto_factory.go | 4 +++- server/forward.go | 8 ++++++-- server/gc_service.go | 8 ++++++-- server/keyspace_service.go | 3 ++- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pkg/utils/tsoutil/tso_proto_factory.go b/pkg/utils/tsoutil/tso_proto_factory.go index 6da54dc8b52..37b1b0a2b00 100644 --- a/pkg/utils/tsoutil/tso_proto_factory.go +++ b/pkg/utils/tsoutil/tso_proto_factory.go @@ -70,8 +70,10 @@ func (s *tsoStream) process(clusterID uint64, count, keyspaceID, keyspaceGroupID req := &tsopb.TsoRequest{ Header: &tsopb.RequestHeader{ ClusterId: clusterID, - KeyspaceId: keyspaceID, KeyspaceGroupId: keyspaceGroupID, + Keyspace: &tsopb.RequestHeader_KeyspaceId{ + KeyspaceId: keyspaceID, + }, }, Count: count, } diff --git a/server/forward.go b/server/forward.go index a5d97bfe81e..aeb739c4c01 100644 --- a/server/forward.go +++ b/server/forward.go @@ -128,8 +128,10 @@ func (f *tsoForwarder) forwardTSORequest( Header: &tsopb.RequestHeader{ ClusterId: request.GetHeader().GetClusterId(), SenderId: request.GetHeader().GetSenderId(), - KeyspaceId: keyspace.GetBootstrapKeyspaceID(), KeyspaceGroupId: constant.DefaultKeyspaceGroupID, + Keyspace: &tsopb.RequestHeader_KeyspaceId{ + KeyspaceId: keyspace.GetBootstrapKeyspaceID(), + }, }, Count: request.GetCount(), } @@ -482,8 +484,10 @@ func (s *GrpcServer) getGlobalTSO(ctx context.Context) (pdpb.Timestamp, error) { request := &tsopb.TsoRequest{ Header: &tsopb.RequestHeader{ ClusterId: keypath.ClusterID(), - KeyspaceId: keyspace.GetBootstrapKeyspaceID(), KeyspaceGroupId: constant.DefaultKeyspaceGroupID, + Keyspace: &tsopb.RequestHeader_KeyspaceId{ + KeyspaceId: keyspace.GetBootstrapKeyspaceID(), + }, }, Count: 1, } diff --git a/server/gc_service.go b/server/gc_service.go index 4a92a4d032b..6c07c474a68 100644 --- a/server/gc_service.go +++ b/server/gc_service.go @@ -456,8 +456,10 @@ func (s *GrpcServer) GetAllGCSafePointV2(ctx context.Context, request *pdpb.GetA continue } gcSafePoints = append(gcSafePoints, &pdpb.GCSafePointV2{ - KeyspaceId: gcState.KeyspaceID, GcSafePoint: gcState.GCSafePoint, + Keyspace: &pdpb.GCSafePointV2_KeyspaceId{ + KeyspaceId: gcState.KeyspaceID, + }, }) } @@ -520,7 +522,9 @@ func gcStateToProto(gcState gc.GCState, now time.Time) *pdpb.GCState { } return &pdpb.GCState{ KeyspaceScope: &pdpb.KeyspaceScope{ - KeyspaceId: gcState.KeyspaceID, + Keyspace: &pdpb.KeyspaceScope_KeyspaceId{ + KeyspaceId: gcState.KeyspaceID, + }, }, IsKeyspaceLevelGc: gcState.IsKeyspaceLevel, TxnSafePoint: gcState.TxnSafePoint, diff --git a/server/keyspace_service.go b/server/keyspace_service.go index 249d7e97fd3..6e1385a7601 100644 --- a/server/keyspace_service.go +++ b/server/keyspace_service.go @@ -34,6 +34,7 @@ import ( // KeyspaceServer wraps GrpcServer to provide keyspace service. type KeyspaceServer struct { + keyspacepb.UnimplementedKeyspaceServer *GrpcServer } @@ -202,7 +203,7 @@ func (s *KeyspaceServer) GetAllKeyspaces(_ context.Context, request *keyspacepb. } manager := s.GetKeyspaceManager() - keyspaces, err := manager.LoadRangeKeyspace(request.StartId, int(request.Limit)) + keyspaces, err := manager.LoadRangeKeyspace(request.GetStartId(), int(request.Limit)) if err != nil { return &keyspacepb.GetAllKeyspacesResponse{Header: getErrorHeader(err)}, nil } From 0b8977b87ce37db51f4d7f3964b758204cd47881 Mon Sep 17 00:00:00 2001 From: disksing Date: Wed, 15 Jul 2026 11:35:22 +0800 Subject: [PATCH 15/17] Fix failpoint-independent retry tests Signed-off-by: disksing --- pkg/keyspace/keyspace.go | 10 +++++++++- pkg/keyspace/keyspace_test.go | 14 ++++++-------- pkg/metering/writer.go | 13 +++++++++++-- pkg/metering/writer_test.go | 12 ++++-------- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/pkg/keyspace/keyspace.go b/pkg/keyspace/keyspace.go index 71536d9eb07..b9b301a10e7 100644 --- a/pkg/keyspace/keyspace.go +++ b/pkg/keyspace/keyspace.go @@ -1462,6 +1462,11 @@ func (manager *Manager) PatrolKeyspaceAssignment(startKeyspaceID, endKeyspaceID // This constant is public for test purposes. const IteratorLoadingBatchSize int = 100 +var ( + iteratorLoadingBatchSize = IteratorLoadingBatchSize + iteratorOnLoadRange func() +) + // Iterator iterates over all keyspaces. // Create this using keyspace.Manager.IterateKeyspaces, and use Next method for iteration. type Iterator struct { @@ -1513,10 +1518,13 @@ func (it *Iterator) loadBatch() error { var err error it.currentIndex = 0 - batchSize := IteratorLoadingBatchSize + batchSize := iteratorLoadingBatchSize failpoint.Inject("keyspaceIteratorLoadingBatchSize", func(val failpoint.Value) { batchSize = val.(int) }) + if iteratorOnLoadRange != nil { + iteratorOnLoadRange() + } failpoint.InjectCall("keyspaceIteratorOnLoadRange") it.currentBatch, err = it.manager.LoadRangeKeyspace(nextID, batchSize) if err != nil { diff --git a/pkg/keyspace/keyspace_test.go b/pkg/keyspace/keyspace_test.go index e6852d0aabf..b3edd9eb15b 100644 --- a/pkg/keyspace/keyspace_test.go +++ b/pkg/keyspace/keyspace_test.go @@ -984,12 +984,8 @@ func TestIterateKeyspaces(t *testing.T) { } loadRangeCounter := 0 - re.NoError(failpoint.EnableCall("github.com/tikv/pd/pkg/keyspace/keyspaceIteratorOnLoadRange", func() { - loadRangeCounter++ - })) - defer func() { - re.NoError(failpoint.Disable("github.com/tikv/pd/pkg/keyspace/keyspaceIteratorOnLoadRange")) - }() + iteratorOnLoadRange = func() { loadRangeCounter++ } + defer func() { iteratorOnLoadRange = nil }() it := manager.IterateKeyspaces() i := 0 @@ -1020,7 +1016,9 @@ func TestIterateKeyspaces(t *testing.T) { testWithKeyspaces(keyspaceIDs, keyspaceNames, expectedLoadRangeCount) } - re.NoError(failpoint.Enable("github.com/tikv/pd/pkg/keyspace/keyspaceIteratorLoadingBatchSize", "return(5)")) + prevIteratorLoadingBatchSize := iteratorLoadingBatchSize + iteratorLoadingBatchSize = 5 + defer func() { iteratorLoadingBatchSize = prevIteratorLoadingBatchSize }() testWithKeyspaces([]uint32{}, []string{}, 2) testWithKeyspaces([]uint32{1, 2}, []string{"ks1", "ks2"}, 2) @@ -1030,7 +1028,7 @@ func TestIterateKeyspaces(t *testing.T) { testWithNKeyspaces(1, 19, 2, 5) testWithNKeyspaces(100, 20, 2, 6) - re.NoError(failpoint.Disable("github.com/tikv/pd/pkg/keyspace/keyspaceIteratorLoadingBatchSize")) + iteratorLoadingBatchSize = IteratorLoadingBatchSize testWithNKeyspaces(1, 999, 1, 11) testWithNKeyspaces(1, 1000, 10, 12) diff --git a/pkg/metering/writer.go b/pkg/metering/writer.go index f6a67d3b956..b51a3994f7f 100644 --- a/pkg/metering/writer.go +++ b/pkg/metering/writer.go @@ -45,6 +45,8 @@ const ( writeRetryBaseDelay = time.Second ) +var mockWriteErrorHook func(attempt int) bool + // Collector collects events into records with caller-defined fields. type Collector interface { Category() string @@ -230,15 +232,22 @@ func (mw *Writer) flushMeteringData(ctx context.Context, ts int64) { for { attempt++ writeCtx, cancel := context.WithTimeout(ctx, flushTimeout) + mockWriteError := false // Inject mock write error for testing, value is the count to encounter error. failpoint.Inject("mockWriteError", func(val failpoint.Value) { baseDelay = time.Millisecond if val.(int) >= attempt { - cancel() + mockWriteError = true } }) + if mockWriteErrorHook != nil { + baseDelay = time.Millisecond + mockWriteError = mockWriteErrorHook(attempt) + } // Ensure the context is valid before writing. - if writeCtx.Err() != nil { + if mockWriteError { + err = errors.New("mock write error") + } else if writeCtx.Err() != nil { err = writeCtx.Err() } else { // TODO: write with pagination if needed. diff --git a/pkg/metering/writer_test.go b/pkg/metering/writer_test.go index bb6592aed3b..ef7323a58d3 100644 --- a/pkg/metering/writer_test.go +++ b/pkg/metering/writer_test.go @@ -16,7 +16,6 @@ package metering import ( "context" - "fmt" "sync" "testing" "time" @@ -25,7 +24,6 @@ import ( "go.uber.org/goleak" "go.uber.org/zap" - "github.com/pingcap/failpoint" "github.com/pingcap/metering_sdk/config" meteringreader "github.com/pingcap/metering_sdk/reader/metering" "github.com/pingcap/metering_sdk/storage" @@ -435,8 +433,9 @@ func TestMeteringDataReadWriteWithRetry(t *testing.T) { map[string]any{"id": 3, "value": "test3", "timestamp": time.Now().Unix()}, } - // Inject the mock write error with `writeMaxAttempts` times to make sure all the attempts fail. - re.NoError(failpoint.Enable("github.com/tikv/pd/pkg/metering/mockWriteError", fmt.Sprintf("return(%d)", writeMaxAttempts))) + prevMockWriteErrorHook := mockWriteErrorHook + mockWriteErrorHook = func(attempt int) bool { return attempt <= writeMaxAttempts } + defer func() { mockWriteErrorHook = prevMockWriteErrorHook }() ts := time.Now().Truncate(time.Minute).Unix() // Collect and flush the data. @@ -449,8 +448,7 @@ func TestMeteringDataReadWriteWithRetry(t *testing.T) { readData := readMeteringData(ctx, re, reader, category, ts) re.Empty(readData) - // Inject the mock write error with `writeMaxAttempts-1` times to make sure the last attempt will succeed. - re.NoError(failpoint.Enable("github.com/tikv/pd/pkg/metering/mockWriteError", fmt.Sprintf("return(%d)", writeMaxAttempts-1))) + mockWriteErrorHook = func(attempt int) bool { return attempt < writeMaxAttempts } // Collect and flush the data again. for _, data := range testData { @@ -465,6 +463,4 @@ func TestMeteringDataReadWriteWithRetry(t *testing.T) { // Verify the data content. verifyReadData(re, readData, testData) - - re.NoError(failpoint.Disable("github.com/tikv/pd/pkg/metering/mockWriteError")) } From 4a8a117d4638f55bbdfad16f801ea224103fd1f0 Mon Sep 17 00:00:00 2001 From: disksing Date: Mon, 20 Jul 2026 11:52:41 +0800 Subject: [PATCH 16/17] *: adapt to kvproto keyspace oneof Signed-off-by: disksing --- client/go.mod | 2 +- client/go.sum | 4 +- client/http/types.go | 2 +- client/keyspace_client.go | 2 +- client/keyspace_client_test.go | 6 +- go.mod | 2 +- go.sum | 4 +- pkg/gc/gc_state_manager.go | 6 +- pkg/gc/gc_state_manager_test.go | 8 +-- pkg/keyspace/keyspace.go | 30 ++++----- pkg/keyspace/keyspace_test.go | 62 +++++++++---------- .../resourcemanager/server/manager_test.go | 6 +- pkg/storage/keyspace_test.go | 12 ++-- server/apiv2/handlers/keyspace.go | 6 +- tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 +- .../resourcemanager/resource_manager_test.go | 10 +-- tests/server/apiv2/handlers/testutil.go | 2 +- tools/go.mod | 2 +- tools/go.sum | 4 +- 20 files changed, 88 insertions(+), 88 deletions(-) diff --git a/client/go.mod b/client/go.mod index c06bda5c4cd..16fe09f242f 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff + github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/client/go.sum b/client/go.sum index 5e09434ddef..9df50e882d1 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff h1:kt7e4oQ9e1s2nMR7UkBJpmxrhi59vRrOE5kNY6TMRks= -github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 h1:3YlDwVLfQ++7AkI3Y+AIuYvlNjaeateu8RvklEPzzBU= +github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/client/http/types.go b/client/http/types.go index 9b26f889509..c6764978795 100644 --- a/client/http/types.go +++ b/client/http/types.go @@ -704,7 +704,7 @@ func (meta *tempKeyspaceMeta) toPB() (*keyspacepb.KeyspaceMeta, error) { return &keyspacepb.KeyspaceMeta{ Name: meta.Name, - Id: meta.ID, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: meta.ID}, Config: meta.Config, CreatedAt: meta.CreatedAt, StateChangedAt: meta.StateChangedAt, diff --git a/client/keyspace_client.go b/client/keyspace_client.go index 3f2b4f8443b..9d34b18897e 100644 --- a/client/keyspace_client.go +++ b/client/keyspace_client.go @@ -68,7 +68,7 @@ func (c *client) LoadKeyspace(ctx context.Context, name string) (*keyspacepb.Key // Create a hardcoded keyspace meta for keyspace_1 now := time.Now().Unix() mockKeyspaceMeta := &keyspacepb.KeyspaceMeta{ - Id: 1, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 1}, Name: name, CreatedAt: now, StateChangedAt: now, diff --git a/client/keyspace_client_test.go b/client/keyspace_client_test.go index 4d3ca0deaca..2ab9e80244a 100644 --- a/client/keyspace_client_test.go +++ b/client/keyspace_client_test.go @@ -114,9 +114,9 @@ func TestLoadKeyspaceByID(t *testing.T) { re := require.New(t) ctx := context.Background() expected := &keyspacepb.KeyspaceMeta{ - Id: 42, - Name: "test-keyspace", - State: keyspacepb.KeyspaceState_ENABLED, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 42}, + Name: "test-keyspace", + State: keyspacepb.KeyspaceState_ENABLED, } keyspaceServer := &testKeyspaceServer{meta: expected} addr, cleanup := startTestKeyspaceServer(t, keyspaceServer) diff --git a/go.mod b/go.mod index e60e70c732b..251d07f0b5e 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/pingcap/errcode v0.3.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff + github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/metering_sdk v0.0.0-20260203082503-b9f282339654 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 diff --git a/go.sum b/go.sum index 907e4f56ac4..6ee2b7dc244 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff h1:kt7e4oQ9e1s2nMR7UkBJpmxrhi59vRrOE5kNY6TMRks= -github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 h1:3YlDwVLfQ++7AkI3Y+AIuYvlNjaeateu8RvklEPzzBU= +github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/pkg/gc/gc_state_manager.go b/pkg/gc/gc_state_manager.go index 3524ad36476..58b4f7bcaec 100644 --- a/pkg/gc/gc_state_manager.go +++ b/pkg/gc/gc_state_manager.go @@ -1033,7 +1033,7 @@ func (m *GCStateManager) iterateAllKeyspacesGCStates( if keyspaceMeta.Config[keyspace.GCManagementType] != keyspace.KeyspaceLevelGC { gcState := GCState{ - KeyspaceID: keyspaceMeta.Id, + KeyspaceID: keyspaceMeta.GetId(), IsKeyspaceLevel: false, } cb(gcState) @@ -1262,7 +1262,7 @@ func (m *GCStateManager) getMaxTxnSafePointAmongAllKeyspaces(_ *endpoint.GCState if keyspaceMeta.State != keyspacepb.KeyspaceState_ENABLED { continue } - txnSafePoint, err2 := m.gcMetaStorage.LoadTxnSafePoint(keyspaceMeta.Id) + txnSafePoint, err2 := m.gcMetaStorage.LoadTxnSafePoint(keyspaceMeta.GetId()) if err2 != nil { err = err2 return @@ -1270,7 +1270,7 @@ func (m *GCStateManager) getMaxTxnSafePointAmongAllKeyspaces(_ *endpoint.GCState if txnSafePoint > maxTxnSafePoint { maxTxnSafePoint = txnSafePoint keyspaceName = keyspaceMeta.Name - keyspaceID = keyspaceMeta.Id + keyspaceID = keyspaceMeta.GetId() } } // NOTE, allKeyspaces by LoadRangeKeyspace() do not contain the null keyspace! diff --git a/pkg/gc/gc_state_manager_test.go b/pkg/gc/gc_state_manager_test.go index 539e8d98e60..63cc9d1863a 100644 --- a/pkg/gc/gc_state_manager_test.go +++ b/pkg/gc/gc_state_manager_test.go @@ -168,7 +168,7 @@ func newGCStateManagerForTest(t testing.TB, opt newGCStateManagerForTestOptions) CreateTime: time.Now().Unix(), }) re.NoError(err) - re.Equal(uint32(1), ks1.Id) + re.Equal(uint32(1), ks1.GetId()) *id = 2 ks2, err := keyspaceManager.CreateKeyspaceByID(&keyspace.CreateKeyspaceByIDRequest{ @@ -178,7 +178,7 @@ func newGCStateManagerForTest(t testing.TB, opt newGCStateManagerForTestOptions) CreateTime: time.Now().Unix(), }) re.NoError(err) - re.Equal(uint32(2), ks2.Id) + re.Equal(uint32(2), ks2.GetId()) *id = 3 ks3, err := keyspaceManager.CreateKeyspaceByID(&keyspace.CreateKeyspaceByIDRequest{ @@ -188,7 +188,7 @@ func newGCStateManagerForTest(t testing.TB, opt newGCStateManagerForTestOptions) CreateTime: time.Now().Unix(), }) re.NoError(err) - re.Equal(uint32(3), ks3.Id) + re.Equal(uint32(3), ks3.GetId()) *id = 4 ks4, err := keyspaceManager.CreateKeyspaceByID(&keyspace.CreateKeyspaceByIDRequest{ @@ -200,7 +200,7 @@ func newGCStateManagerForTest(t testing.TB, opt newGCStateManagerForTestOptions) re.NoError(err) _, err = keyspaceManager.UpdateKeyspaceState("ks4", keyspacepb.KeyspaceState_DISABLED, time.Now().Unix()) re.NoError(err) - re.Equal(uint32(4), ks4.Id) + re.Equal(uint32(4), ks4.GetId()) } else { for _, req := range opt.specifyInitialKeyspaces { _, err := keyspaceManager.CreateKeyspaceByID(req) diff --git a/pkg/keyspace/keyspace.go b/pkg/keyspace/keyspace.go index b9b301a10e7..10c800dbfb8 100644 --- a/pkg/keyspace/keyspace.go +++ b/pkg/keyspace/keyspace.go @@ -217,7 +217,7 @@ func (manager *Manager) initReserveKeyspace(id uint32, name string) error { } now := time.Now().Unix() meta := &keyspacepb.KeyspaceMeta{ - Id: id, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: id}, Name: name, State: keyspacepb.KeyspaceState_ENABLED, CreatedAt: now, @@ -320,7 +320,7 @@ func (manager *Manager) CreateKeyspace(request *CreateKeyspaceRequest) (*keyspac // Create a disabled keyspace meta for tikv-server to get the config on keyspace split. keyspace := &keyspacepb.KeyspaceMeta{ - Id: newID, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: newID}, Name: request.Name, State: keyspacepb.KeyspaceState_DISABLED, CreatedAt: request.CreateTime, @@ -467,7 +467,7 @@ func (manager *Manager) CreateKeyspaceByID(request *CreateKeyspaceByIDRequest) ( } // Create a disabled keyspace meta for tikv-server to get the config on keyspace split. keyspace := &keyspacepb.KeyspaceMeta{ - Id: id, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: id}, Name: name, State: keyspacepb.KeyspaceState_DISABLED, CreatedAt: request.CreateTime, @@ -537,8 +537,8 @@ func (manager *Manager) CreateKeyspaceByID(request *CreateKeyspaceByIDRequest) ( } func (manager *Manager) saveNewKeyspace(keyspace *keyspacepb.KeyspaceMeta) error { - manager.metaLock.Lock(keyspace.Id) - defer manager.metaLock.Unlock(keyspace.Id) + manager.metaLock.Lock(keyspace.GetId()) + defer manager.metaLock.Unlock(keyspace.GetId()) return manager.store.RunInTxn(manager.ctx, func(txn kv.Txn) error { // Save keyspace ID. @@ -550,15 +550,15 @@ func (manager *Manager) saveNewKeyspace(keyspace *keyspacepb.KeyspaceMeta) error if nameExists { return errs.ErrKeyspaceExists } - err = manager.store.SaveKeyspaceID(txn, keyspace.Id, keyspace.Name) + err = manager.store.SaveKeyspaceID(txn, keyspace.GetId(), keyspace.Name) if err != nil { return err } // Update the keyspace name cache. - manager.keyspaceNameLookup.Store(keyspace.Id, keyspace.Name) + manager.keyspaceNameLookup.Store(keyspace.GetId(), keyspace.Name) // Save keyspace meta. // Check if keyspace with that id already exists. - loadedMeta, err := manager.store.LoadKeyspaceMeta(txn, keyspace.Id) + loadedMeta, err := manager.store.LoadKeyspaceMeta(txn, keyspace.GetId()) if err != nil { return err } @@ -1397,24 +1397,24 @@ func (manager *Manager) PatrolKeyspaceAssignment(startKeyspaceID, endKeyspaceID if ks == nil { continue } - if endKeyspaceID != 0 && ks.Id > endKeyspaceID { + if endKeyspaceID != 0 && ks.GetId() > endKeyspaceID { moreToPatrol = false break } patrolledKeyspaceCount++ - manager.metaLock.Lock(ks.Id) + manager.metaLock.Lock(ks.GetId()) if ks.Config == nil { ks.Config = make(map[string]string, 1) } else if _, ok := ks.Config[TSOKeyspaceGroupIDKey]; ok { // If the keyspace already has a group ID, skip it. - manager.metaLock.Unlock(ks.Id) + manager.metaLock.Unlock(ks.GetId()) continue } // Unlock the keyspace meta lock after the whole txn. - keyspaceIDsToUnlock = append(keyspaceIDsToUnlock, ks.Id) + keyspaceIDsToUnlock = append(keyspaceIDsToUnlock, ks.GetId()) // If the keyspace doesn't have a group ID, assign it to the default keyspace group. - if !slice.Contains(defaultKeyspaceGroup.Keyspaces, ks.Id) { - defaultKeyspaceGroup.Keyspaces = append(defaultKeyspaceGroup.Keyspaces, ks.Id) + if !slice.Contains(defaultKeyspaceGroup.Keyspaces, ks.GetId()) { + defaultKeyspaceGroup.Keyspaces = append(defaultKeyspaceGroup.Keyspaces, ks.GetId()) // Only save the keyspace group meta if any keyspace is assigned to it. assigned = true } @@ -1427,7 +1427,7 @@ func (manager *Manager) PatrolKeyspaceAssignment(startKeyspaceID, endKeyspaceID zap.Uint32("end-keyspace-id", endKeyspaceID), zap.Uint32("current-start-id", currentStartID), zap.Uint32("next-start-id", nextStartID), - zap.Uint32("keyspace-id", ks.Id), zap.Error(err)) + zap.Uint32("keyspace-id", ks.GetId()), zap.Error(err)) return err } assignedKeyspaceCount++ diff --git a/pkg/keyspace/keyspace_test.go b/pkg/keyspace/keyspace_test.go index b3edd9eb15b..21e19e90c70 100644 --- a/pkg/keyspace/keyspace_test.go +++ b/pkg/keyspace/keyspace_test.go @@ -148,23 +148,23 @@ func (suite *keyspaceTestSuite) TestCreateKeyspace() { for i, request := range requests { created, err := manager.CreateKeyspace(request) re.NoError(err) - re.Equal(uint32(i+1), created.Id) + re.Equal(uint32(i+1), created.GetId()) checkCreateRequest(re, request, created) - name, err := manager.GetKeyspaceNameByID(created.Id) + name, err := manager.GetKeyspaceNameByID(created.GetId()) re.NoError(err) re.Equal(created.Name, name) - name, err = manager.GetEnabledKeyspaceNameByID(created.Id) + name, err = manager.GetEnabledKeyspaceNameByID(created.GetId()) re.NoError(err) re.Equal(created.Name, name) loaded, err := manager.LoadKeyspace(request.Name) re.NoError(err) - re.Equal(uint32(i+1), loaded.Id) + re.Equal(uint32(i+1), loaded.GetId()) checkCreateRequest(re, request, loaded) - loaded, err = manager.LoadKeyspaceByID(created.Id) + loaded, err = manager.LoadKeyspaceByID(created.GetId()) re.NoError(err) re.Equal(loaded.Name, request.Name) checkCreateRequest(re, request, loaded) @@ -279,7 +279,7 @@ func (suite *keyspaceTestSuite) TestGCManagementTypeDefaultValue() { } created, err := manager.CreateKeyspace(req) re.NoError(err) - loaded, err := manager.LoadKeyspaceByID(created.Id) + loaded, err := manager.LoadKeyspaceByID(created.GetId()) re.NoError(err) re.Equal(tc.expect, loaded.Config[GCManagementType]) } @@ -312,7 +312,7 @@ func (suite *keyspaceTestSuite) TestCreateKeyspaceByID() { created, err := manager.CreateKeyspaceByID(request) re.NoError(err) id := i + 1 - re.Equal(uint32(id), created.Id) + re.Equal(uint32(id), created.GetId()) re.Equal(strconv.Itoa(id), created.Name) checkCreateByIDRequest(re, request, created) @@ -320,7 +320,7 @@ func (suite *keyspaceTestSuite) TestCreateKeyspaceByID() { re.NoError(err) checkCreateByIDRequest(re, request, loaded) - loaded, err = manager.LoadKeyspaceByID(created.Id) + loaded, err = manager.LoadKeyspaceByID(created.GetId()) re.NoError(err) checkCreateByIDRequest(re, request, loaded) } @@ -359,7 +359,7 @@ func (suite *keyspaceTestSuite) TestCreateKeyspaceNoIDLeak() { } first, err := manager.CreateKeyspace(req) re.NoError(err) - re.Equal(uint32(1), first.Id) + re.Equal(uint32(1), first.GetId()) // Attempt to create the same keyspace 5 times - should all fail without allocating IDs. for range 5 { @@ -374,7 +374,7 @@ func (suite *keyspaceTestSuite) TestCreateKeyspaceNoIDLeak() { Config: map[string]string{testConfig1: "100"}, }) re.NoError(err) - re.Equal(uint32(2), second.Id) + re.Equal(uint32(2), second.GetId()) // Test CreateKeyspaceByID: should reject duplicate name or ID early. id10 := uint32(10) @@ -414,7 +414,7 @@ func (suite *keyspaceTestSuite) TestCreateKeyspaceNoIDLeak() { Config: map[string]string{testConfig1: "100"}, }) re.NoError(err) - re.Equal(uint32(3), third.Id) + re.Equal(uint32(3), third.GetId()) } func makeMutations() []*Mutation { @@ -653,17 +653,17 @@ func (suite *keyspaceTestSuite) TestLoadRangeKeyspace() { for i := range keyspaces { if i < total { // User-created keyspaces with IDs 1-100 - re.Equal(uint32(i+1), keyspaces[i].Id) + re.Equal(uint32(i+1), keyspaces[i].GetId()) checkCreateRequest(re, requests[i], keyspaces[i]) } else { // Bootstrap keyspace with SystemKeyspaceID - re.Equal(constant.SystemKeyspaceID, keyspaces[i].Id) + re.Equal(constant.SystemKeyspaceID, keyspaces[i].GetId()) } } } else { // For classic: expect keyspaces [0, 1, 2, ..., 100] for i := range keyspaces { - re.Equal(uint32(i), keyspaces[i].Id) + re.Equal(uint32(i), keyspaces[i].GetId()) if i != 0 { checkCreateRequest(re, requests[i-1], keyspaces[i]) } @@ -678,14 +678,14 @@ func (suite *keyspaceTestSuite) TestLoadRangeKeyspace() { // In next-gen mode, result should be keyspaces with id 1 - 50. re.Len(keyspaces, 50) for i := range keyspaces { - re.Equal(uint32(i+1), keyspaces[i].Id) + re.Equal(uint32(i+1), keyspaces[i].GetId()) checkCreateRequest(re, requests[i], keyspaces[i]) } } else { // In legacy mode, result should be keyspaces with id 0 - 49. re.Len(keyspaces, 50) for i := range keyspaces { - re.Equal(uint32(i), keyspaces[i].Id) + re.Equal(uint32(i), keyspaces[i].GetId()) if i != 0 { checkCreateRequest(re, requests[i-1], keyspaces[i]) } @@ -699,7 +699,7 @@ func (suite *keyspaceTestSuite) TestLoadRangeKeyspace() { re.NoError(err) re.Len(keyspaces, 20) for i := range keyspaces { - re.Equal(uint32(loadStart+i), keyspaces[i].Id) + re.Equal(uint32(loadStart+i), keyspaces[i].GetId()) checkCreateRequest(re, requests[i+loadStart-1], keyspaces[i]) } @@ -714,18 +714,18 @@ func (suite *keyspaceTestSuite) TestLoadRangeKeyspace() { for i := range keyspaces { if i < 11 { // User-created keyspaces with IDs 90-100 - re.Equal(uint32(loadStart+i), keyspaces[i].Id) + re.Equal(uint32(loadStart+i), keyspaces[i].GetId()) checkCreateRequest(re, requests[i+loadStart-1], keyspaces[i]) } else { // System keyspace with SystemKeyspaceID - re.Equal(constant.SystemKeyspaceID, keyspaces[i].Id) + re.Equal(constant.SystemKeyspaceID, keyspaces[i].GetId()) } } } else { // In legacy mode, scan result should be keyspaces with id 90-100. re.Len(keyspaces, 11) for i := range keyspaces { - re.Equal(uint32(loadStart+i), keyspaces[i].Id) + re.Equal(uint32(loadStart+i), keyspaces[i].GetId()) checkCreateRequest(re, requests[i+loadStart-1], keyspaces[i]) } } @@ -737,7 +737,7 @@ func (suite *keyspaceTestSuite) TestLoadRangeKeyspace() { if kerneltype.IsNextGen() { // In next-gen mode, only SystemKeyspaceID is greater than 900. re.Len(keyspaces, 1) - re.Equal(constant.SystemKeyspaceID, keyspaces[0].Id) + re.Equal(constant.SystemKeyspaceID, keyspaces[0].GetId()) } else { re.Empty(keyspaces) } @@ -839,7 +839,7 @@ func (suite *keyspaceTestSuite) TestPatrolKeyspaceAssignment() { // Create a keyspace without any keyspace group. now := time.Now().Unix() err := suite.manager.saveNewKeyspace(&keyspacepb.KeyspaceMeta{ - Id: 111, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 111}, Name: "111", State: keyspacepb.KeyspaceState_ENABLED, CreatedAt: now, @@ -867,7 +867,7 @@ func (suite *keyspaceTestSuite) TestPatrolKeyspaceAssignmentInBatch() { for i := 1; i < etcdutil.MaxEtcdTxnOps*2+1; i++ { now := time.Now().Unix() err := suite.manager.saveNewKeyspace(&keyspacepb.KeyspaceMeta{ - Id: uint32(i), + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: uint32(i)}, Name: strconv.Itoa(i), State: keyspacepb.KeyspaceState_ENABLED, CreatedAt: now, @@ -900,7 +900,7 @@ func (suite *keyspaceTestSuite) TestPatrolKeyspaceAssignmentWithRange() { for i := 1; i < etcdutil.MaxEtcdTxnOps*2+1; i++ { now := time.Now().Unix() err := suite.manager.saveNewKeyspace(&keyspacepb.KeyspaceMeta{ - Id: uint32(i), + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: uint32(i)}, Name: strconv.Itoa(i), State: keyspacepb.KeyspaceState_ENABLED, CreatedAt: now, @@ -995,10 +995,10 @@ func TestIterateKeyspaces(t *testing.T) { if !ok { break } - re.Equal(keyspaceIDs[i], meta.Id) + re.Equal(keyspaceIDs[i], meta.GetId()) re.Equal(keyspaceNames[i], meta.Name) - if meta.Id != constant.DefaultKeyspaceID && meta.Id != constant.SystemKeyspaceID { - re.Equal(strconv.FormatUint(uint64(meta.Id), 10), meta.Config["test_cfg"]) + if meta.GetId() != constant.DefaultKeyspaceID && meta.GetId() != constant.SystemKeyspaceID { + re.Equal(strconv.FormatUint(uint64(meta.GetId()), 10), meta.Config["test_cfg"]) } } re.Equal(len(keyspaceIDs), i) @@ -1059,7 +1059,7 @@ func benchmarkPatrolKeyspaceAssignmentN( for i := 1; i <= n; i++ { now := time.Now().Unix() err := suite.manager.saveNewKeyspace(&keyspacepb.KeyspaceMeta{ - Id: uint32(i), + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: uint32(i)}, Name: strconv.Itoa(i), State: keyspacepb.KeyspaceState_ENABLED, CreatedAt: now, @@ -1093,7 +1093,7 @@ func TestAssignGroupAndSaveKeyspace(t *testing.T) { emptyMgm := NewMetaServiceGroupManager(store, map[string]string{}) managerNoGroup := NewKeyspaceManager(ctx, store, nil, mockid.NewIDAllocator(), &mockConfig{}, kgm, emptyMgm) cfg := map[string]string{} - ks := &keyspacepb.KeyspaceMeta{Id: 100, Name: "ks-stale-precheck", Config: cfg} + ks := &keyspacepb.KeyspaceMeta{Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 100}, Name: "ks-stale-precheck", Config: cfg} re.NoError(managerNoGroup.assignGroupAndSaveKeyspace(true, &cfg, ks)) re.NotContains(ks.GetConfig(), MetaServiceGroupIDKey) loaded, err := managerNoGroup.LoadKeyspace("ks-stale-precheck") @@ -1107,7 +1107,7 @@ func TestAssignGroupAndSaveKeyspace(t *testing.T) { re.NoError(mgm.PatchStatus(ctx, "g1", &MetaServiceGroupStatusPatch{Enabled: &enabled})) managerWithGroup := NewKeyspaceManager(ctx, store, nil, mockid.NewIDAllocator(), &mockConfig{}, kgm, mgm) cfg2 := map[string]string{} - ks2 := &keyspacepb.KeyspaceMeta{Id: 101, Name: "ks-with-group", Config: cfg2} + ks2 := &keyspacepb.KeyspaceMeta{Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 101}, Name: "ks-with-group", Config: cfg2} re.NoError(managerWithGroup.assignGroupAndSaveKeyspace(true, &cfg2, ks2)) re.Equal("g1", ks2.GetConfig()[MetaServiceGroupIDKey]) @@ -1116,7 +1116,7 @@ func TestAssignGroupAndSaveKeyspace(t *testing.T) { disabledMgm := NewMetaServiceGroupManager(store, map[string]string{"g2": "addr2"}) managerDisabled := NewKeyspaceManager(ctx, store, nil, mockid.NewIDAllocator(), &mockConfig{}, kgm, disabledMgm) cfg3 := map[string]string{} - ks3 := &keyspacepb.KeyspaceMeta{Id: 102, Name: "ks-disabled-group", Config: cfg3} + ks3 := &keyspacepb.KeyspaceMeta{Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 102}, Name: "ks-disabled-group", Config: cfg3} re.NoError(managerDisabled.assignGroupAndSaveKeyspace(true, &cfg3, ks3)) re.NotContains(ks3.GetConfig(), MetaServiceGroupIDKey) } diff --git a/pkg/mcs/resourcemanager/server/manager_test.go b/pkg/mcs/resourcemanager/server/manager_test.go index 16ecac456d1..cd627091d67 100644 --- a/pkg/mcs/resourcemanager/server/manager_test.go +++ b/pkg/mcs/resourcemanager/server/manager_test.go @@ -501,15 +501,15 @@ func TestDispatchConsumptionIncludesOnlyConsumption(t *testing.T) { // Put a keyspace meta into the storage. func prepareKeyspaceName(ctx context.Context, re *require.Assertions, manager *Manager, keyspaceIDValue *rmpb.KeyspaceIDValue, keyspaceName string) { keyspaceMeta := &keyspacepb.KeyspaceMeta{ - Id: ExtractKeyspaceID(keyspaceIDValue), - Name: keyspaceName, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: ExtractKeyspaceID(keyspaceIDValue)}, + Name: keyspaceName, } err := manager.storage.RunInTxn(ctx, func(txn kv.Txn) error { err := manager.storage.SaveKeyspaceMeta(txn, keyspaceMeta) if err != nil { return err } - return manager.storage.SaveKeyspaceID(txn, keyspaceMeta.Id, keyspaceMeta.Name) + return manager.storage.SaveKeyspaceID(txn, keyspaceMeta.GetId(), keyspaceMeta.Name) }) re.NoError(err) } diff --git a/pkg/storage/keyspace_test.go b/pkg/storage/keyspace_test.go index 3f39c63e7e5..58faeaddaf8 100644 --- a/pkg/storage/keyspace_test.go +++ b/pkg/storage/keyspace_test.go @@ -34,7 +34,7 @@ func TestSaveLoadKeyspace(t *testing.T) { keyspaces := makeTestKeyspaces() err := storage.RunInTxn(context.TODO(), func(txn kv.Txn) error { for _, keyspace := range keyspaces { - re.NoError(storage.SaveKeyspaceID(txn, keyspace.Id, keyspace.Name)) + re.NoError(storage.SaveKeyspaceID(txn, keyspace.GetId(), keyspace.Name)) re.NoError(storage.SaveKeyspaceMeta(txn, keyspace)) } return nil @@ -46,9 +46,9 @@ func TestSaveLoadKeyspace(t *testing.T) { loadSuccess, id, err := storage.LoadKeyspaceID(txn, expectedMeta.Name) re.NoError(err) re.True(loadSuccess) - re.Equal(expectedMeta.Id, id) + re.Equal(expectedMeta.GetId(), id) // Test load keyspace. - loadedMeta, err := storage.LoadKeyspaceMeta(txn, expectedMeta.Id) + loadedMeta, err := storage.LoadKeyspaceMeta(txn, expectedMeta.GetId()) re.NoError(err) re.Equal(expectedMeta, loadedMeta) } @@ -109,7 +109,7 @@ func makeTestKeyspaces() []*keyspacepb.KeyspaceMeta { now := time.Now().Unix() return []*keyspacepb.KeyspaceMeta{ { - Id: 10, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 10}, Name: "keyspace1", State: keyspacepb.KeyspaceState_ENABLED, CreatedAt: now, @@ -120,7 +120,7 @@ func makeTestKeyspaces() []*keyspacepb.KeyspaceMeta { }, }, { - Id: 11, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 11}, Name: "keyspace2", State: keyspacepb.KeyspaceState_ARCHIVED, CreatedAt: now + 300, @@ -131,7 +131,7 @@ func makeTestKeyspaces() []*keyspacepb.KeyspaceMeta { }, }, { - Id: 100, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: 100}, Name: "keyspace3", State: keyspacepb.KeyspaceState_DISABLED, CreatedAt: now + 500, diff --git a/server/apiv2/handlers/keyspace.go b/server/apiv2/handlers/keyspace.go index 1e986c808da..f1acdec7716 100644 --- a/server/apiv2/handlers/keyspace.go +++ b/server/apiv2/handlers/keyspace.go @@ -297,7 +297,7 @@ func LoadAllKeyspaces(c *gin.Context) { resultKeyspaces[i] = &KeyspaceMeta{scanned[i]} } // Also set next_page_token here. - resp.NextPageToken = strconv.Itoa(int(scanned[len(scanned)-1].Id)) + resp.NextPageToken = strconv.Itoa(int(scanned[len(scanned)-1].GetId())) } resp.Keyspaces = resultKeyspaces c.IndentedJSON(http.StatusOK, resp) @@ -462,7 +462,7 @@ func (meta *KeyspaceMeta) MarshalJSON() ([]byte, error) { StateChangedAt int64 `json:"state_changed_at,omitempty"` Config map[string]string `json:"config,omitempty"` }{ - meta.Id, + meta.GetId(), meta.Name, meta.State.String(), meta.CreatedAt, @@ -486,7 +486,7 @@ func (meta *KeyspaceMeta) UnmarshalJSON(data []byte) error { return err } pbMeta := &keyspacepb.KeyspaceMeta{ - Id: aux.ID, + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: aux.ID}, Name: aux.Name, State: keyspacepb.KeyspaceState(keyspacepb.KeyspaceState_value[aux.State]), CreatedAt: aux.CreatedAt, diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index be13842ffd3..b5a74c1fe29 100644 --- a/tests/integrations/go.mod +++ b/tests/integrations/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff + github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/tests/integrations/go.sum b/tests/integrations/go.sum index e1ce0012999..ca57ec52eb0 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -473,8 +473,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff h1:kt7e4oQ9e1s2nMR7UkBJpmxrhi59vRrOE5kNY6TMRks= -github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 h1:3YlDwVLfQ++7AkI3Y+AIuYvlNjaeateu8RvklEPzzBU= +github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tests/integrations/mcs/resourcemanager/resource_manager_test.go b/tests/integrations/mcs/resourcemanager/resource_manager_test.go index d30a5cb3726..25335f9150a 100644 --- a/tests/integrations/mcs/resourcemanager/resource_manager_test.go +++ b/tests/integrations/mcs/resourcemanager/resource_manager_test.go @@ -2105,8 +2105,8 @@ func (suite *resourceManagerClientTestSuite) TestResourceGroupCURDWithKeyspace() // Add keyspace meta. keyspace := &keyspacepb.KeyspaceMeta{ - Id: keyspaceID, - Name: "keyspace_test", + Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: keyspaceID}, + Name: "keyspace_test", } storage := suite.cluster.GetLeaderServer().GetServer().GetStorage() err := storage.RunInTxn(suite.ctx, func(txn kv.Txn) error { @@ -2243,7 +2243,7 @@ func (suite *resourceManagerClientTestSuite) TestAcquireTokenBucketsWithMultiKey client := suite.setupKeyspaceClient(re, keyspaceID) clients[i] = client // Create and save keyspace metadata - keyspaceMeta := &keyspacepb.KeyspaceMeta{Id: keyspaceID, Name: keyspaceName} + keyspaceMeta := &keyspacepb.KeyspaceMeta{Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: keyspaceID}, Name: keyspaceName} err := storage.RunInTxn(ctx, func(txn kv.Txn) error { return storage.SaveKeyspaceMeta(txn, keyspaceMeta) }) @@ -2448,11 +2448,11 @@ func (suite *resourceManagerClientTestSuite) TestCannotModifyKeyspaceOfResourceG keyspaceA := uint32(10) keyspaceB := uint32(11) err := storage.RunInTxn(ctx, func(txn kv.Txn) error { - return storage.SaveKeyspaceMeta(txn, &keyspacepb.KeyspaceMeta{Id: keyspaceA, Name: "ks_A"}) + return storage.SaveKeyspaceMeta(txn, &keyspacepb.KeyspaceMeta{Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: keyspaceA}, Name: "ks_A"}) }) re.NoError(err) err = storage.RunInTxn(ctx, func(txn kv.Txn) error { - return storage.SaveKeyspaceMeta(txn, &keyspacepb.KeyspaceMeta{Id: keyspaceB, Name: "ks_B"}) + return storage.SaveKeyspaceMeta(txn, &keyspacepb.KeyspaceMeta{Keyspace: &keyspacepb.KeyspaceMeta_Id{Id: keyspaceB}, Name: "ks_B"}) }) re.NoError(err) diff --git a/tests/server/apiv2/handlers/testutil.go b/tests/server/apiv2/handlers/testutil.go index 4c38d197bf1..462b98dd99e 100644 --- a/tests/server/apiv2/handlers/testutil.go +++ b/tests/server/apiv2/handlers/testutil.go @@ -123,7 +123,7 @@ func checkCreateRequest(re *require.Assertions, request *handlers.CreateKeyspace // checkCreateByIDRequest verifies a keyspace meta matches a create request. func checkCreateByIDRequest(re *require.Assertions, request *handlers.CreateKeyspaceByIDParams, meta *keyspacepb.KeyspaceMeta) { - re.Equal(*request.ID, meta.Id) + re.Equal(*request.ID, meta.GetId()) re.Equal(keyspacepb.KeyspaceState_ENABLED, meta.State) checkConfig(re, request.Config, keyspace.IgnoreMetaServiceGroup(meta.Config)) } diff --git a/tools/go.mod b/tools/go.mod index 5da0c72b28d..7b53162f999 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -23,7 +23,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff + github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang v1.20.5 diff --git a/tools/go.sum b/tools/go.sum index bf6b3caf2e9..005f34ea03b 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -478,8 +478,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff h1:kt7e4oQ9e1s2nMR7UkBJpmxrhi59vRrOE5kNY6TMRks= -github.com/pingcap/kvproto v0.0.0-20260708034143-c3fb31ac93ff/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 h1:3YlDwVLfQ++7AkI3Y+AIuYvlNjaeateu8RvklEPzzBU= +github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= From f0dbff7d0efefe49fe69ff00376e8454a31a80f6 Mon Sep 17 00:00:00 2001 From: disksing Date: Wed, 22 Jul 2026 22:35:01 +0800 Subject: [PATCH 17/17] *: update kvproto to latest apiv3 Signed-off-by: disksing --- client/go.mod | 2 +- client/go.sum | 4 +-- client/keyspace_client.go | 4 +-- .../controller/global_controller.go | 4 +-- client/resource_manager_client.go | 20 ++++------- client/resource_manager_client_test.go | 4 +-- go.mod | 2 +- go.sum | 4 +-- .../resourcemanager/server/grpc_service.go | 2 +- .../server/keyspace_manager_test.go | 2 +- pkg/mcs/resourcemanager/server/manager.go | 6 ++-- .../resourcemanager/server/manager_test.go | 36 +++++++++---------- .../server/metadata_watcher_test.go | 2 +- .../resourcemanager/server/resource_group.go | 2 +- pkg/mcs/resourcemanager/server/utils_test.go | 6 ++-- tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 +-- .../mcs/resourcemanager/api_test.go | 9 ++--- .../mcs/resourcemanager/redirector_test.go | 26 +++++--------- .../resourcemanager/resource_manager_test.go | 10 +++--- .../mcs/resourcemanager/service_limit_test.go | 4 +-- .../resourcemanager/watcher_matrix_test.go | 8 ++--- .../server/keyspace/keyspace_service_test.go | 30 ++++------------ tools/go.mod | 2 +- tools/go.sum | 4 +-- 25 files changed, 77 insertions(+), 122 deletions(-) diff --git a/client/go.mod b/client/go.mod index 16fe09f242f..f39842d0d17 100644 --- a/client/go.mod +++ b/client/go.mod @@ -10,7 +10,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 + github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/client/go.sum b/client/go.sum index 9df50e882d1..edb3ba9e513 100644 --- a/client/go.sum +++ b/client/go.sum @@ -53,8 +53,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= -github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 h1:3YlDwVLfQ++7AkI3Y+AIuYvlNjaeateu8RvklEPzzBU= -github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0 h1:fYG7YB9ooFzVM7vKxXDs3QanNdj57yAMEdPZadeC64Q= +github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/client/keyspace_client.go b/client/keyspace_client.go index 9d34b18897e..3a23e17195c 100644 --- a/client/keyspace_client.go +++ b/client/keyspace_client.go @@ -125,8 +125,8 @@ func (c *client) LoadKeyspaceByID(ctx context.Context, id uint32) (*keyspacepb.K defer func() { metrics.CmdDurationLoadKeyspaceByID.Observe(time.Since(start).Seconds()) }() ctx, cancel := context.WithTimeout(ctx, c.inner.option.Timeout) req := &keyspacepb.LoadKeyspaceByIDRequest{ - Header: c.requestHeader(), - Id: id, + Header: c.requestHeader(), + Keyspace: &keyspacepb.LoadKeyspaceByIDRequest_Id{Id: id}, } protoClient := c.keyspaceClient() if protoClient == nil { diff --git a/client/resource_group/controller/global_controller.go b/client/resource_group/controller/global_controller.go index 87e4f2cb107..f67055388d6 100644 --- a/client/resource_group/controller/global_controller.go +++ b/client/resource_group/controller/global_controller.go @@ -684,9 +684,7 @@ func (c *ResourceGroupsController) collectTokenBucketRequests(ctx context.Contex gc := value.(*groupCostController) request := gc.collectRequestAndConsumption(typ) if request != nil { - request.KeyspaceId = &rmpb.KeyspaceIDValue{ - Value: c.keyspaceID, - } + request.KeyspaceId = &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: c.keyspaceID}} c.run.currentRequests = append(c.run.currentRequests, request) gc.metrics.tokenRequestCounter.Inc() } diff --git a/client/resource_manager_client.go b/client/resource_manager_client.go index 30ed6cf62c3..bdd302b415b 100644 --- a/client/resource_manager_client.go +++ b/client/resource_manager_client.go @@ -119,9 +119,7 @@ func (c *client) ListResourceGroups(ctx context.Context, ops ...GetResourceGroup } req := &rmpb.ListResourceGroupsRequest{ WithRuStats: getOp.withRUStats, - KeyspaceId: &rmpb.KeyspaceIDValue{ - Value: c.inner.keyspaceID, - }, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: c.inner.keyspaceID}}, } resp, err := cc.ListResourceGroups(ctx, req) if err != nil { @@ -149,9 +147,7 @@ func (c *client) GetResourceGroup(ctx context.Context, resourceGroupName string, req := &rmpb.GetResourceGroupRequest{ ResourceGroupName: resourceGroupName, WithRuStats: getOp.withRUStats, - KeyspaceId: &rmpb.KeyspaceIDValue{ - Value: c.inner.keyspaceID, - }, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: c.inner.keyspaceID}}, } resp, err := cc.GetResourceGroup(ctx, req) if err != nil { @@ -183,12 +179,10 @@ func (c *client) putResourceGroup(ctx context.Context, metaGroup *rmpb.ResourceG } // ensure to use the keyspace ID of the inner client if metaGroup.KeyspaceId == nil { - metaGroup.KeyspaceId = &rmpb.KeyspaceIDValue{ - Value: c.inner.keyspaceID, - } - } else if metaGroup.KeyspaceId.Value != c.inner.keyspaceID { + metaGroup.KeyspaceId = &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: c.inner.keyspaceID}} + } else if metaGroup.KeyspaceId.GetValue() != c.inner.keyspaceID { return "", errs.ErrClientPutResourceGroupMismatchKeyspaceID.FastGenByArgs( - metaGroup.KeyspaceId.Value, c.inner.keyspaceID) + metaGroup.KeyspaceId.GetValue(), c.inner.keyspaceID) } req := &rmpb.PutResourceGroupRequest{ Group: metaGroup, @@ -219,9 +213,7 @@ func (c *client) DeleteResourceGroup(ctx context.Context, resourceGroupName stri } req := &rmpb.DeleteResourceGroupRequest{ ResourceGroupName: resourceGroupName, - KeyspaceId: &rmpb.KeyspaceIDValue{ - Value: c.inner.keyspaceID, - }, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: c.inner.keyspaceID}}, } resp, err := cc.DeleteResourceGroup(ctx, req) if err != nil { diff --git a/client/resource_manager_client_test.go b/client/resource_manager_client_test.go index 4302a333f2b..f3525c256d6 100644 --- a/client/resource_manager_client_test.go +++ b/client/resource_manager_client_test.go @@ -185,9 +185,7 @@ func (s *testRMServer) AcquireTokenBuckets(stream rmpb.ResourceManager_AcquireTo for _, tokenReq := range req.GetRequests() { resp.Responses = append(resp.Responses, &rmpb.TokenBucketResponse{ ResourceGroupName: tokenReq.GetResourceGroupName(), - KeyspaceId: &rmpb.KeyspaceIDValue{ - Value: constants.NullKeyspaceID, - }, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: constants.NullKeyspaceID}}, }) } if err := stream.Send(resp); err != nil { diff --git a/go.mod b/go.mod index 251d07f0b5e..f3f5c43403f 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/pingcap/errcode v0.3.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 + github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/metering_sdk v0.0.0-20260203082503-b9f282339654 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 diff --git a/go.sum b/go.sum index 6ee2b7dc244..d01348bc6ce 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 h1:3YlDwVLfQ++7AkI3Y+AIuYvlNjaeateu8RvklEPzzBU= -github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0 h1:fYG7YB9ooFzVM7vKxXDs3QanNdj57yAMEdPZadeC64Q= +github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/pkg/mcs/resourcemanager/server/grpc_service.go b/pkg/mcs/resourcemanager/server/grpc_service.go index 875299c6025..8d2b13f4a36 100644 --- a/pkg/mcs/resourcemanager/server/grpc_service.go +++ b/pkg/mcs/resourcemanager/server/grpc_service.go @@ -254,7 +254,7 @@ func (s *Service) AcquireTokenBuckets(stream rmpb.ResourceManager_AcquireTokenBu now := time.Now() resp := &rmpb.TokenBucketResponse{ ResourceGroupName: rg.Name, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: keyspaceID}}, } switch rg.Mode { case rmpb.GroupMode_RUMode: diff --git a/pkg/mcs/resourcemanager/server/keyspace_manager_test.go b/pkg/mcs/resourcemanager/server/keyspace_manager_test.go index 5dad0672e49..5c8f30e6a67 100644 --- a/pkg/mcs/resourcemanager/server/keyspace_manager_test.go +++ b/pkg/mcs/resourcemanager/server/keyspace_manager_test.go @@ -672,7 +672,7 @@ func TestPersistAndReloadIntegrity(t *testing.T) { err = proto.Unmarshal([]byte(rawValue), groupSetting) re.NoError(err) re.NotNil(groupSetting.KeyspaceId) - re.Equal(keyspaceID, groupSetting.KeyspaceId.Value) + re.Equal(keyspaceID, groupSetting.KeyspaceId.GetValue()) re.Equal(uint64(500), groupSetting.RUSettings.RU.Settings.FillRate) } }) diff --git a/pkg/mcs/resourcemanager/server/manager.go b/pkg/mcs/resourcemanager/server/manager.go index 4f811a0392e..57d1a818ff0 100644 --- a/pkg/mcs/resourcemanager/server/manager.go +++ b/pkg/mcs/resourcemanager/server/manager.go @@ -719,13 +719,13 @@ func (m *Manager) updateKeyspaceNameLookup(id uint32, name string) { // GetKeyspaceIDByName gets the keyspace ID by name. func (m *Manager) GetKeyspaceIDByName(ctx context.Context, name string) (*rmpb.KeyspaceIDValue, error) { if len(name) == 0 { - return &rmpb.KeyspaceIDValue{Value: constant.NullKeyspaceID}, nil + return &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: constant.NullKeyspaceID}}, nil } m.RLock() id, ok := m.keyspaceIDLookup[name] m.RUnlock() if ok { - return &rmpb.KeyspaceIDValue{Value: id}, nil + return &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: id}}, nil } var ( loadedID uint32 @@ -747,7 +747,7 @@ func (m *Manager) GetKeyspaceIDByName(ctx context.Context, name string) (*rmpb.K } // Update the cache. m.updateKeyspaceNameLookup(loadedID, name) - return &rmpb.KeyspaceIDValue{Value: loadedID}, nil + return &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: loadedID}}, nil } func (m *Manager) backgroundMetricsFlush(ctx context.Context) { diff --git a/pkg/mcs/resourcemanager/server/manager_test.go b/pkg/mcs/resourcemanager/server/manager_test.go index cd627091d67..8d8e5f0e7c6 100644 --- a/pkg/mcs/resourcemanager/server/manager_test.go +++ b/pkg/mcs/resourcemanager/server/manager_test.go @@ -246,11 +246,9 @@ func TestLoadKeyspaceResourceGroupsRejectsMismatchedPayloadName(t *testing.T) { m.storage = memStorage group := &rmpb.ResourceGroup{ - Name: "payload-group", - Mode: rmpb.GroupMode_RUMode, - KeyspaceId: &rmpb.KeyspaceIDValue{ - Value: 42, - }, + Name: "payload-group", + Mode: rmpb.GroupMode_RUMode, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: 42}}, } rawGroup, err := proto.Marshal(group) re.NoError(err) @@ -385,14 +383,14 @@ func TestInitManager(t *testing.T) { Name: "test_group", Mode: rmpb.GroupMode_RUMode, Priority: 5, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: keyspaceID}}, } err = m.AddResourceGroup(group) re.NoError(err) // Adding a new keyspace resource group should create a new keyspace resource group manager. krgm = m.getKeyspaceResourceGroupManager(1) re.NotNil(krgm) - re.Equal(group.KeyspaceId.Value, krgm.keyspaceID) + re.Equal(group.KeyspaceId.GetValue(), krgm.keyspaceID) re.Equal(group.Name, krgm.getMutableResourceGroup(group.Name).Name) // A default resource group should be created for the keyspace as well. defaultGroup := krgm.getMutableResourceGroup(DefaultResourceGroupName) @@ -429,7 +427,7 @@ func TestBackgroundMetricsFlush(t *testing.T) { // Test without keyspace ID checkBackgroundMetricsFlush(ctx, re, m, nil) // Test with keyspace ID - checkBackgroundMetricsFlush(ctx, re, m, &rmpb.KeyspaceIDValue{Value: 1}) + checkBackgroundMetricsFlush(ctx, re, m, &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: 1}}) } func checkBackgroundMetricsFlush(ctx context.Context, re *require.Assertions, manager *Manager, keyspaceIDValue *rmpb.KeyspaceIDValue) { @@ -486,7 +484,7 @@ func TestDispatchConsumptionIncludesOnlyConsumption(t *testing.T) { WRU: 8, WriteBytes: 1024, }, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: 42}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: 42}}, } err := m.dispatchConsumption(req) @@ -529,7 +527,7 @@ func TestAddAndModifyResourceGroup(t *testing.T) { // Test without keyspace ID checkAddAndModifyResourceGroup(re, m, nil) // Test with keyspace ID - checkAddAndModifyResourceGroup(re, m, &rmpb.KeyspaceIDValue{Value: 1}) + checkAddAndModifyResourceGroup(re, m, &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: 1}}) } func checkAddAndModifyResourceGroup(re *require.Assertions, manager *Manager, keyspaceIDValue *rmpb.KeyspaceIDValue) { @@ -573,7 +571,7 @@ func TestCleanUpTicker(t *testing.T) { defer cancel() // Put a keyspace meta. keyspaceID := uint32(1) - prepareKeyspaceName(ctx, re, m, &rmpb.KeyspaceIDValue{Value: keyspaceID}, "test_keyspace") + prepareKeyspaceName(ctx, re, m, &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: keyspaceID}}, "test_keyspace") // Insert two consumption records manually. m.metrics.consumptionRecordMap[consumptionRecordKey{ keyspaceID: keyspaceID, @@ -636,10 +634,10 @@ func TestKeyspaceServiceLimit(t *testing.T) { }, }, }, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: 1}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: 1}}, } // Test the limiter of the non-existing keyspace is nil. - limiter = m.GetKeyspaceServiceLimiter(group.KeyspaceId.Value) + limiter = m.GetKeyspaceServiceLimiter(group.KeyspaceId.GetValue()) re.Nil(limiter) // Test the limiter of the newly created keyspace is 0.0. err = m.AddResourceGroup(group) @@ -678,7 +676,7 @@ func TestKeyspaceNameLookup(t *testing.T) { idValue, err := m.GetKeyspaceIDByName(ctx, "") re.NoError(err) re.NotNil(idValue) - re.Equal(constant.NullKeyspaceID, idValue.Value) + re.Equal(constant.NullKeyspaceID, idValue.GetValue()) // Get the non-existing keyspace ID by name. idValue, err = m.GetKeyspaceIDByName(ctx, "non-existing-keyspace") re.Error(err) @@ -692,23 +690,23 @@ func TestKeyspaceNameLookup(t *testing.T) { re.Error(err) re.Empty(name) // Get the keyspace ID by name first, then get the keyspace name by ID. - prepareKeyspaceName(ctx, re, m, &rmpb.KeyspaceIDValue{Value: 1}, "test_keyspace") + prepareKeyspaceName(ctx, re, m, &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: 1}}, "test_keyspace") idValue, err = m.GetKeyspaceIDByName(ctx, "test_keyspace") re.NoError(err) re.NotNil(idValue) - re.Equal(uint32(1), idValue.Value) + re.Equal(uint32(1), idValue.GetValue()) name, err = m.getKeyspaceNameByID(ctx, 1) re.NoError(err) re.Equal("test_keyspace", name) // Get the keyspace name by ID first, then get the keyspace ID by name. - prepareKeyspaceName(ctx, re, m, &rmpb.KeyspaceIDValue{Value: 2}, "test_keyspace_2") + prepareKeyspaceName(ctx, re, m, &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: 2}}, "test_keyspace_2") name, err = m.getKeyspaceNameByID(ctx, 2) re.NoError(err) re.Equal("test_keyspace_2", name) idValue, err = m.GetKeyspaceIDByName(ctx, "test_keyspace_2") re.NoError(err) re.NotNil(idValue) - re.Equal(uint32(2), idValue.Value) + re.Equal(uint32(2), idValue.GetValue()) } func TestResourceGroupPersistence(t *testing.T) { @@ -720,7 +718,7 @@ func TestResourceGroupPersistence(t *testing.T) { Name: "test_group", Mode: rmpb.GroupMode_RUMode, Priority: 5, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: 1}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: 1}}, } err := m.AddResourceGroup(group) re.NoError(err) diff --git a/pkg/mcs/resourcemanager/server/metadata_watcher_test.go b/pkg/mcs/resourcemanager/server/metadata_watcher_test.go index 1335492a9bc..fcbcf7dbc98 100644 --- a/pkg/mcs/resourcemanager/server/metadata_watcher_test.go +++ b/pkg/mcs/resourcemanager/server/metadata_watcher_test.go @@ -64,7 +64,7 @@ func newMetadataWatcherResourceGroup(name string, priority uint32, fillRate uint }, }, }, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: 10}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: 10}}, } } diff --git a/pkg/mcs/resourcemanager/server/resource_group.go b/pkg/mcs/resourcemanager/server/resource_group.go index 37fdd8bdb85..5563a70ce49 100644 --- a/pkg/mcs/resourcemanager/server/resource_group.go +++ b/pkg/mcs/resourcemanager/server/resource_group.go @@ -322,7 +322,7 @@ func (rg *ResourceGroup) IntoProtoResourceGroup(keyspaceID uint32) *rmpb.Resourc }, RunawaySettings: rg.Runaway, BackgroundSettings: rg.Background, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: keyspaceID}}, } if rg.RUConsumption != nil { diff --git a/pkg/mcs/resourcemanager/server/utils_test.go b/pkg/mcs/resourcemanager/server/utils_test.go index 2a0389caa83..c212c58fd8b 100644 --- a/pkg/mcs/resourcemanager/server/utils_test.go +++ b/pkg/mcs/resourcemanager/server/utils_test.go @@ -33,9 +33,9 @@ func TestExtractKeyspaceID(t *testing.T) { expected uint32 }{ {nil, constant.NullKeyspaceID}, - {&rmpb.KeyspaceIDValue{Value: 0}, 0}, - {&rmpb.KeyspaceIDValue{Value: 1}, 1}, - {&rmpb.KeyspaceIDValue{Value: math.MaxUint32}, math.MaxUint32}, + {&rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: 0}}, 0}, + {&rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: 1}}, 1}, + {&rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: math.MaxUint32}}, math.MaxUint32}, } for _, tc := range testCases { re.Equal(tc.expected, ExtractKeyspaceID(tc.keyspaceIDValue)) diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index b5a74c1fe29..feade2e6562 100644 --- a/tests/integrations/go.mod +++ b/tests/integrations/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 + github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 diff --git a/tests/integrations/go.sum b/tests/integrations/go.sum index ca57ec52eb0..1e51b59b5fe 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -473,8 +473,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 h1:3YlDwVLfQ++7AkI3Y+AIuYvlNjaeateu8RvklEPzzBU= -github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0 h1:fYG7YB9ooFzVM7vKxXDs3QanNdj57yAMEdPZadeC64Q= +github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= diff --git a/tests/integrations/mcs/resourcemanager/api_test.go b/tests/integrations/mcs/resourcemanager/api_test.go index d3744820dc7..48c051f7dba 100644 --- a/tests/integrations/mcs/resourcemanager/api_test.go +++ b/tests/integrations/mcs/resourcemanager/api_test.go @@ -124,9 +124,8 @@ func (suite *resourceManagerAPITestSuite) TestResourceGroupAPI() { }, ) re.NoError(err) - keyspaceID := &rmpb.KeyspaceIDValue{ - Value: meta.GetId(), - } + keyspaceID := &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: meta.GetId()}} + // Add a resource group. groupToAdd := &rmpb.ResourceGroup{ Name: "test_group", @@ -254,9 +253,7 @@ func (suite *resourceManagerAPITestSuite) TestResourceGroupAPIInit() { }, }, }, - KeyspaceId: &rmpb.KeyspaceIDValue{ - Value: keyspaceID, - }, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: keyspaceID}}, } suite.mustUpdateResourceGroup(re, groupToUpdate) }, diff --git a/tests/integrations/mcs/resourcemanager/redirector_test.go b/tests/integrations/mcs/resourcemanager/redirector_test.go index 09f4f046b6e..2c8c16d052a 100644 --- a/tests/integrations/mcs/resourcemanager/redirector_test.go +++ b/tests/integrations/mcs/resourcemanager/redirector_test.go @@ -196,9 +196,7 @@ func (suite *resourceManagerRedirectorTestSuite) TestGRPCRedirectsResourceGroupR rmClient := rmpb.NewResourceManagerClient(rmConn) getReq := &rmpb.GetResourceGroupRequest{ ResourceGroupName: groupName, - KeyspaceId: &rmpb.KeyspaceIDValue{ - Value: suite.keyspaceID, - }, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, } pdResp, err := pdClient.GetResourceGroup(ctx, getReq) re.NoError(err) @@ -228,7 +226,7 @@ func (suite *resourceManagerRedirectorTestSuite) TestGRPCRedirectsResourceGroupR }, }, }, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: suite.keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, } _, err = rmClient.AddResourceGroup(ctx, &rmpb.PutResourceGroupRequest{Group: addGroup}) assertMetadataWriteRejected(err) @@ -240,9 +238,7 @@ func (suite *resourceManagerRedirectorTestSuite) TestGRPCRedirectsResourceGroupR addGetReq := &rmpb.GetResourceGroupRequest{ ResourceGroupName: addGroupName, - KeyspaceId: &rmpb.KeyspaceIDValue{ - Value: suite.keyspaceID, - }, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, } pdAddGetResp, err := pdClient.GetResourceGroup(ctx, addGetReq) re.NoError(err) @@ -287,17 +283,13 @@ func (suite *resourceManagerRedirectorTestSuite) TestGRPCRedirectsResourceGroupR _, err = rmClient.DeleteResourceGroup(ctx, &rmpb.DeleteResourceGroupRequest{ ResourceGroupName: addGroupName, - KeyspaceId: &rmpb.KeyspaceIDValue{ - Value: suite.keyspaceID, - }, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, }) assertMetadataWriteRejected(err) deleteResp, err := pdClient.DeleteResourceGroup(ctx, &rmpb.DeleteResourceGroupRequest{ ResourceGroupName: addGroupName, - KeyspaceId: &rmpb.KeyspaceIDValue{ - Value: suite.keyspaceID, - }, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, }) re.NoError(err) re.Nil(deleteResp.GetError()) @@ -337,7 +329,7 @@ func (suite *resourceManagerRedirectorTestSuite) TestGRPCMetadataWritesForwardFr }, }, }, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: suite.keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, } addResp, err := leaderClient.AddResourceGroup(ctx, &rmpb.PutResourceGroupRequest{Group: group}) @@ -353,7 +345,7 @@ func (suite *resourceManagerRedirectorTestSuite) TestGRPCMetadataWritesForwardFr getReq := &rmpb.GetResourceGroupRequest{ ResourceGroupName: groupName, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: suite.keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, } modifiedResp, err := leaderClient.GetResourceGroup(ctx, getReq) re.NoError(err) @@ -364,7 +356,7 @@ func (suite *resourceManagerRedirectorTestSuite) TestGRPCMetadataWritesForwardFr deleteResp, err := followerClient.DeleteResourceGroup(ctx, &rmpb.DeleteResourceGroupRequest{ ResourceGroupName: groupName, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: suite.keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, }) re.NoError(err) re.Equal("Success!", deleteResp.GetBody()) @@ -386,7 +378,7 @@ func (suite *resourceManagerRedirectorTestSuite) createResourceGroupViaPD(name s Settings: &rmpb.TokenLimitSettings{FillRate: fillRate, BurstLimit: 200}, }, }, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: suite.keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, } payload, err := json.Marshal(group) re.NoError(err) diff --git a/tests/integrations/mcs/resourcemanager/resource_manager_test.go b/tests/integrations/mcs/resourcemanager/resource_manager_test.go index 25335f9150a..981913e7e73 100644 --- a/tests/integrations/mcs/resourcemanager/resource_manager_test.go +++ b/tests/integrations/mcs/resourcemanager/resource_manager_test.go @@ -2148,7 +2148,7 @@ func (suite *resourceManagerClientTestSuite) TestResourceGroupCURDWithKeyspace() re.Len(rgs, 2) // Including the default resource group. for _, r := range rgs { re.NotNil(r.KeyspaceId) - re.Equal(r.KeyspaceId.Value, keyspaceID) + re.Equal(r.KeyspaceId.GetValue(), keyspaceID) switch r.Name { case server.DefaultResourceGroupName: case group.Name: @@ -2197,7 +2197,7 @@ func (suite *resourceManagerClientTestSuite) TestResourceGroupCURDWithKeyspace() re.NotEqual(rg.RUStats, testConsumption) // Test AcquireTokenBuckets with keyspace id - req.Requests[0].KeyspaceId = &rmpb.KeyspaceIDValue{Value: keyspaceID} + req.Requests[0].KeyspaceId = &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: keyspaceID}} _, err = clientKeyspace.AcquireTokenBuckets(suite.ctx, req) re.NoError(err) time.Sleep(10 * time.Millisecond) @@ -2253,7 +2253,7 @@ func (suite *resourceManagerClientTestSuite) TestAcquireTokenBucketsWithMultiKey Name: groupName, Mode: rmpb.GroupMode_RUMode, RUSettings: &rmpb.GroupRequestUnitSettings{RU: &rmpb.TokenBucket{Settings: &rmpb.TokenLimitSettings{FillRate: 10000}, Tokens: 100000}}, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: keyspaceID}}, } _, err = clients[i].AddResourceGroup(ctx, groups[i]) re.NoError(err) @@ -2473,14 +2473,14 @@ func (suite *resourceManagerClientTestSuite) TestCannotModifyKeyspaceOfResourceG re.NoError(err) re.Equal(groupName, g.Name) re.NotNil(g.KeyspaceId) - re.Equal(keyspaceA, g.KeyspaceId.Value) + re.Equal(keyspaceA, g.KeyspaceId.GetValue()) // Try to modify the group with a different keyspace ID using Client A modifiedGroup := &rmpb.ResourceGroup{ Name: groupName, Mode: rmpb.GroupMode_RUMode, Priority: 5, - KeyspaceId: &rmpb.KeyspaceIDValue{Value: keyspaceB}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: keyspaceB}}, } // It should be failed because the keyspace ID does not match diff --git a/tests/integrations/mcs/resourcemanager/service_limit_test.go b/tests/integrations/mcs/resourcemanager/service_limit_test.go index 0db14136e34..22703f33a34 100644 --- a/tests/integrations/mcs/resourcemanager/service_limit_test.go +++ b/tests/integrations/mcs/resourcemanager/service_limit_test.go @@ -114,9 +114,7 @@ func (suite *serviceLimitTestSuite) TestKeyspaceServiceLimit() { ConsumptionSinceLastRequest: &rmpb.Consumption{ RRU: requestRU, }, - KeyspaceId: &rmpb.KeyspaceIDValue{ - Value: suite.keyspaceID, - }, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, }, }, TargetRequestPeriodMs: 1000, diff --git a/tests/integrations/mcs/resourcemanager/watcher_matrix_test.go b/tests/integrations/mcs/resourcemanager/watcher_matrix_test.go index 00d5b24aff4..d25afbf0b7b 100644 --- a/tests/integrations/mcs/resourcemanager/watcher_matrix_test.go +++ b/tests/integrations/mcs/resourcemanager/watcher_matrix_test.go @@ -106,7 +106,7 @@ func (suite *resourceManagerWatcherMatrixTestSuite) TestWatcherKeepsLegacyKeyspa legacyReq := &rmpb.GetResourceGroupRequest{ResourceGroupName: legacyGroup.GetName()} keyspaceReq := &rmpb.GetResourceGroupRequest{ ResourceGroupName: keyspaceGroup.GetName(), - KeyspaceId: &rmpb.KeyspaceIDValue{Value: suite.keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, } suite.waitForGroup(re, rmClient, legacyReq, 1, 100) suite.waitForGroup(re, rmClient, keyspaceReq, 9, 900) @@ -135,7 +135,7 @@ func (suite *resourceManagerWatcherMatrixTestSuite) TestWatcherBootstrapsAfterRM defer initialConn.Close() req := &rmpb.GetResourceGroupRequest{ ResourceGroupName: group.GetName(), - KeyspaceId: &rmpb.KeyspaceIDValue{Value: suite.keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, } suite.waitForGroup(re, initialRMClient, req, 7, 700) @@ -168,7 +168,7 @@ func (suite *resourceManagerWatcherMatrixTestSuite) TestWatcherRecoversAfterComp req := &rmpb.GetResourceGroupRequest{ ResourceGroupName: group.GetName(), - KeyspaceId: &rmpb.KeyspaceIDValue{Value: suite.keyspaceID}, + KeyspaceId: &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: suite.keyspaceID}}, } suite.waitForGroup(re, rmClient, req, 5, 500) @@ -209,7 +209,7 @@ func newWatcherMatrixResourceGroup(name string, priority uint32, fillRate uint64 }, } if keyspaceID != nil { - group.KeyspaceId = &rmpb.KeyspaceIDValue{Value: *keyspaceID} + group.KeyspaceId = &rmpb.KeyspaceIDValue{Keyspace: &rmpb.KeyspaceIDValue_Value{Value: *keyspaceID}} } return group } diff --git a/tests/server/keyspace/keyspace_service_test.go b/tests/server/keyspace/keyspace_service_test.go index 8b81dec3618..48a144631e7 100644 --- a/tests/server/keyspace/keyspace_service_test.go +++ b/tests/server/keyspace/keyspace_service_test.go @@ -39,24 +39,15 @@ func (suite *keyspaceTestSuite) TestLoadKeyspaceByIDGRPC() { }) re.NoError(err) - _, err = service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{ - Header: testutil.NewRequestHeader(suite.server.GetClusterID() + 1), - Id: created.GetId(), - }) + _, err = service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{Header: testutil.NewRequestHeader(suite.server.GetClusterID() + 1), Keyspace: &keyspacepb.LoadKeyspaceByIDRequest_Id{Id: created.GetId()}}) re.Error(err) - resp, err := service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{ - Header: testutil.NewRequestHeader(suite.server.GetClusterID()), - Id: created.GetId() + 1000, - }) + resp, err := service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{Header: testutil.NewRequestHeader(suite.server.GetClusterID()), Keyspace: &keyspacepb.LoadKeyspaceByIDRequest_Id{Id: created.GetId() + 1000}}) re.NoError(err) re.Equal(pdpb.ErrorType_ENTRY_NOT_FOUND, resp.GetHeader().GetError().GetType()) re.Nil(resp.GetKeyspace()) - resp, err = service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{ - Header: testutil.NewRequestHeader(suite.server.GetClusterID()), - Id: created.GetId(), - }) + resp, err = service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{Header: testutil.NewRequestHeader(suite.server.GetClusterID()), Keyspace: &keyspacepb.LoadKeyspaceByIDRequest_Id{Id: created.GetId()}}) re.NoError(err) re.Equal(pdpb.ErrorType_ENTRY_NOT_FOUND, resp.GetHeader().GetError().GetType()) re.Nil(resp.GetKeyspace()) @@ -67,10 +58,7 @@ func (suite *keyspaceTestSuite) TestLoadKeyspaceByIDGRPC() { pdtests.MustPutRegion(re, suite.cluster, regionID+2, 1, regionBound.RawRightBound, regionBound.TxnLeftBound) pdtests.MustPutRegion(re, suite.cluster, regionID+3, 1, regionBound.TxnLeftBound, regionBound.TxnRightBound) pdtests.MustPutRegion(re, suite.cluster, regionID+4, 1, regionBound.TxnRightBound, []byte{}) - resp, err = service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{ - Header: testutil.NewRequestHeader(suite.server.GetClusterID()), - Id: created.GetId(), - }) + resp, err = service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{Header: testutil.NewRequestHeader(suite.server.GetClusterID()), Keyspace: &keyspacepb.LoadKeyspaceByIDRequest_Id{Id: created.GetId()}}) re.NoError(err) re.Nil(resp.GetHeader().GetError()) re.Equal(created, resp.GetKeyspace()) @@ -81,10 +69,7 @@ func (suite *keyspaceTestSuite) TestLoadKeyspaceByIDGRPC() { }) re.NoError(failpoint.Disable("github.com/tikv/pd/pkg/keyspace/skipSplitRegion")) re.NoError(err) - resp, err = service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{ - Header: testutil.NewRequestHeader(suite.server.GetClusterID()), - Id: skipRegionCheckKeyspace.GetId(), - }) + resp, err = service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{Header: testutil.NewRequestHeader(suite.server.GetClusterID()), Keyspace: &keyspacepb.LoadKeyspaceByIDRequest_Id{Id: skipRegionCheckKeyspace.GetId()}}) re.NoError(err) re.Equal(pdpb.ErrorType_ENTRY_NOT_FOUND, resp.GetHeader().GetError().GetType()) re.Nil(resp.GetKeyspace()) @@ -93,10 +78,7 @@ func (suite *keyspaceTestSuite) TestLoadKeyspaceByIDGRPC() { defer func() { re.NoError(failpoint.Disable("github.com/tikv/pd/server/skipKeyspaceRegionCheck")) }() - resp, err = service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{ - Header: testutil.NewRequestHeader(suite.server.GetClusterID()), - Id: skipRegionCheckKeyspace.GetId(), - }) + resp, err = service.LoadKeyspaceByID(ctx, &keyspacepb.LoadKeyspaceByIDRequest{Header: testutil.NewRequestHeader(suite.server.GetClusterID()), Keyspace: &keyspacepb.LoadKeyspaceByIDRequest_Id{Id: skipRegionCheckKeyspace.GetId()}}) re.NoError(err) re.Nil(resp.GetHeader().GetError()) re.Equal(skipRegionCheckKeyspace, resp.GetKeyspace()) diff --git a/tools/go.mod b/tools/go.mod index 7b53162f999..4ae29a3cdc8 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -23,7 +23,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 + github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang v1.20.5 diff --git a/tools/go.sum b/tools/go.sum index 005f34ea03b..020ec7c5bb8 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -478,8 +478,8 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c/go.mod h1:X2r9ue github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5 h1:3YlDwVLfQ++7AkI3Y+AIuYvlNjaeateu8RvklEPzzBU= -github.com/pingcap/kvproto v0.0.0-20260720031225-fd32127adca5/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= +github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0 h1:fYG7YB9ooFzVM7vKxXDs3QanNdj57yAMEdPZadeC64Q= +github.com/pingcap/kvproto v0.0.0-20260722060835-57fb9c0799c0/go.mod h1:z6+aAHB7dBkA+LyinEX+48/ImRJ3jag0Hg0c7wkhEvE= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8IDP+SZrdhV1Kibl9KrHxJ9eciw= github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=