MCPcopy
hub / github.com/pingcap/tidb / setPDConfigCommand

Function setPDConfigCommand

br/cmd/br/debug.go:404–433  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

402}
403
404func setPDConfigCommand() *cobra.Command {
405 pdConfigCmd := &cobra.Command{
406 Use: "reset-pd-config-as-default",
407 Short: "reset pd config adjusted by BR to default value",
408 Args: cobra.NoArgs,
409 RunE: func(cmd *cobra.Command, args []string) error {
410 ctx, cancel := context.WithCancel(GetDefaultContext())
411 defer cancel()
412
413 var cfg task.Config
414 if err := cfg.ParseFromFlags(cmd.Flags()); err != nil {
415 return errors.Trace(err)
416 }
417
418 mgr, err := task.NewMgr(ctx, tidbGlue, cfg.PD, cfg.TLS, task.GetKeepalive(&cfg),
419 cfg.CheckRequirements, false, conn.NormalVersionChecker)
420 if err != nil {
421 return errors.Trace(err)
422 }
423 defer mgr.Close()
424
425 if err := mgr.UpdatePDScheduleConfig(ctx); err != nil {
426 return errors.Annotate(err, "fail to update PD merge config")
427 }
428 log.Info("add pd configs succeed")
429 return nil
430 },
431 }
432 return pdConfigCmd
433}
434
435func searchStreamBackupCommand() *cobra.Command {
436 searchBackupCMD := &cobra.Command{

Callers 1

NewDebugCommandFunction · 0.85

Calls 8

ParseFromFlagsMethod · 0.95
CloseMethod · 0.95
NewMgrFunction · 0.92
GetKeepaliveFunction · 0.92
GetDefaultContextFunction · 0.85
WithCancelMethod · 0.80
FlagsMethod · 0.80

Tested by

no test coverage detected