Skip to content

Commit

Permalink
use kvproto from release-8.5
Browse files Browse the repository at this point in the history
Signed-off-by: hillium <[email protected]>
  • Loading branch information
YuJuncen committed Jan 16, 2025
1 parent 437952e commit f342b7c
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 150 deletions.
19 changes: 0 additions & 19 deletions br/cmd/br/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ 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 @@ -133,21 +132,3 @@ func newChecksumCommand() *cobra.Command {
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
}
4 changes: 0 additions & 4 deletions br/pkg/restore/snap_client/pitr_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,6 @@ func (c *pitrCollector) verifyCompatibilityFor(fileset *restore.BackupFileSet) e
return errors.Annotatef(berrors.ErrUnsupportedOperation,
"rewrite rule #%d: rewrite timestamp isn't supported when log backup enabled", i)
}
if r.IgnoreAfterTimestamp > 0 || r.IgnoreBeforeTimestamp > 0 {
return errors.Annotatef(berrors.ErrUnsupportedOperation,
"rewrite rule #%d: truncating timestamp isn't supported when log backup enabled", i)
}
}
return nil
}
Expand Down
6 changes: 0 additions & 6 deletions br/pkg/streamhelper/basic_lib_for_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ type fakeStore struct {
onGetRegionCheckpoint func(*logbackup.GetLastFlushTSOfRegionRequest) error
}

// FlushNow implements logbackup.LogBackupClient.
func (f *fakeStore) FlushNow(ctx context.Context, in *logbackup.FlushNowRequest, opts ...grpc.CallOption) (*logbackup.FlushNowResponse, error) {
f.flush()
return &logbackup.FlushNowResponse{}, nil
}

type fakeCluster struct {
mu sync.Mutex
idAlloced uint64
Expand Down
28 changes: 0 additions & 28 deletions br/pkg/task/operator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package operator

import (
"regexp"
"time"

"github.com/pingcap/errors"
Expand All @@ -16,7 +15,6 @@ import (

const (
flagTableConcurrency = "table-concurrency"
flagStorePatterns = "stores"
flagTTL = "ttl"
flagSafePoint = "safepoint"
flagStorage = "storage"
Expand Down Expand Up @@ -189,32 +187,6 @@ func (cfg *MigrateToConfig) Verify() error {
return nil
}

type ForceFlushConfig struct {
task.Config

// StoresPattern matches the address of TiKV.
// The address usually looks like "<host>:20160".
// You may list the store by `pd-ctl stores`.
StoresPattern *regexp.Regexp
}

func DefineFlagsForForceFlushConfig(f *pflag.FlagSet) {
f.String(flagStorePatterns, ".*", "The regexp to match the store peer address to be force flushed.")
}

func (cfg *ForceFlushConfig) ParseFromFlags(flags *pflag.FlagSet) (err error) {
storePat, err := flags.GetString(flagStorePatterns)
if err != nil {
return err
}
cfg.StoresPattern, err = regexp.Compile(storePat)
if err != nil {
return errors.Annotatef(err, "invalid expression in --%s", flagStorePatterns)
}

return cfg.Config.ParseFromFlags(flags)
}

type ChecksumWithRewriteRulesConfig struct {
task.Config
}
Expand Down
77 changes: 0 additions & 77 deletions br/pkg/task/operator/force_flush.go

This file was deleted.

3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ require (
github.com/pingcap/errors v0.11.5-0.20240318064555-6bd07397691f
github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86
github.com/pingcap/fn v1.0.0
github.com/pingcap/kvproto v0.0.0-20250108041715-3b77f2c65c63
github.com/pingcap/kvproto v0.0.0-20250116085028-ef010e9196a4
github.com/pingcap/log v1.1.1-0.20240314023424-862ccc32f18d
github.com/pingcap/sysutil v1.0.1-0.20240311050922-ae81ee01f3a5
github.com/pingcap/tidb/pkg/parser v0.0.0-20211011031125-9b13dc409c5e
Expand Down Expand Up @@ -156,6 +156,7 @@ require (
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/goccy/go-reflect v1.2.0 // indirect
github.com/google/flatbuffers v2.0.8+incompatible // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ github.com/fsouza/fake-gcs-server v1.44.0/go.mod h1:M02aKoTv9Tnlf+gmWnTok1PWVCUH
github.com/fzipp/gocyclo v0.3.1/go.mod h1:DJHO6AUmbdqj2ET4Z9iArSuwWgYDRryYt2wASxc7x3E=
github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps=
github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-asn1-ber/asn1-ber v1.5.4 h1:vXT6d/FNDiELJnLb6hGNa309LMsrCoYFvpwHDF0+Y1A=
github.com/go-asn1-ber/asn1-ber v1.5.4/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
Expand Down Expand Up @@ -672,6 +673,8 @@ github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989/go.mod h1:O17Xtb
github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w=
github.com/pingcap/kvproto v0.0.0-20250108041715-3b77f2c65c63 h1:ThJ7ddLJVk96Iai2HDeyJGuuhrcBtc3HwYKJfuKPLsI=
github.com/pingcap/kvproto v0.0.0-20250108041715-3b77f2c65c63/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8=
github.com/pingcap/kvproto v0.0.0-20250116085028-ef010e9196a4 h1:boKz7Hm3IB2eSqRf+/XvXsJjE6J197iDtxasULHM8mw=
github.com/pingcap/kvproto v0.0.0-20250116085028-ef010e9196a4/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8=
github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM=
github.com/pingcap/log v1.1.0/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=
github.com/pingcap/log v1.1.1-0.20240314023424-862ccc32f18d h1:y3EueKVfVykdpTyfUnQGqft0ud+xVFuCdp1XkVL0X1E=
Expand Down
17 changes: 2 additions & 15 deletions tests/realtikvtest/brietest/pitr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"math"
"os"
"path/filepath"
"regexp"
"strings"
"sync/atomic"
"testing"
Expand All @@ -34,12 +33,9 @@ import (
"github.com/pingcap/log"
"github.com/pingcap/tidb/br/pkg/glue"
"github.com/pingcap/tidb/br/pkg/gluetidb"
"github.com/pingcap/tidb/br/pkg/logutil"
"github.com/pingcap/tidb/br/pkg/streamhelper"
"github.com/pingcap/tidb/br/pkg/summary"
"github.com/pingcap/tidb/br/pkg/task"
"github.com/pingcap/tidb/br/pkg/task/operator"
"github.com/pingcap/tidb/pkg/config"
"github.com/pingcap/tidb/pkg/domain"
"github.com/pingcap/tidb/pkg/kv"
"github.com/pingcap/tidb/pkg/session"
Expand Down Expand Up @@ -136,7 +132,7 @@ func NewLogBackupKit(t *testing.T) *LogBackupKit {
tk := initTestKit(t)
metaCli := streamhelper.NewMetaDataClient(domain.GetDomain(tk.Session()).EtcdClient())
begin := time.Now()
// So the cases can finish faster...
// So the cases can finish faster... If force flush not supported...
tk.MustExec("set config tikv `log-backup.max-flush-interval` = '30s';")
t.Cleanup(func() {
if !t.Failed() {
Expand Down Expand Up @@ -284,16 +280,7 @@ func (kit *LogBackupKit) runAndCheck(f func(context.Context) error) {

func (kit *LogBackupKit) forceFlush() {
kit.runAndCheck(func(ctx context.Context) error {
cfg := task.DefaultConfig()
cfg.PD = append(cfg.PD, config.GetGlobalConfig().Path)
err := operator.RunForceFlush(ctx, &operator.ForceFlushConfig{
Config: cfg,
StoresPattern: regexp.MustCompile(".*"),
})
if err != nil {
log.Warn("[TEST.forceFlush] It seems this version of TiKV doesn't support force flush, the test may be much more slower.",
logutil.ShortError(err))
}
log.Warn("[TEST.forceFlush] This version doesn't support force flush, the test may be much more slower.")
return nil
})
}
Expand Down

0 comments on commit f342b7c

Please sign in to comment.