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

playground: add warning for deletion of data dir #2481

Merged
merged 4 commits into from
Dec 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
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
Loading