Skip to content

Commit

Permalink
Don't delete files
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutchinson committed Aug 29, 2024
1 parent 1dabdd5 commit eae9c0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cmd/example-posix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This endpoint takes arbitrary data and adds it to a file-based log.

## Using in the hammer

First bring up a new log:
First bring up a new log in one terminal:
```shell
export LOG_PRIVATE_KEY="PRIVATE+KEY+example.com/log/testdata+33d7b496+AeymY/SZAX0jZcJ8enZ5FY1Dz+wTML2yWSkK+9DSF3eg"
export LOG_PUBLIC_KEY="example.com/log/testdata+33d7b496+AeHTu4Q3hEIMHNqc6fASMsq3rKNx280NI+oO5xCFkkSx"
Expand All @@ -15,11 +15,11 @@ export LOG_DIR=/tmp/mylog2
go run ./cmd/example-posix \
--storage_dir=${LOG_DIR} \
--initialise \
--listen=:2025
--listen=:2025 \
--v=2
```

Then run the hammer against the log.
In another terminal, run the hammer against the log.
In this example, we're running 32 writers against the log to add 128 new leaves within 1 minute.

```shell
Expand Down
4 changes: 2 additions & 2 deletions cmd/example-posix/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ func main() {
return posix.WriteCheckpoint(*storageDir, n)
}
if *initialise {
if err := os.RemoveAll(*storageDir); err != nil {
klog.Exitf("Failed to remove existing contents from log directory %q: %v", *storageDir, err)
if files, err := os.ReadDir(*storageDir); err == nil && len(files) > 0 {
klog.Exitf("Cannot initialize a log at a non-empty directory")
}
if err := os.MkdirAll(*storageDir, dirPerm); err != nil {
klog.Exitf("Failed to create log directory %q: %v", *storageDir, err)
Expand Down

0 comments on commit eae9c0e

Please sign in to comment.