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

cmd/roachprod: ensure wipe really wipes #41552

Merged
merged 3 commits into from
Oct 13, 2019
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
8 changes: 4 additions & 4 deletions pkg/cmd/roachprod/install/cluster_synced.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ func (c *SyncedCluster) Wipe(preserveCerts bool) {
cmd += fmt.Sprintf(`rm -fr ${HOME}/local/%d/%s ;`, c.Nodes[i], dir)
}
} else {
cmd = `find /mnt/data* -maxdepth 1 -type f -exec rm -f {} \; ;
rm -fr /mnt/data*/{auxiliary,local,tmp,cassandra,cockroach,cockroach-temp*,mongo-data} \; ;
rm -fr logs ;
cmd = `sudo find /mnt/data* -maxdepth 1 -type f -exec rm -f {} \; &&
sudo rm -fr /mnt/data*/{auxiliary,local,tmp,cassandra,cockroach,cockroach-temp*,mongo-data} &&
sudo rm -fr logs &&
`
if !preserveCerts {
cmd += "rm -fr certs* ;\n"
cmd += "sudo rm -fr certs* ;\n"
}
}
return sess.CombinedOutput(cmd)
Expand Down
11 changes: 1 addition & 10 deletions pkg/cmd/roachtest/disk_stall.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ package main
import (
"context"
"fmt"
"io/ioutil"
"math/rand"
"os"
"strings"
"time"

Expand Down Expand Up @@ -48,19 +46,12 @@ func runDiskStalledDetection(
ctx context.Context, t *test, c *cluster, affectsLogDir bool, affectsDataDir bool,
) {
n := c.Node(1)
tmpDir, err := ioutil.TempDir("", "stalled")
if err != nil {
t.Fatal(err)
}
defer func() {
_ = os.RemoveAll(tmpDir)
}()

c.Put(ctx, cockroach, "./cockroach")
c.Run(ctx, n, "sudo umount -f {store-dir}/faulty || true")
c.Run(ctx, n, "mkdir -p {store-dir}/{real,faulty} || true")
// Make sure the actual logs are downloaded as artifacts.
c.Run(ctx, n, "rm -f logs/real && ln -s {store-dir}/real/logs logs/real || true")
c.Run(ctx, n, "rm -f logs && ln -s {store-dir}/real/logs logs || true")

t.Status("setting up charybdefs")

Expand Down
6 changes: 6 additions & 0 deletions pkg/storage/engine/temp_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ func CreateTempDir(parentDir, prefix string, stopper *stop.Stopper) (string, err
return "", err
}

// TempDir creates a directory with permissions 0700. Manually change the
// permissions to be 0755 like every other directory created by cockroach.
if err := os.Chmod(tempPath, 0755); err != nil {
return "", err
}

absPath, err := filepath.Abs(tempPath)
if err != nil {
return "", err
Expand Down