From a69ee01287378a2072e56e2920727f596dd6850c Mon Sep 17 00:00:00 2001 From: JmPotato Date: Fri, 17 Jan 2025 22:10:01 +0800 Subject: [PATCH 1/2] server, core: implement the query region gRPC server (#8979) ref tikv/pd#8690 Implement the query region gRPC server interface. Signed-off-by: JmPotato --- go.mod | 2 +- go.sum | 4 +- pkg/core/region.go | 117 ++++++++++++++++++++++++++++++++++++++ pkg/core/region_test.go | 88 ++++++++++++++++++++++++++++ pkg/core/region_tree.go | 20 +++++++ server/grpc_service.go | 57 +++++++++++++++++++ server/metrics.go | 10 ++++ tests/integrations/go.mod | 2 +- tests/integrations/go.sum | 4 +- tools/go.mod | 2 +- tools/go.sum | 4 +- 11 files changed, 301 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index d3e42f3f381..8d0ad90fb11 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,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-20250117013947-1fdf41372412 + github.com/pingcap/kvproto v0.0.0-20250117122752-2b87602a94a1 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 github.com/pingcap/tidb-dashboard v0.0.0-20241104061623-bce95733dad7 diff --git a/go.sum b/go.sum index 97095710805..8850c1a6509 100644 --- a/go.sum +++ b/go.sum @@ -392,8 +392,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-20250117013947-1fdf41372412 h1:RW/oeRwHxB9pGTtSCgf4wrsHw9RwrUg7+wAQRsW8KfE= -github.com/pingcap/kvproto v0.0.0-20250117013947-1fdf41372412/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20250117122752-2b87602a94a1 h1:rTAyiswGyWSGHJVa4Mkhdi8YfGqfA4LrUVKsH9nrJ8E= +github.com/pingcap/kvproto v0.0.0-20250117122752-2b87602a94a1/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/pkg/core/region.go b/pkg/core/region.go index 706e6bbd712..94fc525f11b 100644 --- a/pkg/core/region.go +++ b/pkg/core/region.go @@ -47,6 +47,7 @@ import ( const ( randomRegionMaxRetry = 10 scanRegionLimit = 1000 + batchSearchSize = 16 // CollectFactor is the factor to collect the count of region. CollectFactor = 0.9 ) @@ -1464,6 +1465,122 @@ func (r *RegionsInfo) GetStoreRegions(storeID uint64) []*RegionInfo { return regions } +// TODO: benchmark the performance of `QueryRegions`. +// QueryRegions searches RegionInfo from regionTree by keys and IDs in batch. +func (r *RegionsInfo) QueryRegions( + keys, prevKeys [][]byte, ids []uint64, needBuckets bool, +) ([]uint64, []uint64, map[uint64]*pdpb.RegionResponse) { + // Iterate the region keys to find the regions. + regions := r.getRegionsByKeys(keys) + // Assert the returned regions count matches the input keys. + if len(regions) != len(keys) { + panic("returned regions count mismatch with the input keys") + } + // Iterate the prevKeys to find the regions. + prevRegions := r.getRegionsByPrevKeys(prevKeys) + // Assert the returned regions count matches the input keys. + if len(prevRegions) != len(prevKeys) { + panic("returned prev regions count mismatch with the input keys") + } + // Build the key -> ID map for the final results. + regionsByID := make(map[uint64]*pdpb.RegionResponse, len(regions)) + keyIDMap := sortOutKeyIDMap(regionsByID, regions, needBuckets) + prevKeyIDMap := sortOutKeyIDMap(regionsByID, prevRegions, needBuckets) + // Iterate the region IDs to find the regions. + for _, id := range ids { + // Check if the region has been found. + if regionFound, ok := regionsByID[id]; (ok && regionFound != nil) || id == 0 { + continue + } + // If the given region ID is not found in the region tree, set the region to nil. + if region := r.GetRegion(id); region == nil { + regionsByID[id] = nil + } else { + regionResp := &pdpb.RegionResponse{ + Region: region.GetMeta(), + Leader: region.GetLeader(), + DownPeers: region.GetDownPeers(), + PendingPeers: region.GetPendingPeers(), + } + if needBuckets { + regionResp.Buckets = region.GetBuckets() + } + regionsByID[id] = regionResp + } + } + return keyIDMap, prevKeyIDMap, regionsByID +} + +// getRegionsByKeys searches RegionInfo from regionTree by keys. +func (r *RegionsInfo) getRegionsByKeys(keys [][]byte) []*RegionInfo { + regions := make([]*RegionInfo, 0, len(keys)) + // Split the keys into multiple batches, and search each batch separately. + // This is to avoid the lock contention on the `regionTree`. + for _, batch := range splitKeysIntoBatches(keys) { + r.t.RLock() + results := r.tree.searchByKeys(batch) + r.t.RUnlock() + regions = append(regions, results...) + } + return regions +} + +func splitKeysIntoBatches(keys [][]byte) [][][]byte { + keysLen := len(keys) + batches := make([][][]byte, 0, (keysLen+batchSearchSize-1)/batchSearchSize) + for i := 0; i < keysLen; i += batchSearchSize { + end := i + batchSearchSize + if end > keysLen { + end = keysLen + } + batches = append(batches, keys[i:end]) + } + return batches +} + +func (r *RegionsInfo) getRegionsByPrevKeys(prevKeys [][]byte) []*RegionInfo { + regions := make([]*RegionInfo, 0, len(prevKeys)) + for _, batch := range splitKeysIntoBatches(prevKeys) { + r.t.RLock() + results := r.tree.searchByPrevKeys(batch) + r.t.RUnlock() + regions = append(regions, results...) + } + return regions +} + +// sortOutKeyIDMap will iterate the regions, convert it to a slice of regionID that corresponds to the input regions. +// It will also update `regionsByID` with the regionID and regionResponse. +func sortOutKeyIDMap( + regionsByID map[uint64]*pdpb.RegionResponse, regions []*RegionInfo, needBuckets bool, +) []uint64 { + keyIDMap := make([]uint64, len(regions)) + for idx, region := range regions { + regionID := region.GetMeta().GetId() + keyIDMap[idx] = regionID + // Check if the region has been found. + if regionFound, ok := regionsByID[regionID]; (ok && regionFound != nil) || regionID == 0 { + continue + } + // If the given key is not found in the region tree, set the region to nil. + if region == nil { + regionsByID[regionID] = nil + } else { + regionResp := &pdpb.RegionResponse{ + Region: region.GetMeta(), + Leader: region.GetLeader(), + DownPeers: region.GetDownPeers(), + PendingPeers: region.GetPendingPeers(), + } + if needBuckets { + regionResp.Buckets = region.GetBuckets() + } + regionsByID[regionID] = regionResp + } + } + return keyIDMap +} + // SubTreeRegionType is the type of sub tree region. type SubTreeRegionType string diff --git a/pkg/core/region_test.go b/pkg/core/region_test.go index 473421b0e52..cfd05b776f2 100644 --- a/pkg/core/region_test.go +++ b/pkg/core/region_test.go @@ -1203,3 +1203,91 @@ func TestScanRegion(t *testing.T) { re.Len(scanNoError([]byte("a"), []byte("e"), 0), 3) re.Len(scanNoError([]byte("c"), []byte("e"), 0), 1) } + +func TestQueryRegions(t *testing.T) { + re := require.New(t) + regions := NewRegionsInfo() + regions.CheckAndPutRegion(NewTestRegionInfo(1, 1, []byte("a"), []byte("b"))) + regions.CheckAndPutRegion(NewTestRegionInfo(2, 1, []byte("b"), []byte("c"))) + regions.CheckAndPutRegion(NewTestRegionInfo(3, 1, []byte("d"), []byte("e"))) + // Query regions by keys. + keyIDMap, prevKeyIDMap, regionsByID := regions.QueryRegions( + [][]byte{[]byte("a"), []byte("b"), []byte("c")}, + nil, + nil, + false, + ) + re.Len(keyIDMap, 3) + re.Empty(prevKeyIDMap) + re.Equal(uint64(1), keyIDMap[0]) + re.Equal(uint64(2), keyIDMap[1]) + re.Zero(keyIDMap[2]) // The key is not in the region tree, so its ID should be 0. + re.Len(regionsByID, 2) + re.Equal(uint64(1), regionsByID[1].GetRegion().GetId()) + re.Equal(uint64(2), regionsByID[2].GetRegion().GetId()) + // Query regions by IDs. + keyIDMap, prevKeyIDMap, regionsByID = regions.QueryRegions( + nil, + nil, + []uint64{1, 2, 3}, + false, + ) + re.Empty(keyIDMap) + re.Empty(prevKeyIDMap) + re.Len(regionsByID, 3) + re.Equal(uint64(1), regionsByID[1].GetRegion().GetId()) + re.Equal(uint64(2), regionsByID[2].GetRegion().GetId()) + re.Equal(uint64(3), regionsByID[3].GetRegion().GetId()) + // Query the region that does not exist. + keyIDMap, prevKeyIDMap, regionsByID = regions.QueryRegions( + nil, + nil, + []uint64{4}, + false, + ) + re.Empty(keyIDMap) + re.Empty(prevKeyIDMap) + re.Len(regionsByID, 1) + re.Nil(regionsByID[4]) + keyIDMap, prevKeyIDMap, regionsByID = regions.QueryRegions( + [][]byte{[]byte("c")}, + nil, + nil, + false, + ) + re.Len(keyIDMap, 1) + re.Empty(prevKeyIDMap) + re.Zero(keyIDMap[0]) + re.Empty(regionsByID) + keyIDMap, prevKeyIDMap, regionsByID = regions.QueryRegions( + [][]byte{[]byte("c")}, + nil, + []uint64{4}, + false, + ) + re.Len(keyIDMap, 1) + re.Empty(prevKeyIDMap) + re.Zero(keyIDMap[0]) + re.Nil(regionsByID[4]) + // Query regions by keys, previous keys and IDs. + keyIDMap, prevKeyIDMap, regionsByID = regions.QueryRegions( + [][]byte{[]byte("b"), []byte("c")}, + [][]byte{[]byte("a"), []byte("b"), []byte("c"), []byte("d"), []byte("e"), []byte("f")}, + []uint64{1, 3}, + false, + ) + re.Len(keyIDMap, 2) + re.Len(prevKeyIDMap, 6) + re.Equal(uint64(2), keyIDMap[0]) + re.Zero(keyIDMap[1]) + re.Zero(prevKeyIDMap[0]) + re.Equal(uint64(1), prevKeyIDMap[1]) + re.Zero(prevKeyIDMap[2]) + re.Zero(prevKeyIDMap[3]) + re.Zero(prevKeyIDMap[4]) + re.Zero(prevKeyIDMap[5]) + re.Len(regionsByID, 3) + re.Equal(uint64(1), regionsByID[1].GetRegion().GetId()) + re.Equal(uint64(2), regionsByID[2].GetRegion().GetId()) + re.Equal(uint64(3), regionsByID[3].GetRegion().GetId()) +} diff --git a/pkg/core/region_tree.go b/pkg/core/region_tree.go index 6efafd133cf..1e0a0d5565d 100644 --- a/pkg/core/region_tree.go +++ b/pkg/core/region_tree.go @@ -255,6 +255,26 @@ func (t *regionTree) searchPrev(regionKey []byte) *RegionInfo { return prevRegionItem.RegionInfo } +// searchByKeys searches the regions by keys and return a slice of `*RegionInfo` whose order is the same as the input keys. +func (t *regionTree) searchByKeys(keys [][]byte) []*RegionInfo { + regions := make([]*RegionInfo, len(keys)) + // TODO: do we need to deduplicate the input keys? + for idx, key := range keys { + regions[idx] = t.search(key) + } + return regions +} + +// searchByPrevKeys searches the regions by prevKeys and return a slice of `*RegionInfo` whose order is the same as the input keys. +func (t *regionTree) searchByPrevKeys(prevKeys [][]byte) []*RegionInfo { + regions := make([]*RegionInfo, len(prevKeys)) + // TODO: do we need to deduplicate the input keys? + for idx, key := range prevKeys { + regions[idx] = t.searchPrev(key) + } + return regions +} + // find returns the range item contains the start key. func (t *regionTree) find(item *regionItem) *regionItem { var result *regionItem diff --git a/server/grpc_service.go b/server/grpc_service.go index 649d02a37b4..b985e870a03 100644 --- a/server/grpc_service.go +++ b/server/grpc_service.go @@ -1530,6 +1530,63 @@ func (s *GrpcServer) GetRegionByID(ctx context.Context, request *pdpb.GetRegionB }, nil } +// QueryRegion provides a stream processing of the region query. +func (s *GrpcServer) QueryRegion(stream pdpb.PD_QueryRegionServer) error { + done, err := s.rateLimitCheck() + if err != nil { + return err + } + if done != nil { + defer done() + } + + for { + request, err := stream.Recv() + if err == io.EOF { + return nil + } + if err != nil { + return errors.WithStack(err) + } + + // TODO: add forwarding logic. + + if clusterID := keypath.ClusterID(); request.GetHeader().GetClusterId() != clusterID { + return errs.ErrMismatchClusterID(clusterID, request.GetHeader().GetClusterId()) + } + rc := s.GetRaftCluster() + if rc == nil { + resp := &pdpb.QueryRegionResponse{ + Header: notBootstrappedHeader(), + } + if err = stream.Send(resp); err != nil { + return errors.WithStack(err) + } + continue + } + needBuckets := rc.GetStoreConfig().IsEnableRegionBucket() && request.GetNeedBuckets() + + start := time.Now() + keyIDMap, prevKeyIDMap, regionsByID := rc.QueryRegions( + request.GetKeys(), + request.GetPrevKeys(), + request.GetIds(), + needBuckets, + ) + regionQueryDuration.Observe(time.Since(start).Seconds()) + // Build the response and send it to the client. + response := &pdpb.QueryRegionResponse{ + Header: wrapHeader(), + KeyIdMap: keyIDMap, + PrevKeyIdMap: prevKeyIDMap, + RegionsById: regionsByID, + } + if err := stream.Send(response); err != nil { + return errors.WithStack(err) + } + } +} + // Deprecated: use BatchScanRegions instead. // ScanRegions implements gRPC PDServer. func (s *GrpcServer) ScanRegions(ctx context.Context, request *pdpb.ScanRegionsRequest) (*pdpb.ScanRegionsResponse, error) { diff --git a/server/metrics.go b/server/metrics.go index fdcc5b4be22..dd07447140b 100644 --- a/server/metrics.go +++ b/server/metrics.go @@ -99,6 +99,15 @@ var ( Buckets: prometheus.ExponentialBuckets(0.0005, 2, 13), }) + regionQueryDuration = prometheus.NewHistogram( + prometheus.HistogramOpts{ + Namespace: "pd", + Subsystem: "server", + Name: "region_query_duration_seconds", + Help: "Bucketed histogram of processing time (s) of region query requests.", + Buckets: prometheus.ExponentialBuckets(0.0005, 2, 13), + }) + bucketReportLatency = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: "pd", @@ -172,6 +181,7 @@ func init() { prometheus.MustRegister(tsoProxyBatchSize) prometheus.MustRegister(tsoProxyForwardTimeoutCounter) prometheus.MustRegister(tsoHandleDuration) + prometheus.MustRegister(regionQueryDuration) prometheus.MustRegister(regionHeartbeatHandleDuration) prometheus.MustRegister(storeHeartbeatHandleDuration) prometheus.MustRegister(bucketReportCounter) diff --git a/tests/integrations/go.mod b/tests/integrations/go.mod index 432826c52bd..fca5b54bb07 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-20250117013947-1fdf41372412 + github.com/pingcap/kvproto v0.0.0-20250117122752-2b87602a94a1 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 9900c796278..c23ee2733a6 100644 --- a/tests/integrations/go.sum +++ b/tests/integrations/go.sum @@ -385,8 +385,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-20250117013947-1fdf41372412 h1:RW/oeRwHxB9pGTtSCgf4wrsHw9RwrUg7+wAQRsW8KfE= -github.com/pingcap/kvproto v0.0.0-20250117013947-1fdf41372412/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20250117122752-2b87602a94a1 h1:rTAyiswGyWSGHJVa4Mkhdi8YfGqfA4LrUVKsH9nrJ8E= +github.com/pingcap/kvproto v0.0.0-20250117122752-2b87602a94a1/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 2ccfa4abd60..eb4c32afc13 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -22,7 +22,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-20250117013947-1fdf41372412 + github.com/pingcap/kvproto v0.0.0-20250117122752-2b87602a94a1 github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/common v0.55.0 diff --git a/tools/go.sum b/tools/go.sum index 93d685c193b..93cbc6736a9 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -386,8 +386,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-20250117013947-1fdf41372412 h1:RW/oeRwHxB9pGTtSCgf4wrsHw9RwrUg7+wAQRsW8KfE= -github.com/pingcap/kvproto v0.0.0-20250117013947-1fdf41372412/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20250117122752-2b87602a94a1 h1:rTAyiswGyWSGHJVa4Mkhdi8YfGqfA4LrUVKsH9nrJ8E= +github.com/pingcap/kvproto v0.0.0-20250117122752-2b87602a94a1/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 093b84112e19a2ad54ca3282726147bc7198b8f2 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Tue, 21 Jan 2025 11:35:17 +0800 Subject: [PATCH 2/2] *: check file header (#9015) ref tikv/pd#4322 Signed-off-by: Ryan Leung --- .golangci.yml | 19 +++++++++++++ client/gc_client.go | 2 +- client/inner_client.go | 14 ++++++++++ client/pkg/caller/caller.go | 2 +- client/pkg/circuitbreaker/circuit_breaker.go | 3 +- .../circuitbreaker/circuit_breaker_test.go | 3 +- client/pkg/utils/testutil/check_env_dummy.go | 1 + client/pkg/utils/testutil/check_env_linux.go | 1 + client/pkg/utils/timerutil/pool.go | 14 ++++++++++ client/pkg/utils/timerutil/pool_test.go | 14 ++++++++++ .../controller/controller_test.go | 8 +++--- client/resource_group/controller/limiter.go | 8 +++--- .../resource_group/controller/limiter_test.go | 8 +++--- client/resource_group/controller/testutil.go | 8 +++--- client/resource_group/controller/util.go | 10 +++---- docs/swagger/placeholder.go | 14 ++++++++++ pkg/btree/btree_generic.go | 28 +++++++++---------- pkg/btree/btree_generic_test.go | 4 +-- pkg/errs/errno.go | 2 +- pkg/gc/safepoint_v2.go | 2 +- pkg/gctuner/tuner_test.go | 2 +- .../resourcemanager/server/resource_group.go | 2 +- .../server/resource_group_test.go | 14 ++++++++++ pkg/mcs/scheduling/server/cluster.go | 14 ++++++++++ pkg/mcs/server/server.go | 2 +- pkg/mcs/utils/constant/constant.go | 2 +- pkg/mcs/utils/expected_primary.go | 2 +- pkg/mcs/utils/util.go | 2 +- pkg/schedule/filter/filters_test.go | 3 +- .../schedulers/balance_benchmark_test.go | 3 +- pkg/storage/hot_region_storage.go | 2 +- pkg/storage/hot_region_storage_test.go | 1 + pkg/storage/leveldb_backend_test.go | 2 +- pkg/storage/region_storage.go | 2 +- pkg/storage/region_storage_test.go | 2 +- .../unsafe_recovery_controller.go | 2 +- .../unsafe_recovery_controller_test.go | 2 +- pkg/utils/grpcutil/grpcutil_test.go | 14 ++++++++++ pkg/utils/keypath/cluster_id.go | 2 +- pkg/utils/keypath/key_path_test.go | 2 +- pkg/utils/netutil/address_test.go | 3 +- pkg/utils/tempurl/check_env_dummy.go | 1 + pkg/utils/tempurl/check_env_linux.go | 1 + pkg/utils/timerutil/pool.go | 14 ++++++++++ pkg/utils/timerutil/pool_test.go | 14 ++++++++++ pkg/window/counter.go | 6 ++-- pkg/window/counter_test.go | 6 ++-- pkg/window/policy.go | 6 ++-- pkg/window/policy_test.go | 6 ++-- pkg/window/reduce.go | 6 ++-- pkg/window/window.go | 6 ++-- pkg/window/window_test.go | 6 ++-- server/api/pprof_test.go | 3 +- .../mcs/discovery/register_test.go | 2 +- tests/integrations/mcs/scheduling/api_test.go | 14 ++++++++++ .../mcs/scheduling/server_test.go | 2 +- tests/integrations/mcs/tso/server_test.go | 2 +- tests/integrations/realcluster/cluster.go | 2 +- .../realcluster/cluster_id_test.go | 2 +- .../integrations/realcluster/etcd_key_test.go | 2 +- tests/integrations/realcluster/mock_db.go | 2 +- .../realcluster/reboot_pd_test.go | 2 +- .../realcluster/scheduler_test.go | 2 +- tests/integrations/realcluster/ts_test.go | 2 +- tests/integrations/realcluster/util.go | 2 +- tools/pd-backup/pdbackup/backup_test.go | 14 ++++++++++ tools/pd-ctl/pdctl/command/global_test.go | 3 +- tools/pd-heartbeat-bench/config/config.go | 14 ++++++++++ tools/pd-simulator/simulator/metrics.go | 14 ++++++++++ tools/pd-ut/alloc/check_env_dummy.go | 1 + tools/pd-ut/alloc/check_env_linux.go | 1 + 71 files changed, 309 insertions(+), 94 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a44052b22e8..561c785b078 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -29,6 +29,7 @@ linters: - reassign - intrange - gci + - goheader linters-settings: gocritic: # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty @@ -241,6 +242,24 @@ linters-settings: - prefix(github.com/pingcap) - prefix(github.com/tikv/pd) - blank + goheader: + values: + regexp: + COPYRIGHT-HEADER: Copyright \d{4} TiKV Project Authors. + template: |- + {{ COPYRIGHT-HEADER }} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. issues: exclude-rules: - path: (_test\.go|pkg/mock/.*\.go|tests/.*\.go) diff --git a/client/gc_client.go b/client/gc_client.go index 45fc8b40b91..117013ab2fa 100644 --- a/client/gc_client.go +++ b/client/gc_client.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/client/inner_client.go b/client/inner_client.go index 8379b6a51a9..cff5b95ed54 100644 --- a/client/inner_client.go +++ b/client/inner_client.go @@ -1,3 +1,17 @@ +// Copyright 2024 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pd import ( diff --git a/client/pkg/caller/caller.go b/client/pkg/caller/caller.go index 3df2297b0ac..04bd221216b 100644 --- a/client/pkg/caller/caller.go +++ b/client/pkg/caller/caller.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/client/pkg/circuitbreaker/circuit_breaker.go b/client/pkg/circuitbreaker/circuit_breaker.go index 0acee5d5c8d..7466124f2bc 100644 --- a/client/pkg/circuitbreaker/circuit_breaker.go +++ b/client/pkg/circuitbreaker/circuit_breaker.go @@ -4,13 +4,14 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package circuitbreaker import ( diff --git a/client/pkg/circuitbreaker/circuit_breaker_test.go b/client/pkg/circuitbreaker/circuit_breaker_test.go index e62e55c1ab8..ff7da9508c2 100644 --- a/client/pkg/circuitbreaker/circuit_breaker_test.go +++ b/client/pkg/circuitbreaker/circuit_breaker_test.go @@ -4,13 +4,14 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package circuitbreaker import ( diff --git a/client/pkg/utils/testutil/check_env_dummy.go b/client/pkg/utils/testutil/check_env_dummy.go index c8f4d268c9d..fed0636a112 100644 --- a/client/pkg/utils/testutil/check_env_dummy.go +++ b/client/pkg/utils/testutil/check_env_dummy.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + //go:build !linux // +build !linux diff --git a/client/pkg/utils/testutil/check_env_linux.go b/client/pkg/utils/testutil/check_env_linux.go index ebe6a8e0663..0c566f0dcd6 100644 --- a/client/pkg/utils/testutil/check_env_linux.go +++ b/client/pkg/utils/testutil/check_env_linux.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + //go:build linux // +build linux diff --git a/client/pkg/utils/timerutil/pool.go b/client/pkg/utils/timerutil/pool.go index cee061201c2..32f76b39572 100644 --- a/client/pkg/utils/timerutil/pool.go +++ b/client/pkg/utils/timerutil/pool.go @@ -1,3 +1,17 @@ +// Copyright 2023 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/client/pkg/utils/timerutil/pool_test.go b/client/pkg/utils/timerutil/pool_test.go index 3e0575daea3..ad550c7b56a 100644 --- a/client/pkg/utils/timerutil/pool_test.go +++ b/client/pkg/utils/timerutil/pool_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/client/resource_group/controller/controller_test.go b/client/resource_group/controller/controller_test.go index f0bdc62d6d3..02fd9e3d750 100644 --- a/client/resource_group/controller/controller_test.go +++ b/client/resource_group/controller/controller_test.go @@ -1,7 +1,3 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package controller import ( diff --git a/client/resource_group/controller/limiter.go b/client/resource_group/controller/limiter.go index c8843da00bd..1e1d2c4c475 100644 --- a/client/resource_group/controller/limiter.go +++ b/client/resource_group/controller/limiter.go @@ -1,7 +1,3 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package controller import ( diff --git a/client/resource_group/controller/limiter_test.go b/client/resource_group/controller/limiter_test.go index 24cdee0bbc3..8c524defb23 100644 --- a/client/resource_group/controller/limiter_test.go +++ b/client/resource_group/controller/limiter_test.go @@ -1,7 +1,3 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package controller import ( diff --git a/client/resource_group/controller/testutil.go b/client/resource_group/controller/testutil.go index de71cff4d0b..3e769545709 100644 --- a/client/resource_group/controller/testutil.go +++ b/client/resource_group/controller/testutil.go @@ -1,7 +1,3 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package controller import "time" diff --git a/client/resource_group/controller/util.go b/client/resource_group/controller/util.go index 3b491e02c8f..09328746fea 100644 --- a/client/resource_group/controller/util.go +++ b/client/resource_group/controller/util.go @@ -1,14 +1,10 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -16,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package controller import ( diff --git a/docs/swagger/placeholder.go b/docs/swagger/placeholder.go index c0a891a256f..ca1d43cbe0b 100644 --- a/docs/swagger/placeholder.go +++ b/docs/swagger/placeholder.go @@ -1 +1,15 @@ +// Copyright 2020 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package swagger diff --git a/pkg/btree/btree_generic.go b/pkg/btree/btree_generic.go index 599614678eb..1318ea3eb4e 100644 --- a/pkg/btree/btree_generic.go +++ b/pkg/btree/btree_generic.go @@ -1,3 +1,17 @@ +// Copyright 2022 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Copyright 2014-2022 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -59,20 +73,6 @@ // Those without this prefix are specific to the 'Item' interface, and use // its 'Less' function for ordering. -// Copyright 2022 TiKV Project Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - // nolint package btree diff --git a/pkg/btree/btree_generic_test.go b/pkg/btree/btree_generic_test.go index 8b432229470..1cf0851cb44 100644 --- a/pkg/btree/btree_generic_test.go +++ b/pkg/btree/btree_generic_test.go @@ -1,4 +1,4 @@ -// Copyright 2014-2022 Google Inc. +// Copyright 2022 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Copyright 2022 TiKV Project Authors. +// Copyright 2014-2022 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/errs/errno.go b/pkg/errs/errno.go index 25f69af327f..571d90b8651 100644 --- a/pkg/errs/errno.go +++ b/pkg/errs/errno.go @@ -1,4 +1,4 @@ -// Copyright 2020 PingCAP, Inc. +// Copyright 2020 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/pkg/gc/safepoint_v2.go b/pkg/gc/safepoint_v2.go index acdd4e6eef8..3ecae974785 100644 --- a/pkg/gc/safepoint_v2.go +++ b/pkg/gc/safepoint_v2.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/gctuner/tuner_test.go b/pkg/gctuner/tuner_test.go index d46bb8edf94..ef02010bcb7 100644 --- a/pkg/gctuner/tuner_test.go +++ b/pkg/gctuner/tuner_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/mcs/resourcemanager/server/resource_group.go b/pkg/mcs/resourcemanager/server/resource_group.go index 65d2959e870..d8ac16c7c5b 100644 --- a/pkg/mcs/resourcemanager/server/resource_group.go +++ b/pkg/mcs/resourcemanager/server/resource_group.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/mcs/resourcemanager/server/resource_group_test.go b/pkg/mcs/resourcemanager/server/resource_group_test.go index 8f058a212bb..a72e09172c6 100644 --- a/pkg/mcs/resourcemanager/server/resource_group_test.go +++ b/pkg/mcs/resourcemanager/server/resource_group_test.go @@ -1,3 +1,17 @@ +// Copyright 2022 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server import ( diff --git a/pkg/mcs/scheduling/server/cluster.go b/pkg/mcs/scheduling/server/cluster.go index c07174762ff..b55655e9747 100644 --- a/pkg/mcs/scheduling/server/cluster.go +++ b/pkg/mcs/scheduling/server/cluster.go @@ -1,3 +1,17 @@ +// Copyright 2023 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server import ( diff --git a/pkg/mcs/server/server.go b/pkg/mcs/server/server.go index 9692b52beb3..2f06829c9f0 100644 --- a/pkg/mcs/server/server.go +++ b/pkg/mcs/server/server.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/mcs/utils/constant/constant.go b/pkg/mcs/utils/constant/constant.go index 6f684bdb977..297c4798257 100644 --- a/pkg/mcs/utils/constant/constant.go +++ b/pkg/mcs/utils/constant/constant.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/mcs/utils/expected_primary.go b/pkg/mcs/utils/expected_primary.go index b8a317ed251..a31abc9e88f 100644 --- a/pkg/mcs/utils/expected_primary.go +++ b/pkg/mcs/utils/expected_primary.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/mcs/utils/util.go b/pkg/mcs/utils/util.go index 9e187b3a361..92f8a1d1e8b 100644 --- a/pkg/mcs/utils/util.go +++ b/pkg/mcs/utils/util.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/schedule/filter/filters_test.go b/pkg/schedule/filter/filters_test.go index 35ba2c33589..c093f249083 100644 --- a/pkg/schedule/filter/filters_test.go +++ b/pkg/schedule/filter/filters_test.go @@ -4,13 +4,14 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package filter import ( diff --git a/pkg/schedule/schedulers/balance_benchmark_test.go b/pkg/schedule/schedulers/balance_benchmark_test.go index abf4c0b3def..ae807b2c363 100644 --- a/pkg/schedule/schedulers/balance_benchmark_test.go +++ b/pkg/schedule/schedulers/balance_benchmark_test.go @@ -4,13 +4,14 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package schedulers import ( diff --git a/pkg/storage/hot_region_storage.go b/pkg/storage/hot_region_storage.go index b5ec8dda6ba..bbf5fef456d 100644 --- a/pkg/storage/hot_region_storage.go +++ b/pkg/storage/hot_region_storage.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/storage/hot_region_storage_test.go b/pkg/storage/hot_region_storage_test.go index cd713685eb0..92d6a1c96cd 100644 --- a/pkg/storage/hot_region_storage_test.go +++ b/pkg/storage/hot_region_storage_test.go @@ -8,6 +8,7 @@ // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. diff --git a/pkg/storage/leveldb_backend_test.go b/pkg/storage/leveldb_backend_test.go index 0bf626834cd..d4b73ee9059 100644 --- a/pkg/storage/leveldb_backend_test.go +++ b/pkg/storage/leveldb_backend_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/storage/region_storage.go b/pkg/storage/region_storage.go index 8e6a4d87429..e7a744b6f9d 100644 --- a/pkg/storage/region_storage.go +++ b/pkg/storage/region_storage.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/storage/region_storage_test.go b/pkg/storage/region_storage_test.go index c0ae04c8ded..a611420315a 100644 --- a/pkg/storage/region_storage_test.go +++ b/pkg/storage/region_storage_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/unsaferecovery/unsafe_recovery_controller.go b/pkg/unsaferecovery/unsafe_recovery_controller.go index dce2069e316..5ece375f5de 100644 --- a/pkg/unsaferecovery/unsafe_recovery_controller.go +++ b/pkg/unsaferecovery/unsafe_recovery_controller.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/unsaferecovery/unsafe_recovery_controller_test.go b/pkg/unsaferecovery/unsafe_recovery_controller_test.go index 0dab6aeca1d..669ca16de34 100644 --- a/pkg/unsaferecovery/unsafe_recovery_controller_test.go +++ b/pkg/unsaferecovery/unsafe_recovery_controller_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/utils/grpcutil/grpcutil_test.go b/pkg/utils/grpcutil/grpcutil_test.go index db77a2e4002..d11777a3cfc 100644 --- a/pkg/utils/grpcutil/grpcutil_test.go +++ b/pkg/utils/grpcutil/grpcutil_test.go @@ -1,3 +1,17 @@ +// Copyright 2019 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package grpcutil import ( diff --git a/pkg/utils/keypath/cluster_id.go b/pkg/utils/keypath/cluster_id.go index e1117f15738..f12e6205916 100644 --- a/pkg/utils/keypath/cluster_id.go +++ b/pkg/utils/keypath/cluster_id.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/utils/keypath/key_path_test.go b/pkg/utils/keypath/key_path_test.go index 18096ca47bb..e6c2a4c3f6b 100644 --- a/pkg/utils/keypath/key_path_test.go +++ b/pkg/utils/keypath/key_path_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/utils/netutil/address_test.go b/pkg/utils/netutil/address_test.go index 127c9a6d0f7..70302450a7d 100644 --- a/pkg/utils/netutil/address_test.go +++ b/pkg/utils/netutil/address_test.go @@ -4,13 +4,14 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package netutil import ( diff --git a/pkg/utils/tempurl/check_env_dummy.go b/pkg/utils/tempurl/check_env_dummy.go index 58d889bbfd6..81d1acdbe7e 100644 --- a/pkg/utils/tempurl/check_env_dummy.go +++ b/pkg/utils/tempurl/check_env_dummy.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + //go:build !linux // +build !linux diff --git a/pkg/utils/tempurl/check_env_linux.go b/pkg/utils/tempurl/check_env_linux.go index 7e3dffc105b..15c17f55753 100644 --- a/pkg/utils/tempurl/check_env_linux.go +++ b/pkg/utils/tempurl/check_env_linux.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + //go:build linux // +build linux diff --git a/pkg/utils/timerutil/pool.go b/pkg/utils/timerutil/pool.go index cee061201c2..32f76b39572 100644 --- a/pkg/utils/timerutil/pool.go +++ b/pkg/utils/timerutil/pool.go @@ -1,3 +1,17 @@ +// Copyright 2023 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/pkg/utils/timerutil/pool_test.go b/pkg/utils/timerutil/pool_test.go index 3e0575daea3..ad550c7b56a 100644 --- a/pkg/utils/timerutil/pool_test.go +++ b/pkg/utils/timerutil/pool_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/pkg/window/counter.go b/pkg/window/counter.go index c56c202a414..faf8d0dddc6 100644 --- a/pkg/window/counter.go +++ b/pkg/window/counter.go @@ -1,6 +1,3 @@ -// The MIT License (MIT) -// Copyright (c) 2022 go-kratos Project Authors. -// // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// The MIT License (MIT) +// Copyright (c) 2022 go-kratos Project Authors. + package window import ( diff --git a/pkg/window/counter_test.go b/pkg/window/counter_test.go index 2cb25babdba..86a32f53537 100644 --- a/pkg/window/counter_test.go +++ b/pkg/window/counter_test.go @@ -1,6 +1,3 @@ -// The MIT License (MIT) -// Copyright (c) 2022 go-kratos Project Authors. -// // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// The MIT License (MIT) +// Copyright (c) 2022 go-kratos Project Authors. + package window import ( diff --git a/pkg/window/policy.go b/pkg/window/policy.go index 14e33e3ee74..1852ba21ac5 100644 --- a/pkg/window/policy.go +++ b/pkg/window/policy.go @@ -1,6 +1,3 @@ -// The MIT License (MIT) -// Copyright (c) 2022 go-kratos Project Authors. -// // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// The MIT License (MIT) +// Copyright (c) 2022 go-kratos Project Authors. + package window import ( diff --git a/pkg/window/policy_test.go b/pkg/window/policy_test.go index b5a04c03e4b..7289b2c85c0 100644 --- a/pkg/window/policy_test.go +++ b/pkg/window/policy_test.go @@ -1,6 +1,3 @@ -// The MIT License (MIT) -// Copyright (c) 2022 go-kratos Project Authors. -// // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// The MIT License (MIT) +// Copyright (c) 2022 go-kratos Project Authors. + package window import ( diff --git a/pkg/window/reduce.go b/pkg/window/reduce.go index 0df21ff4c4f..f6968d0b72f 100644 --- a/pkg/window/reduce.go +++ b/pkg/window/reduce.go @@ -1,6 +1,3 @@ -// The MIT License (MIT) -// Copyright (c) 2022 go-kratos Project Authors. -// // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// The MIT License (MIT) +// Copyright (c) 2022 go-kratos Project Authors. + package window // Sum the values within the window. diff --git a/pkg/window/window.go b/pkg/window/window.go index 6d7a54131ce..c48e4b96b42 100644 --- a/pkg/window/window.go +++ b/pkg/window/window.go @@ -1,6 +1,3 @@ -// The MIT License (MIT) -// Copyright (c) 2022 go-kratos Project Authors. -// // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// The MIT License (MIT) +// Copyright (c) 2022 go-kratos Project Authors. + package window import "fmt" diff --git a/pkg/window/window_test.go b/pkg/window/window_test.go index 4cedd12ae01..ffc0e5af4bb 100644 --- a/pkg/window/window_test.go +++ b/pkg/window/window_test.go @@ -1,6 +1,3 @@ -// The MIT License (MIT) -// Copyright (c) 2022 go-kratos Project Authors. -// // Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// The MIT License (MIT) +// Copyright (c) 2022 go-kratos Project Authors. + package window import ( diff --git a/server/api/pprof_test.go b/server/api/pprof_test.go index 1bb1668e374..fc3e37adf83 100644 --- a/server/api/pprof_test.go +++ b/server/api/pprof_test.go @@ -4,13 +4,14 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package api import ( diff --git a/tests/integrations/mcs/discovery/register_test.go b/tests/integrations/mcs/discovery/register_test.go index 217d8137e5b..92fe11dbcb0 100644 --- a/tests/integrations/mcs/discovery/register_test.go +++ b/tests/integrations/mcs/discovery/register_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/tests/integrations/mcs/scheduling/api_test.go b/tests/integrations/mcs/scheduling/api_test.go index 55407831df2..75d784dcb6e 100644 --- a/tests/integrations/mcs/scheduling/api_test.go +++ b/tests/integrations/mcs/scheduling/api_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package scheduling_test import ( diff --git a/tests/integrations/mcs/scheduling/server_test.go b/tests/integrations/mcs/scheduling/server_test.go index d79bcb47228..9b01e6e48a6 100644 --- a/tests/integrations/mcs/scheduling/server_test.go +++ b/tests/integrations/mcs/scheduling/server_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/tests/integrations/mcs/tso/server_test.go b/tests/integrations/mcs/tso/server_test.go index 168741204de..84044867409 100644 --- a/tests/integrations/mcs/tso/server_test.go +++ b/tests/integrations/mcs/tso/server_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/tests/integrations/realcluster/cluster.go b/tests/integrations/realcluster/cluster.go index fc5d1bc4441..9485a2aff79 100644 --- a/tests/integrations/realcluster/cluster.go +++ b/tests/integrations/realcluster/cluster.go @@ -1,4 +1,4 @@ -// Copyright 2024 TiKV Authors +// Copyright 2024 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/integrations/realcluster/cluster_id_test.go b/tests/integrations/realcluster/cluster_id_test.go index 82233cd5b8c..32e038e74d4 100644 --- a/tests/integrations/realcluster/cluster_id_test.go +++ b/tests/integrations/realcluster/cluster_id_test.go @@ -1,4 +1,4 @@ -// Copyright 2024 TiKV Authors +// Copyright 2024 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/integrations/realcluster/etcd_key_test.go b/tests/integrations/realcluster/etcd_key_test.go index 10c392834af..c96455e4667 100644 --- a/tests/integrations/realcluster/etcd_key_test.go +++ b/tests/integrations/realcluster/etcd_key_test.go @@ -1,4 +1,4 @@ -// Copyright 2024 TiKV Authors +// Copyright 2024 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/integrations/realcluster/mock_db.go b/tests/integrations/realcluster/mock_db.go index 8a21bc1bb7d..eda12e941df 100644 --- a/tests/integrations/realcluster/mock_db.go +++ b/tests/integrations/realcluster/mock_db.go @@ -1,4 +1,4 @@ -// Copyright 2023 TiKV Authors +// Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/integrations/realcluster/reboot_pd_test.go b/tests/integrations/realcluster/reboot_pd_test.go index 1a042872b93..ef85ea0bf99 100644 --- a/tests/integrations/realcluster/reboot_pd_test.go +++ b/tests/integrations/realcluster/reboot_pd_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 TiKV Authors +// Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/integrations/realcluster/scheduler_test.go b/tests/integrations/realcluster/scheduler_test.go index 0e4d10acd80..4daafdeca27 100644 --- a/tests/integrations/realcluster/scheduler_test.go +++ b/tests/integrations/realcluster/scheduler_test.go @@ -1,4 +1,4 @@ -// Copyright 2024 TiKV Authors +// Copyright 2024 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/integrations/realcluster/ts_test.go b/tests/integrations/realcluster/ts_test.go index 58f50abdf3e..4df0b9181c4 100644 --- a/tests/integrations/realcluster/ts_test.go +++ b/tests/integrations/realcluster/ts_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 TiKV Authors +// Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/integrations/realcluster/util.go b/tests/integrations/realcluster/util.go index a33f9c071c6..fc350832eea 100644 --- a/tests/integrations/realcluster/util.go +++ b/tests/integrations/realcluster/util.go @@ -1,4 +1,4 @@ -// Copyright 2023 TiKV Authors +// Copyright 2023 TiKV Project Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tools/pd-backup/pdbackup/backup_test.go b/tools/pd-backup/pdbackup/backup_test.go index 3734fb6782b..e6dc1e6345f 100644 --- a/tools/pd-backup/pdbackup/backup_test.go +++ b/tools/pd-backup/pdbackup/backup_test.go @@ -1,3 +1,17 @@ +// Copyright 2022 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pdbackup import ( diff --git a/tools/pd-ctl/pdctl/command/global_test.go b/tools/pd-ctl/pdctl/command/global_test.go index 0d1cf74ac74..74efec76d5c 100644 --- a/tools/pd-ctl/pdctl/command/global_test.go +++ b/tools/pd-ctl/pdctl/command/global_test.go @@ -4,13 +4,14 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package command import ( diff --git a/tools/pd-heartbeat-bench/config/config.go b/tools/pd-heartbeat-bench/config/config.go index 41c14845074..42a506b7d50 100644 --- a/tools/pd-heartbeat-bench/config/config.go +++ b/tools/pd-heartbeat-bench/config/config.go @@ -1,3 +1,17 @@ +// Copyright 2022 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package config import ( diff --git a/tools/pd-simulator/simulator/metrics.go b/tools/pd-simulator/simulator/metrics.go index 19e675c56a9..fabd626591e 100644 --- a/tools/pd-simulator/simulator/metrics.go +++ b/tools/pd-simulator/simulator/metrics.go @@ -1,3 +1,17 @@ +// Copyright 2022 TiKV Project Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package simulator import "github.com/prometheus/client_golang/prometheus" diff --git a/tools/pd-ut/alloc/check_env_dummy.go b/tools/pd-ut/alloc/check_env_dummy.go index b9b8eb4827a..1375623c1d8 100644 --- a/tools/pd-ut/alloc/check_env_dummy.go +++ b/tools/pd-ut/alloc/check_env_dummy.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + //go:build !linux // +build !linux diff --git a/tools/pd-ut/alloc/check_env_linux.go b/tools/pd-ut/alloc/check_env_linux.go index c4d20bf6a65..4e1c058bfb6 100644 --- a/tools/pd-ut/alloc/check_env_linux.go +++ b/tools/pd-ut/alloc/check_env_linux.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + //go:build linux // +build linux