Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorter go routine size #3

Open
wants to merge 76 commits into
base: reduce-go-routine-usage
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
45b8a5c
reduce go routine size
sdojjy Jan 17, 2022
e734e65
reduce go routine size
sdojjy Jan 17, 2022
5c209ff
reduce go routine size
sdojjy Jan 18, 2022
a6b74d6
reduce go routine size
sdojjy Jan 18, 2022
1fe5ab5
address comments
sdojjy Jan 19, 2022
162401b
remove notifier
sdojjy Jan 20, 2022
3f730cb
Merge branch 'reduce-go-routine-usage' into sorter-go-routine-size
sdojjy Jan 24, 2022
239a21f
build(deps): bump nanoid from 3.1.30 to 3.2.0 in /dm/ui (#4437)
dependabot[bot] Jan 24, 2022
e5ee9da
wait merger
sdojjy Jan 24, 2022
9dfefbb
wait merger
sdojjy Jan 24, 2022
0236882
pipeline(ticdc): reduce go routine size (#4334)
sdojjy Jan 24, 2022
7461a8f
wait merger
sdojjy Jan 24, 2022
3e43ac0
mq (ticdc): Make mq sink flush resolvedTs async (#4356)
asddongmen Jan 24, 2022
39aaf99
mq (ticdc): Make mq sink flush resolvedTs async (#4356)
asddongmen Jan 24, 2022
a39d7b7
use ticker instead of timer
sdojjy Jan 24, 2022
2b93ae4
use once
sdojjy Jan 24, 2022
b196894
openAPI (ticdc): add some unit tests and migrate related test to test…
asddongmen Jan 24, 2022
7a227b4
tests(ticdc): disable hibernate-regions-compatible to fix tiflash tes…
overvenus Jan 24, 2022
9d0ec39
grafana(dm): fix grafana expr (#4405)
Ehco1996 Jan 25, 2022
43a1d78
consumer(ticdc): update the logic of consumer. (#4129)
3AceShowHand Jan 25, 2022
fd5bad5
fix: data race (#4419)
buchuitoudegou Jan 25, 2022
990327d
dm: adjust lightning loader config (#4034)
glorv Jan 25, 2022
180fa4e
Revert "redo (ticdc): make FlushLogs in manager asynchronously (#4301…
asddongmen Jan 25, 2022
f51e410
errors,version(ticdc): refine ErrCheckClusterVersionFromPD error (#4435)
overvenus Jan 25, 2022
72c5fab
relay/meta(dm): fix potential data races after saving GTID (#4455)
dsdashun Jan 26, 2022
9d7ae48
*(dm): add `--start-time` in DM master (#4261)
lance6716 Jan 26, 2022
03c5232
tests(ticdc): Migrate several test cases to testify (#4199)
zhaoxinyu Jan 26, 2022
462074a
docs(ticdc): add design doc for multiple topics (#4422)
Rustin170506 Jan 26, 2022
c56c1c8
github(dm): add release-note-none for robot pull request (#4481)
Rustin170506 Jan 26, 2022
f917d36
cmd,sink(ticdc): validate changefeed params and revise error message …
overvenus Jan 26, 2022
cdc9fa5
build(deps): bump node-fetch from 2.6.6 to 2.6.7 in /dm/ui (#4441)
dependabot[bot] Jan 27, 2022
650d748
github(dm): add missing schedule property (#4487)
Rustin170506 Jan 27, 2022
757decd
webui(dm): always redircet to index page (#4350)
Ehco1996 Jan 27, 2022
14f8c4f
sink (ticdc): reduce the memory consumption by remove redundant event…
asddongmen Jan 27, 2022
2b45869
master(dm): specify worker when create upstream source (#4167)
jerrylisl Jan 28, 2022
596f558
checkpoint(dm): batch create table (#4477)
buchuitoudegou Jan 28, 2022
f710abb
sink(ticdc): fix duplicated replace when batch-replace is disabled (#…
amyangfei Feb 7, 2022
5c7d238
Optimistic: support start task with inconsistent upstream table schem…
GMHDBJD Feb 7, 2022
b0f52af
syncer(dm): Fix async flush log message (#4500)
db-will Feb 7, 2022
95e751f
dm(ui): support start/pause/resume/delete task (#4412)
zoubingwu Feb 8, 2022
3c410c5
pkg(both): a separate library for DML row change (#4376)
lance6716 Feb 8, 2022
c4f8055
metrics(ticdc): add some log and metrics to owner and processorManage…
CharlesCheung96 Feb 8, 2022
5459951
syncer(dm): enhance error handling about add inject at dml event (#4259)
WizardXiao Feb 8, 2022
da0dda8
master(dm): add cluster id as unique identification of dm-cluster and…
niubell Feb 8, 2022
801bb60
cdc/sink: Kafka support user set configuration (#4512)
3AceShowHand Feb 8, 2022
8dce39f
etcd/client(ticdc): add retry operation for etcd transaction api (#42…
CharlesCheung96 Feb 8, 2022
7fd749e
.github(ticdc): request TiKV version (#4535)
overvenus Feb 9, 2022
be7b742
metrics(dm): fix lag metrics for ddl never updated (#4491)
Ehco1996 Feb 9, 2022
1c1015b
sink(cdc): kafka producer use default configuration. (#4359)
3AceShowHand Feb 9, 2022
85116e4
openapi(dm): add error_msg in task status (#4421)
Ehco1996 Feb 10, 2022
e2d529c
api,owner(ticdc): return error when api fails (#4494)
overvenus Feb 10, 2022
b38ef9c
Merge branch 'master' into sorter-go-routine-size
sdojjy Feb 10, 2022
edad7da
syncer(dm): use DML library (#4313)
lance6716 Feb 11, 2022
7bcfae4
tests(ticdc): fix canal_json_basic charset issue (#4558)
Rustin170506 Feb 11, 2022
8a709d7
cdc/metrics: Integrate sarama producer metrics (#4520)
3AceShowHand Feb 11, 2022
c48f208
syncer(dm): fix startGTID is equal to endGTID (#4386)
lance6716 Feb 13, 2022
f69f168
docs/media(ticdc): update cdc architecture (#4536)
overvenus Feb 13, 2022
fc3b5ad
etcd (ticdc): fix a data race in unit test (#4551)
asddongmen Feb 13, 2022
c3e8be9
checker(dm): support concurrent check (#3975)
okJiang Feb 14, 2022
52f0ade
validation(dm): manage validator life cycle (#4479)
D3Hunter Feb 14, 2022
e230160
test(dm): fix unsteable test TestRedirectRequestToLeader (#4556)
Ehco1996 Feb 14, 2022
7ccbdff
test(dm): fix unsteable test TestFailToStartLeader (#4566)
Ehco1996 Feb 14, 2022
803aa92
syncer(dm): implement start-task --start-time (#4485)
lance6716 Feb 14, 2022
1fb41f9
checker(dm): support optimistic checker (#4329)
okJiang Feb 14, 2022
67a3029
sink(ticdc): fix `Unknown system variable 'transaction_isolation'` fo…
Feb 14, 2022
28fe713
cdc/sink: kafka sink integrate broker level metrics (#4517)
3AceShowHand Feb 15, 2022
9ddc713
test(ticdc): migrate test-infra to testify for cdc/kv pkg (#2899) (#4…
CharlesCheung96 Feb 15, 2022
87cfd44
pkg/actor(ticdc): reduce metrics overhead (#4585)
overvenus Feb 15, 2022
2293dc2
ticdc(sink): remove useless AppendResolvedEvent (#4596)
Rustin170506 Feb 15, 2022
536d8ae
dm: new router compatible with regular expression (#4358)
buchuitoudegou Feb 16, 2022
744a26e
loader(dm): skip feature for nil etcd client (#4599)
lance6716 Feb 16, 2022
e7b0aae
unit(dm): add Kill func for unit (#4035)
Ehco1996 Feb 16, 2022
1c3bf68
cdc/sink: decouple opt out of statistics (#4606)
3AceShowHand Feb 16, 2022
2f4b706
ticdc(mounter): remove unnecessary delete event decode logic (#4602)
Rustin170506 Feb 16, 2022
e9cb7ab
Merge branch 'master' into sorter-go-routine-size
sdojjy Feb 17, 2022
2592e98
revert client
sdojjy Feb 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/ticdc-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ body:
(paste TiDB cluster version here)
```

Upstream TiKV version (execute `tikv-server --version`):

```console
(paste TiKV version here)
```

TiCDC version (execute `cdc version`):

```console
Expand Down
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/dm/ui"
schedule:
interval: "weekly"
# Specify labels for npm pull requests.
labels:
- "dependencies"
- "javascript"
- "release-note-none"
- "skip-issue-check"
# We use this option to make these configurations valid only for PRs with security issues.
open-pull-requests-limit: 0
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ kafka_consumer:
install:
go install ./...

unit_test: check_failpoint_ctl
unit_test: check_failpoint_ctl generate_mock
mkdir -p "$(TEST_DIR)"
$(FAILPOINT_ENABLE)
@export log_level=error;\
Expand Down Expand Up @@ -167,7 +167,7 @@ integration_test_mysql:
integration_test_kafka: check_third_party_binary
tests/integration_tests/run.sh kafka "$(CASE)" "$(START_AT)"

fmt: tools/bin/gofumports tools/bin/shfmt
fmt: tools/bin/gofumports tools/bin/shfmt generate_mock
@echo "gofmt (simplify)"
tools/bin/gofumports -l -w $(FILES) 2>&1 | $(FAIL_ON_STDOUT)
@echo "run shfmt"
Expand Down Expand Up @@ -234,6 +234,9 @@ data-flow-diagram: docs/data-flow.dot
swagger-spec: tools/bin/swag
tools/bin/swag init --parseVendor -generalInfo cdc/api/open.go --output docs/swagger

generate_mock: tools/bin/mockgen
tools/bin/mockgen -source cdc/owner/owner.go -destination cdc/owner/mock/owner_mock.go

clean:
go clean -i ./...
rm -rf *.out
Expand Down Expand Up @@ -277,13 +280,22 @@ dm_generate_openapi: tools/bin/oapi-codegen
cd dm && ../tools/bin/oapi-codegen --config=openapi/spec/types-gen-cfg.yaml openapi/spec/dm.yaml
cd dm && ../tools/bin/oapi-codegen --config=openapi/spec/client-gen-cfg.yaml openapi/spec/dm.yaml

dm_unit_test: check_failpoint_ctl
define run_dm_unit_test
@echo "running unit test for packages:" $(1)
mkdir -p $(DM_TEST_DIR)
$(FAILPOINT_ENABLE)
@export log_level=error; \
$(GOTEST) -timeout 5m -covermode=atomic -coverprofile="$(DM_TEST_DIR)/cov.unit_test.out" $(DM_PACKAGES) \
$(GOTEST) -timeout 5m -covermode=atomic -coverprofile="$(DM_TEST_DIR)/cov.unit_test.out" $(1) \
|| { $(FAILPOINT_DISABLE); exit 1; }
$(FAILPOINT_DISABLE)
endef

dm_unit_test: check_failpoint_ctl
$(call run_dm_unit_test,$(DM_PACKAGES))

# run unit test for the specified pkg only, like `make dm_unit_test_pkg PKG=github.com/pingcap/tiflow/dm/dm/master`
dm_unit_test_pkg: check_failpoint_ctl
$(call run_dm_unit_test,$(PKG))

dm_unit_test_in_verify_ci: check_failpoint_ctl tools/bin/gotestsum tools/bin/gocov tools/bin/gocov-xml
mkdir -p $(DM_TEST_DIR)
Expand Down
72 changes: 72 additions & 0 deletions cdc/api/middleware.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright 2022 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 api

import (
"net/http"
"time"

"github.com/gin-gonic/gin"
"github.com/pingcap/log"
"github.com/pingcap/tiflow/cdc/model"
"go.uber.org/zap"
)

func logMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
start := time.Now()
path := c.Request.URL.Path
query := c.Request.URL.RawQuery
c.Next()

cost := time.Since(start)

err := c.Errors.Last()
var stdErr error
if err != nil {
stdErr = err.Err
}

log.Info(path,
zap.Int("status", c.Writer.Status()),
zap.String("method", c.Request.Method),
zap.String("path", path),
zap.String("query", query),
zap.String("ip", c.ClientIP()),
zap.String("user-agent", c.Request.UserAgent()),
zap.Error(stdErr),
zap.Duration("duration", cost),
)
}
}

func errorHandleMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
c.Next()
// because we will return immediately after an error occurs in http_handler
// there wil be only one error in c.Errors
lastError := c.Errors.Last()
if lastError != nil {
err := lastError.Err
// put the error into response
if IsHTTPBadRequestError(err) {
c.IndentedJSON(http.StatusBadRequest, model.NewHTTPError(err))
} else {
c.IndentedJSON(http.StatusInternalServerError, model.NewHTTPError(err))
}
c.Abort()
return
}
}
}
Loading