-
Notifications
You must be signed in to change notification settings - Fork 720
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/bucket
- Loading branch information
Showing
79 changed files
with
3,015 additions
and
892 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# 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. | ||
|
||
GO_TOOLS_BIN_PATH := $(shell pwd)/../.tools/bin | ||
PATH := $(GO_TOOLS_BIN_PATH):$(PATH) | ||
SHELL := env PATH='$(PATH)' GOBIN='$(GO_TOOLS_BIN_PATH)' $(shell which bash) | ||
|
||
default: static tidy test | ||
|
||
test: | ||
CGO_ENABLE=1 go test -race -cover | ||
|
||
basic-test: | ||
CGO_ENABLE=1 go test | ||
|
||
ci-test-job: | ||
CGO_ENABLED=1 go test -race -covermode=atomic -coverprofile=covprofile -coverpkg=../... github.com/tikv/pd/client | ||
|
||
install-tools: | ||
cd .. && $(MAKE) install-tools | ||
|
||
static: install-tools | ||
@ gofmt -s -l -d . 2>&1 | awk '{ print } END { if (NR > 0) { exit 1 } }' | ||
@ golangci-lint run -c ../.golangci.yml ./... | ||
@ revive -formatter friendly -config ../revive.toml . | ||
|
||
tidy: | ||
@ go mod tidy | ||
git diff --quiet go.mod go.sum | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// 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 errs | ||
|
||
import "github.com/pingcap/errors" | ||
|
||
const ( | ||
// NotLeaderErr indicates the the non-leader member received the requests which should be received by leader. | ||
NotLeaderErr = "is not leader" | ||
// MismatchLeaderErr indicates the the non-leader member received the requests which should be received by leader. | ||
MismatchLeaderErr = "mismatch leader id" | ||
) | ||
|
||
// client errors | ||
var ( | ||
ErrClientCreateTSOStream = errors.Normalize("create TSO stream failed, %s", errors.RFCCodeText("PD:client:ErrClientCreateTSOStream")) | ||
ErrClientGetTSOTimeout = errors.Normalize("get TSO timeout", errors.RFCCodeText("PD:client:ErrClientGetTSOTimeout")) | ||
ErrClientGetTSO = errors.Normalize("get TSO failed, %v", errors.RFCCodeText("PD:client:ErrClientGetTSO")) | ||
ErrClientGetLeader = errors.Normalize("get leader from %v error", errors.RFCCodeText("PD:client:ErrClientGetLeader")) | ||
ErrClientGetMember = errors.Normalize("get member failed", errors.RFCCodeText("PD:client:ErrClientGetMember")) | ||
) | ||
|
||
// grpcutil errors | ||
var ( | ||
ErrSecurityConfig = errors.Normalize("security config error: %s", errors.RFCCodeText("PD:grpcutil:ErrSecurityConfig")) | ||
) | ||
|
||
// The third-party project error. | ||
// url errors | ||
var ( | ||
ErrURLParse = errors.Normalize("parse url error", errors.RFCCodeText("PD:url:ErrURLParse")) | ||
) | ||
|
||
// grpc errors | ||
var ( | ||
ErrGRPCDial = errors.Normalize("dial error", errors.RFCCodeText("PD:grpc:ErrGRPCDial")) | ||
ErrCloseGRPCConn = errors.Normalize("close gRPC connection failed", errors.RFCCodeText("PD:grpc:ErrCloseGRPCConn")) | ||
) | ||
|
||
// etcd errors | ||
var ( | ||
ErrEtcdTLSConfig = errors.Normalize("etcd TLS config error", errors.RFCCodeText("PD:etcd:ErrEtcdTLSConfig")) | ||
) | ||
|
||
// crypto | ||
var ( | ||
ErrCryptoX509KeyPair = errors.Normalize("x509 keypair error", errors.RFCCodeText("PD:crypto:ErrCryptoX509KeyPair")) | ||
ErrCryptoAppendCertsFromPEM = errors.Normalize("cert pool append certs error", errors.RFCCodeText("PD:crypto:ErrCryptoAppendCertsFromPEM")) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// 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 errs | ||
|
||
import ( | ||
"github.com/pingcap/errors" | ||
"go.uber.org/zap" | ||
"go.uber.org/zap/zapcore" | ||
) | ||
|
||
// ZapError is used to make the log output easier. | ||
func ZapError(err error, causeError ...error) zap.Field { | ||
if err == nil { | ||
return zap.Skip() | ||
} | ||
if e, ok := err.(*errors.Error); ok { | ||
if len(causeError) >= 1 { | ||
err = e.Wrap(causeError[0]).FastGenWithCause() | ||
} else { | ||
err = e.FastGenByArgs() | ||
} | ||
} | ||
return zap.Field{Key: "error", Type: zapcore.ErrorType, Interface: err} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module github.com/tikv/pd/client | ||
|
||
go 1.16 | ||
|
||
require ( | ||
github.com/opentracing/opentracing-go v1.2.0 | ||
github.com/pingcap/check v0.0.0-20211026125417-57bd13f7b5f0 | ||
github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c | ||
github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00 | ||
github.com/pingcap/kvproto v0.0.0-20220106070556-3fa8fa04f898 | ||
github.com/pingcap/log v0.0.0-20211215031037-e024ba4eb0ee | ||
github.com/prometheus/client_golang v1.11.0 | ||
go.uber.org/goleak v1.1.11 | ||
go.uber.org/zap v1.20.0 | ||
google.golang.org/grpc v1.43.0 | ||
) | ||
|
||
replace github.com/pingcap/kvproto v0.0.0-20220215045702-d229fcc888c8 => github.com/bufferflies/kvproto v0.0.0-20220224121437-27ddbf52d12f |
Oops, something went wrong.