Skip to content

Commit

Permalink
roachprod: wipe start scripts
Browse files Browse the repository at this point in the history
Previously, cockroach start scripts would remain after the cluster has been
wiped. To avoid issues when restarting a node (which will re-use an existing
start script), the start scripts are also cleaned up during a wipe.

Release note: None
Epic: None
  • Loading branch information
herkolategan committed Jan 13, 2025
1 parent 91a08e7 commit 67527ba
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/roachprod/install/cluster_synced.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,18 +593,23 @@ func (c *SyncedCluster) Wipe(ctx context.Context, l *logger.Logger, preserveCert
var cmd string
if c.IsLocal() {
// Not all shells like brace expansion, so we'll do it here
dirs := []string{"data*", "logs*"}
paths := []string{
"data*",
"logs*",
"cockroach-*.sh",
}
if !preserveCerts {
dirs = append(dirs, fmt.Sprintf("%s*", CockroachNodeCertsDir))
dirs = append(dirs, fmt.Sprintf("%s*", CockroachNodeTenantCertsDir))
paths = append(paths, fmt.Sprintf("%s*", CockroachNodeCertsDir))
paths = append(paths, fmt.Sprintf("%s*", CockroachNodeTenantCertsDir))
}
for _, dir := range dirs {
for _, dir := range paths {
cmd += fmt.Sprintf(`rm -fr %s/%s ;`, c.localVMDir(node), dir)
}
} else {
rmCmds := []string{
fmt.Sprintf(`sudo find /mnt/data* -maxdepth 1 -type f -not -name %s -exec rm -f {} \;`, vm.InitializedFile),
`sudo rm -fr /mnt/data*/{auxiliary,local,tmp,cassandra,cockroach,cockroach-temp*,mongo-data}`,
`sudo rm -fr cockroach-*.sh`,
`sudo rm -fr logs* data*`,
}
if !preserveCerts {
Expand Down

0 comments on commit 67527ba

Please sign in to comment.