-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-5.3' into cherry-pick-3525-to-release-5.3
- Loading branch information
Showing
851 changed files
with
6,819 additions
and
3,302 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
FROM golang:1.16-alpine as builder | ||
RUN apk add --no-cache git make bash | ||
WORKDIR /go/src/github.com/pingcap/ticdc | ||
WORKDIR /go/src/github.com/pingcap/tiflow | ||
COPY . . | ||
ENV CDC_ENABLE_VENDOR=0 | ||
RUN make | ||
|
||
FROM alpine:3.12 | ||
RUN apk add --no-cache tzdata bash curl socat | ||
COPY --from=builder /go/src/github.com/pingcap/ticdc/bin/cdc /cdc | ||
COPY --from=builder /go/src/github.com/pingcap/tiflow/bin/cdc /cdc | ||
EXPOSE 8300 | ||
CMD [ "/cdc" ] |
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
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,51 @@ | ||
// Copyright 2021 PingCAP, Inc. | ||
// | ||
// 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, | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package capture | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/pingcap/errors" | ||
cerror "github.com/pingcap/tiflow/pkg/errors" | ||
) | ||
|
||
// httpBadRequestError is some errors that will cause a BadRequestError in http handler | ||
var httpBadRequestError = []*errors.Error{ | ||
cerror.ErrAPIInvalidParam, cerror.ErrSinkURIInvalid, cerror.ErrStartTsBeforeGC, | ||
cerror.ErrChangeFeedNotExists, cerror.ErrTargetTsBeforeStartTs, cerror.ErrTableIneligible, | ||
cerror.ErrFilterRuleInvalid, cerror.ErrChangefeedUpdateRefused, cerror.ErrMySQLConnectionError, | ||
cerror.ErrMySQLInvalidConfig, | ||
} | ||
|
||
// IsHTTPBadRequestError check if a error is a http bad request error | ||
func IsHTTPBadRequestError(err error) bool { | ||
if err == nil { | ||
return false | ||
} | ||
for _, e := range httpBadRequestError { | ||
if e.Equal(err) { | ||
return true | ||
} | ||
|
||
rfcCode, ok := cerror.RFCCode(err) | ||
if ok && e.RFCCode() == rfcCode { | ||
return true | ||
} | ||
|
||
if strings.Contains(err.Error(), string(e.RFCCode())) { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
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,33 @@ | ||
// Copyright 2021 PingCAP, Inc. | ||
// | ||
// 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, | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package capture | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/pingcap/errors" | ||
cerror "github.com/pingcap/tiflow/pkg/errors" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestIsHTTPBadRequestError(t *testing.T) { | ||
err := cerror.ErrAPIInvalidParam.GenWithStack("aa") | ||
require.Equal(t, true, IsHTTPBadRequestError(err)) | ||
err = cerror.ErrAPIInvalidParam.Wrap(errors.New("aa")) | ||
require.Equal(t, true, IsHTTPBadRequestError(err)) | ||
err = cerror.ErrPDEtcdAPIError.GenWithStack("aa") | ||
require.Equal(t, false, IsHTTPBadRequestError(err)) | ||
err = nil | ||
require.Equal(t, false, IsHTTPBadRequestError(err)) | ||
} |
Oops, something went wrong.