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

[Robustness] Add additional fio workloads and fix fio runner #529

Merged
merged 6 commits into from Aug 15, 2020

Conversation

redgoat650
Copy link
Contributor

Add more fio workloads to write files at different depths in random
branches of the generated file system tree.

  • Write files at depth
  • Write files at a specified depth, creating a new directory branch at
    a random depth
  • Delete a random directory at a given depth
  • Delete some or all of the contents of a random directory at
    a specified depth

Additionally, apply fixes to fio runner similar to what was done in #293 for kopia e2e test runner. Add debug flag to suppress logs unless Debug is set

Add more fio workloads to write files at different depths in random
branches of the generated file system tree.

- Write files at depth
- Write files at a specified depth, creating a new directory branch at
a random depth
- Delete a random directory at a given depth
- Delete some or all of the contents of a random directory at
a specified depth
@redgoat650
Copy link
Contributor Author

AppVeyor failure does not look related to this change:

curl -LsS -o C:\\projects\\kopia\\tools\\.tools\\goreleaser-v0.140.1.zip https://github.com/goreleaser/goreleaser/releases/download/v0.140.1/goreleaser_Windows_x86_64.zip
unzip -q C:\\projects\\kopia\\tools\\.tools\\goreleaser-v0.140.1.zip -d C:\\projects\\kopia\\tools\\.tools\\goreleaser-v0.140.1
[C:\projects\kopia\tools\.tools\goreleaser-v0.140.1.zip]
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of C:\projects\kopia\tools\.tools\goreleaser-v0.140.1.zip or
        C:\projects\kopia\tools\.tools\goreleaser-v0.140.1.zip.zip, and cannot find C:\projects\kopia\tools\.tools\goreleaser-v0.140.1.zip.ZIP, period.
make: *** [tools/tools.mk:213: C:\\projects\\kopia\\tools\\.tools\\goreleaser-v0.140.1\\goreleaser.exe] Error 9
Command exited with code 2

@jkowalski is there a way to retrigger? Either I don't have permission or I can't find the button that does it :)

@jkowalski jkowalski merged commit da6b933 into kopia:master Aug 15, 2020
Copy link
Collaborator

@julio-lopez julio-lopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@redgoat650 PTAL at the comments. Thanks.

tests/tools/fio/workload.go Show resolved Hide resolved
tests/tools/fio/workload.go Show resolved Hide resolved
tests/tools/fio/workload.go Show resolved Hide resolved
tests/tools/fio/workload.go Show resolved Hide resolved
}
}

rand.Shuffle(len(dirList), func(i, j int) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the operation ends up being exhaustive at a given depth, what's the objective or benefit of shuffling the order?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understand what your concern is, correct me if I'm wrong.
Yes we'll do an exhaustive search in a given branch, if only a certain subset of directories has the requested depth to conduct the operation.
But if I call, e.g., DeleteDirAtDepth("/", 4) 2 times in a row, I don't want to be limited to only deleting from the initial alphabetical subdirectory /aaaa/aaaa/aaaa/delete_this_directory_first, then /aaaa/aaaa/aaaa/delete_this_directory_second. I actually want a chance of deleting /zzzz/zzzz/zzzz/delete_this_too_by_chance. Since it's recursive, I'll shuffle the subdirectory traversal pick at any given depth so I give a chance to other viable paths that can complete the operation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused.
Is operateAtDepth expected to execute f on a single directory a depth depth? or on all directories that happen to be found at the specified depth?
Should the loop below break, actually return, when err == nil ?
Or is the comment above regarding the case when an error is encountered and then the operation is repeated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operateAtDepth is "keep traversing into deeper subdirectories, picking a random subdirectory each time. Then when you pick a subdirectory that is at the requested depth, pass the path to that subdirectory into the function f to do whatever's needed. For example Deleting a directory at that depth is just f = os.RemoveAll. Deleting the contents of a directory at that depth but leaving the directory itself involves reading all of the contents and calling os.RemoveAll.

We only want to choose among paths that are as deep as the requested depth, so iterating through the subdirectories is only performed when a given branch's depth is not sufficient, which is what I was referring to in the comment above.

/ab
/aa/aa/aa/delete_this_directory

If it's looking for depth 4, it might pick /ab first, then when it doesn't find any subdirectories to further traverse, pops with ErrNoDirFound, in which case the parent loop will iterate within that parent directory and try /aa. That path will end up with a successful operation at depth 4.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but what are the expected semantics?

In the example above with 3 directories at the same level:

  • /aaaa/aaaa/aaaa/delete_this_directory_first
  • /aaaa/aaaa/aaaa/delete_this_directory_second
  • /zzzz/zzzz/zzzz/delete_this_too_by_chance

If DeleteDirAtDepth("/", 4) is called, does a single (random) directory get removed? or do all of them get removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expectation is a single random directory. As soon as a successful operation takes place (e.g. os.RemoveAll), the operateAtDepth stack unwinds, returning err == nil (or any other error, as long as it's not ErrNoDirFound, which only happens if it couldn't find a directory to execute the operation on)

}

// DeleteContentsAtDepth deletes some or all of the contents of a directory
// at the provided depths.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be good to describe what pcnt is, and express it as a probability instead of a percentage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

@julio-lopez julio-lopez deleted the more-fio-workloads branch August 16, 2020 06:03
@redgoat650
Copy link
Contributor Author

Thanks for the added scrutiny @julio-lopez! Great to re-evaluate this code.

redgoat650 referenced this pull request in kastenhq/kopia Aug 21, 2020
Followup on recent PR #529, some suggestions and discussion after it was merged:

- Express probability as float in range [0,1]
- Add a unit test for DeleteContentsAtDepth
- Add a comment on writeFilesAtDepth explaining depth vs branchDepth
- Refactor pickRandSubdirPath for easier readability and understanding

Upon some reflection, I decided to refactor pickRandSubdirPath() to gather indexes and pick randomly from them instead of the previous reservoir sampling approach. I think this is easier to understand going forward without extra explanation, doesn't have much additional memory overhead, and reduces the number of rand calls to 1.
julio-lopez pushed a commit that referenced this pull request Aug 21, 2020
Followup on recent PR #529, some suggestions and discussion after it was merged:

- Express probability as float in range [0,1]
- Add a unit test for DeleteContentsAtDepth
- Add a comment on writeFilesAtDepth explaining depth vs branchDepth
- Refactor pickRandSubdirPath for easier readability and understanding

Upon some reflection, I decided to refactor pickRandSubdirPath() to gather indexes and pick randomly from them instead of the previous reservoir sampling approach. I think this is easier to understand going forward without extra explanation, doesn't have much additional memory overhead, and reduces the number of rand calls to 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants