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

* : Remove binlog related codes #55955

Merged
merged 19 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
245 changes: 12 additions & 233 deletions DEPS.bzl

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions cmd/tidb-server/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ go_library(
"//pkg/server",
"//pkg/session",
"//pkg/session/txninfo",
"//pkg/sessionctx/binloginfo",
"//pkg/sessionctx/variable",
"//pkg/statistics",
"//pkg/store",
"//pkg/store/copr",
"//pkg/store/driver",
"//pkg/store/mockstore",
"//pkg/tidb-binlog/pump_client",
"//pkg/util",
"//pkg/util/cgmon",
"//pkg/util/chunk",
Expand Down Expand Up @@ -66,7 +64,6 @@ go_library(
"@com_github_prometheus_client_golang//prometheus/push",
"@com_github_tikv_client_go_v2//tikv",
"@com_github_tikv_client_go_v2//txnkv/transaction",
"@com_github_tikv_pd_client//:client",
"@org_uber_go_automaxprocs//maxprocs",
"@org_uber_go_zap//:zap",
],
Expand Down
46 changes: 0 additions & 46 deletions cmd/tidb-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@ import (
"github.com/pingcap/tidb/pkg/server"
"github.com/pingcap/tidb/pkg/session"
"github.com/pingcap/tidb/pkg/session/txninfo"
"github.com/pingcap/tidb/pkg/sessionctx/binloginfo"
"github.com/pingcap/tidb/pkg/sessionctx/variable"
"github.com/pingcap/tidb/pkg/statistics"
kvstore "github.com/pingcap/tidb/pkg/store"
"github.com/pingcap/tidb/pkg/store/copr"
"github.com/pingcap/tidb/pkg/store/driver"
"github.com/pingcap/tidb/pkg/store/mockstore"
pumpcli "github.com/pingcap/tidb/pkg/tidb-binlog/pump_client"
"github.com/pingcap/tidb/pkg/util"
"github.com/pingcap/tidb/pkg/util/cgmon"
"github.com/pingcap/tidb/pkg/util/chunk"
Expand Down Expand Up @@ -86,7 +84,6 @@ import (
"github.com/prometheus/client_golang/prometheus/push"
"github.com/tikv/client-go/v2/tikv"
"github.com/tikv/client-go/v2/txnkv/transaction"
pd "github.com/tikv/pd/client"
"go.uber.org/automaxprocs/maxprocs"
"go.uber.org/zap"
)
Expand All @@ -104,7 +101,6 @@ const (
nmPort = "P"
nmCors = "cors"
nmSocket = "socket"
nmEnableBinlog = "enable-binlog"
nmRunDDL = "run-ddl"
nmLogLevel = "L"
nmLogFile = "log-file"
Expand Down Expand Up @@ -209,7 +205,6 @@ func initFlagSet() *flag.FlagSet {
port = fset.String(nmPort, "4000", "tidb server port")
cors = fset.String(nmCors, "", "tidb server allow cors origin")
socket = fset.String(nmSocket, "/tmp/tidb-{Port}.sock", "The socket file to use for connection.")
enableBinlog = flagBoolean(fset, nmEnableBinlog, false, "enable generate binlog")
runDDL = flagBoolean(fset, nmRunDDL, true, "run ddl worker on this tidb-server")
ddlLease = fset.String(nmDdlLease, "45s", "schema lease duration, very dangerous to change only if you know what you do")
tokenLimit = fset.Int(nmTokenLimit, 1000, "the limit of concurrent executed sessions")
Expand Down Expand Up @@ -317,7 +312,6 @@ func main() {
cgmon.StartCgroupMonitor()
setupTracing() // Should before createServer and after setup config.
printInfo()
setupBinlogClient()
setupMetrics()

keyspaceName := keyspace.GetKeyspaceNameBySettings()
Expand Down Expand Up @@ -422,42 +416,6 @@ func createStoreAndDomain(keyspaceName string) (kv.Storage, *domain.Domain) {
return storage, dom
}

func setupBinlogClient() {
cfg := config.GetGlobalConfig()
if !cfg.Binlog.Enable {
return
}

if cfg.Binlog.IgnoreError {
binloginfo.SetIgnoreError(true)
}

var (
client *pumpcli.PumpsClient
err error
)

securityOption := pd.SecurityOption{
CAPath: cfg.Security.ClusterSSLCA,
CertPath: cfg.Security.ClusterSSLCert,
KeyPath: cfg.Security.ClusterSSLKey,
}

if len(cfg.Binlog.BinlogSocket) == 0 {
client, err = pumpcli.NewPumpsClient(cfg.Path, cfg.Binlog.Strategy, parseDuration(cfg.Binlog.WriteTimeout), securityOption)
} else {
client, err = pumpcli.NewLocalPumpsClient(cfg.Path, cfg.Binlog.BinlogSocket, parseDuration(cfg.Binlog.WriteTimeout), securityOption)
}

terror.MustNil(err)

err = logutil.InitLogger(cfg.Log.ToLogConfig())
terror.MustNil(err)

binloginfo.SetPumpsClient(client)
log.Info("tidb-server", zap.Bool("create pumps client success, ignore binlog error", cfg.Binlog.IgnoreError))
}

// Prometheus push.
const zeroDuration = time.Duration(0)

Expand Down Expand Up @@ -561,9 +519,6 @@ func overrideConfig(cfg *config.Config, fset *flag.FlagSet) {
if actualFlags[nmSocket] {
cfg.Socket = *socket
}
if actualFlags[nmEnableBinlog] {
cfg.Binlog.Enable = *enableBinlog
}
if actualFlags[nmRunDDL] {
cfg.Instance.TiDBEnableDDL.Store(*runDDL)
}
Expand Down Expand Up @@ -810,7 +765,6 @@ func setGlobalVars() {
variable.SetSysVar(variable.TiDBForcePriority, mysql.Priority2Str[priority])
variable.SetSysVar(variable.TiDBOptDistinctAggPushDown, variable.BoolToOnOff(cfg.Performance.DistinctAggPushDown))
variable.SetSysVar(variable.TiDBOptProjectionPushDown, variable.BoolToOnOff(cfg.Performance.ProjectionPushDown))
variable.SetSysVar(variable.LogBin, variable.BoolToOnOff(cfg.Binlog.Enable))
variable.SetSysVar(variable.Port, fmt.Sprintf("%d", cfg.Port))
cfg.Socket = strings.Replace(cfg.Socket, "{Port}", fmt.Sprintf("%d", cfg.Port), 1)
variable.SetSysVar(variable.Socket, cfg.Socket)
Expand Down
12 changes: 0 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ require (
github.com/BurntSushi/toml v1.4.0
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/Masterminds/semver v1.5.0
github.com/Shopify/sarama v1.29.0
github.com/YangKeao/go-mysql-driver v0.0.0-20240627104025-dd5589458cfa
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1581
github.com/apache/skywalking-eyes v0.4.0
Expand Down Expand Up @@ -200,9 +199,6 @@ require (
github.com/dennwc/varint v1.0.0 // indirect
github.com/dolthub/maphash v0.1.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/eapache/go-resiliency v1.2.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/fatih/structtag v1.2.0
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect
Expand Down Expand Up @@ -230,17 +226,11 @@ require (
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/huandu/xstrings v1.3.1 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/influxdata/tdigest v0.0.1
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.0.0 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/jfcg/sixb v1.3.8 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jonboulle/clockwork v0.4.0 // indirect
Expand All @@ -266,15 +256,13 @@ require (
github.com/ncw/directio v1.0.5 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1
github.com/pkg/xattr v0.4.9 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
Expand Down
Loading