Skip to content

Commit

Permalink
playground: add warning for deletion of data dir (#2481)
Browse files Browse the repository at this point in the history
* playground: add warning for deletion

Signed-off-by: xhe <[email protected]>

* playground: add warning for deletion

Signed-off-by: xhe <[email protected]>

* address comments

Signed-off-by: xhe <[email protected]>

* Update components/playground/main.go

Co-authored-by: bb7133 <[email protected]>

---------

Signed-off-by: xhe <[email protected]>
Co-authored-by: bb7133 <[email protected]>
  • Loading branch information
xhebox and bb7133 authored Dec 20, 2024
1 parent c39bd6e commit bc0e4a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion components/playground/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Examples:
$ tiup playground nightly --without-monitor # Start a local cluster and disable monitor system
$ tiup playground --pd.config ~/config/pd.toml # Start a local cluster with specified configuration file
$ tiup playground --db.binpath /xx/tidb-server # Start a local cluster with component binary path
$ tiup playground --tag xx # Start a local cluster with data dir named 'xx' and uncleaned after exit
$ tiup playground --mode tikv-slim # Start a local tikv only cluster (No TiDB or TiFlash Available)
$ tiup playground --mode tikv-slim --kv 3 --pd 3 # Start a local tikv only cluster with 6 nodes`,
SilenceUsage: true,
Expand Down Expand Up @@ -278,7 +279,7 @@ Note: Version constraint [bold]%s[reset] is resolved to [green][bold]%s[reset].

rootCmd.Flags().StringVar(&options.Mode, "mode", "tidb", "TiUP playground mode: 'tidb', 'tidb-cse', 'tikv-slim'")
rootCmd.Flags().StringVar(&options.PDMode, "pd.mode", "pd", "PD mode: 'pd', 'ms'")
rootCmd.PersistentFlags().StringVarP(&tag, "tag", "T", "", "Specify a tag for playground") // Use `PersistentFlags()` to make it available to subcommands.
rootCmd.PersistentFlags().StringVarP(&tag, "tag", "T", "", "Specify a tag for playground, data dir of this tag will not be removed after exit")
rootCmd.Flags().Bool("without-monitor", false, "Don't start prometheus and grafana component")
rootCmd.Flags().BoolVar(&options.Monitor, "monitor", true, "Start prometheus and grafana component")
_ = rootCmd.Flags().MarkDeprecated("monitor", "Please use --without-monitor to control whether to disable monitor.")
Expand Down
3 changes: 3 additions & 0 deletions components/playground/playground.go
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,9 @@ func (p *Playground) bootCluster(ctx context.Context, env *environment.Environme
p.tiflashs = started
p.waitAllTiFlashUp()

fmt.Println()
color.New(color.FgYellow, color.Bold).Println("TiDB Playground Cluster will delete all data of the cluster after exit. Please use --tag xx to pin the data dir.")

fmt.Println()
color.New(color.FgGreen, color.Bold).Println("🎉 TiDB Playground Cluster is started, enjoy!")
fmt.Println()
Expand Down
2 changes: 1 addition & 1 deletion doc/user/playground.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Flags:
--pump int Pump instance number
--pump.binpath string Pump instance binary path
--pump.config string Pump instance configuration file
-T, --tag string Specify a tag for playground
-T, --tag string Specify a tag for playground, data dir of this tag will not be removed after exit
--ticdc int TiCDC instance number
--ticdc.binpath string TiCDC instance binary path
--ticdc.config string TiCDC instance configuration file
Expand Down

0 comments on commit bc0e4a9

Please sign in to comment.