Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pingcap/tidb into variable-pipeli…
Browse files Browse the repository at this point in the history
…ned-flush-concurrency

Signed-off-by: ekexium <[email protected]>
  • Loading branch information
ekexium committed Jan 24, 2025
2 parents 65a4623 + 162c899 commit 802cb19
Show file tree
Hide file tree
Showing 1,945 changed files with 92,949 additions and 58,370 deletions.
6 changes: 1 addition & 5 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ run:ci --color=yes

build --announce_rc
build --experimental_guard_against_concurrent_changes
build --experimental_remote_merkle_tree_cache
build --java_language_version=17
build --java_runtime_version=17
build --tool_java_language_version=17
build --tool_java_runtime_version=17
build --incompatible_strict_action_env --incompatible_enable_cc_toolchain_resolution
build:ci --color=yes
build:ci --experimental_remote_cache_compression
Expand All @@ -24,6 +19,7 @@ test:ci --verbose_failures --test_verbose_timeout_warnings
test:ci --test_env=GO_TEST_WRAP_TESTV=1
test:ci --experimental_ui_max_stdouterr_bytes=268435456
test:ci --test_timeout=150,300,900,3600
test:ci --flaky_test_attempts=5
test:race --test_timeout=1200,6000,18000,72000

try-import /data/bazel
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.4.1
8,299 changes: 1,735 additions & 6,564 deletions DEPS.bzl

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ ut: tools/bin/ut tools/bin/xprog failpoint-enable
@$(FAILPOINT_DISABLE)
@$(CLEAN_UT_BINARY)

.PHONY: ut-long
ut-long: tools/bin/ut tools/bin/xprog failpoint-enable
tools/bin/ut --long --race || { $(FAILPOINT_DISABLE); exit 1; }
@$(FAILPOINT_DISABLE)
@$(CLEAN_UT_BINARY)

.PHONY: gotest_in_verify_ci
gotest_in_verify_ci: tools/bin/xprog tools/bin/ut failpoint-enable
@echo "Running gotest_in_verify_ci"
Expand Down Expand Up @@ -297,9 +303,9 @@ failpoint-disable: tools/bin/failpoint-ctl
@$(FAILPOINT_DISABLE)

.PHONY: tools/bin/ut
tools/bin/ut: tools/check/ut.go
tools/bin/ut: tools/check/ut.go tools/check/longtests.go
cd tools/check; \
$(GO) build -o ../bin/ut ut.go
$(GO) build -o ../bin/ut ut.go longtests.go

.PHONY: tools/bin/xprog
tools/bin/xprog: tools/check/xprog/xprog.go
Expand Down Expand Up @@ -489,7 +495,7 @@ mock_lightning: mockgen

.PHONY: gen_mock
gen_mock: mockgen
tools/bin/mockgen -package mock github.com/pingcap/tidb/pkg/disttask/framework/taskexecutor TaskTable,Pool,TaskExecutor,Extension > pkg/disttask/framework/mock/task_executor_mock.go
tools/bin/mockgen -package mock github.com/pingcap/tidb/pkg/disttask/framework/taskexecutor TaskTable,TaskExecutor,Extension > pkg/disttask/framework/mock/task_executor_mock.go
tools/bin/mockgen -package mock github.com/pingcap/tidb/pkg/disttask/framework/scheduler Scheduler,CleanUpRoutine,TaskManager > pkg/disttask/framework/mock/scheduler_mock.go
tools/bin/mockgen -destination pkg/disttask/framework/scheduler/mock/scheduler_mock.go -package mock github.com/pingcap/tidb/pkg/disttask/framework/scheduler Extension
tools/bin/mockgen -embed -package mockexecute github.com/pingcap/tidb/pkg/disttask/framework/taskexecutor/execute StepExecutor > pkg/disttask/framework/mock/execute/execute_mock.go
Expand Down Expand Up @@ -530,7 +536,7 @@ br_bins:

.PHONY: data_parsers
data_parsers: tools/bin/vfsgendev pkg/lightning/mydump/parser_generated.go lightning_web
PATH="$(GOPATH)/bin":"$(PATH)":"$(TOOLS)" protoc -I. -I"$(GOPATH)/src" pkg/lightning/checkpoints/checkpointspb/file_checkpoints.proto --gogofaster_out=.
PATH="$(GOPATH)/bin":"$(PATH)":"$(TOOLS)" protoc -I. -I"$(GOMODCACHE)" pkg/lightning/checkpoints/checkpointspb/file_checkpoints.proto --gogofaster_out=.
tools/bin/vfsgendev -source='"github.com/pingcap/tidb/lightning/pkg/web".Res' && mv res_vfsdata.go lightning/pkg/web/

.PHONY: build_dumpling
Expand Down
7 changes: 4 additions & 3 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

PROJECT=tidb
GOPATH ?= $(shell go env GOPATH)
GOMODCACHE ?= $(shell go env GOMODCACHE)
P=8

# Ensure GOPATH is set before running build process.
Expand Down Expand Up @@ -63,8 +64,8 @@ FILES_TIDB_TESTS := $$(find $$($(PACKAGE_DIRECTORIES_TIDB_TESTS)) -name "*.go")
UNCONVERT_PACKAGES_LIST := go list ./...| grep -vE "lightning\/checkpoints|lightning\/manual|lightning\/common|tidb-binlog\/proto\/go-binlog"
UNCONVERT_PACKAGES := $$($(UNCONVERT_PACKAGES_LIST))

FAILPOINT_ENABLE := find $$PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl enable
FAILPOINT_DISABLE := find $$PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl disable
FAILPOINT_ENABLE := find $$PWD/ -type d -mindepth 1 | grep -vE "(\.git|\.idea|tools)" | xargs tools/bin/failpoint-ctl enable
FAILPOINT_DISABLE := find $$PWD/ -type d -mindepth 1 | grep -vE "(\.git|\.idea|tools)" | xargs tools/bin/failpoint-ctl disable

LDFLAGS += -X "github.com/pingcap/tidb/pkg/parser/mysql.TiDBReleaseVersion=$(shell git describe --tags --dirty --always)"
LDFLAGS += -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBBuildTS=$(shell date -u '+%Y-%m-%d %H:%M:%S')"
Expand Down Expand Up @@ -132,4 +133,4 @@ ifneq ("$(CI)", "")
endif
BAZEL_INSTRUMENTATION_FILTER := --instrument_test_targets --instrumentation_filter=//pkg/...,//br/...,//dumpling/...

NOGO_FLAG=true
NOGO_FLAG=true
3 changes: 3 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ approvers:
- WizardXiao
- wjhuang2016
- wk989898
- wlwilliamx
- wshwsh12
- xhebox
- xiongjiwei
Expand Down Expand Up @@ -142,6 +143,7 @@ reviewers:
- nolouch
- nongfushanquan
- pingyu
- RidRisR
- rleungx
- SeaRise
- shihongzhi
Expand All @@ -150,6 +152,7 @@ reviewers:
- terry1purcell
- Tjianke
- TonsnakeLin
- Tristan1900
- tsthght
- TszKitLo40
- xzhangxian1008
Expand Down
12 changes: 6 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ versions.check(minimum_bazel_version = "6.0.0")

http_archive(
name = "io_bazel_rules_go",
sha256 = "f4a9314518ca6acfa16cc4ab43b0b8ce1e4ea64b81c38d8a3772883f153346b8",
sha256 = "90fe8fb402dee957a375f3eb8511455bd738c7ed562695f4dd117ac7d2d833b1",
urls = [
"http://bazel-cache.pingcap.net:8080/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
"http://ats.apps.svc/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
"http://bazel-cache.pingcap.net:8080/bazelbuild/rules_go/releases/download/v0.52.0/rules_go-v0.52.0.zip",
"http://ats.apps.svc/bazelbuild/rules_go/releases/download/v0.52.0/rules_go-v0.52.0.zip",
"https://cache.hawkingrei.com/bazelbuild/rules_go/releases/download/v0.52.0/rules_go-v0.52.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.52.0/rules_go-v0.52.0.zip",
],
)

Expand Down Expand Up @@ -85,7 +85,7 @@ go_download_sdk(
"https://mirrors.aliyun.com/golang/{}",
"https://dl.google.com/go/{}",
],
version = "1.23.3",
version = "1.23.5",
)

go_register_toolchains(
Expand Down
10 changes: 9 additions & 1 deletion br/cmd/br/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import (

func runBackupCommand(command *cobra.Command, cmdName string) error {
cfg := task.BackupConfig{Config: task.Config{LogProgress: HasLogFile()}}
if err := cfg.ParseFromFlags(command.Flags()); err != nil {
if err := cfg.ParseFromFlags(command.Flags(), false); err != nil {
command.SilenceUsage = false
return errors.Trace(err)
}
overrideDefaultBackupConfigIfNeeded(&cfg, command)

if err := metricsutil.RegisterMetricsForBR(cfg.PD, cfg.KeyspaceName); err != nil {
return errors.Trace(err)
Expand Down Expand Up @@ -216,3 +217,10 @@ func newTxnBackupCommand() *cobra.Command {
task.DefineTxnBackupFlags(command)
return command
}

func overrideDefaultBackupConfigIfNeeded(config *task.BackupConfig, cmd *cobra.Command) {
// override only if flag not set by user
if !cmd.Flags().Changed(task.FlagChecksum) {
config.Checksum = false
}
}
6 changes: 4 additions & 2 deletions br/cmd/br/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ func timestampLogFileName() string {
return filepath.Join(os.TempDir(), time.Now().Format("br.log.2006-01-02T15.04.05Z0700"))
}

// AddFlags adds flags to the given cmd.
func AddFlags(cmd *cobra.Command) {
// DefineCommonFlags defines the common flags for all BR cmd operation.
func DefineCommonFlags(cmd *cobra.Command) {
cmd.Version = build.Info()
cmd.Flags().BoolP(flagVersion, flagVersionShort, false, "Display version information about BR")
cmd.SetVersionTemplate("{{printf \"%s\" .Version}}\n")
Expand All @@ -103,6 +103,8 @@ func AddFlags(cmd *cobra.Command) {
"Set whether to redact sensitive info in log")
cmd.PersistentFlags().String(FlagStatusAddr, "",
"Set the HTTP listening address for the status report service. Set to empty string to disable")

// defines BR task common flags, this is shared by cmd and sql(brie)
task.DefineCommonFlags(cmd.PersistentFlags())

cmd.PersistentFlags().StringP(FlagSlowLogFile, "", "",
Expand Down
2 changes: 1 addition & 1 deletion br/cmd/br/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func main() {
TraverseChildren: true,
SilenceUsage: true,
}
AddFlags(rootCmd)
DefineCommonFlags(rootCmd)
SetDefaultContext(ctx)
rootCmd.AddCommand(
NewDebugCommand(),
Expand Down
42 changes: 42 additions & 0 deletions br/cmd/br/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func newOperatorCommand() *cobra.Command {
cmd.AddCommand(newBase64ifyCommand())
cmd.AddCommand(newListMigrationsCommand())
cmd.AddCommand(newMigrateToCommand())
cmd.AddCommand(newForceFlushCommand())
cmd.AddCommand(newChecksumCommand())
return cmd
}

Expand Down Expand Up @@ -109,3 +111,43 @@ func newMigrateToCommand() *cobra.Command {
operator.DefineFlagsForMigrateToConfig(cmd.Flags())
return cmd
}

func newChecksumCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "checksum-as",
Short: "calculate the checksum with rewrite rules",
Long: "Calculate the checksum of the current cluster (specified by `-u`) " +
"with applying the rewrite rules generated from a backup (specified by `-s`). " +
"This can be used when you have the checksum of upstream elsewhere.",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
cfg := operator.ChecksumWithRewriteRulesConfig{}
if err := cfg.ParseFromFlags(cmd.Flags()); err != nil {
return err
}
ctx := GetDefaultContext()
return operator.RunChecksumTable(ctx, tidbGlue, cfg)
},
}
task.DefineFilterFlags(cmd, []string{"!*.*"}, false)
operator.DefineFlagsForChecksumTableConfig(cmd.Flags())
return cmd
}

func newForceFlushCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "force-flush",
Short: "force a log backup task to flush",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
cfg := operator.ForceFlushConfig{}
if err := cfg.ParseFromFlags(cmd.Flags()); err != nil {
return err
}
ctx := GetDefaultContext()
return operator.RunForceFlush(ctx, &cfg)
},
}
operator.DefineFlagsForForceFlushConfig(cmd.Flags())
return cmd
}
2 changes: 1 addition & 1 deletion br/cmd/br/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

func runRestoreCommand(command *cobra.Command, cmdName string) error {
cfg := task.RestoreConfig{Config: task.Config{LogProgress: HasLogFile()}}
if err := cfg.ParseFromFlags(command.Flags()); err != nil {
if err := cfg.ParseFromFlags(command.Flags(), false); err != nil {
command.SilenceUsage = false
return errors.Trace(err)
}
Expand Down
4 changes: 2 additions & 2 deletions br/pkg/backup/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ go_library(
"//pkg/meta",
"//pkg/meta/model",
"//pkg/statistics/handle",
"//pkg/statistics/handle/util",
"//pkg/statistics/util",
"//pkg/util",
"//pkg/util/table-filter",
"@com_github_google_btree//:btree",
Expand Down Expand Up @@ -79,7 +79,7 @@ go_test(
"//br/pkg/storage",
"//br/pkg/utils",
"//pkg/meta/model",
"//pkg/sessionctx/variable",
"//pkg/sessionctx/vardef",
"//pkg/testkit",
"//pkg/testkit/testsetup",
"//pkg/util/table-filter",
Expand Down
Loading

0 comments on commit 802cb19

Please sign in to comment.