-
Notifications
You must be signed in to change notification settings - Fork 1
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
Investigate why TimeBasedDirectoryCleaner counts too many deletes on MacOS #143
Comments
See the |
To clarify, when run on macOS (tested on Catalina and Big Sur), we see more deletes than the total number of directories created. I modified private void waitUntilReachExpectedDeleteCount(TimeBasedDirectoryCleaner cleaner1,
TimeBasedDirectoryCleaner cleaner2,
int expectedDeleteCount) {
await().atMost(TEN_SECONDS).until(() -> {
long aggregateDeleteCount = cleaner1.getDeleteCount() + cleaner2.getDeleteCount();
if (aggregateDeleteCount > expectedDeleteCount) {
LOG.warn("expectedDeleteCount: {} ; aggregateDeleteCount: {}", expectedDeleteCount, aggregateDeleteCount);
}
return aggregateDeleteCount >= expectedDeleteCount;
});
} Here is output from the most recent time I ran this test: For
For
|
This test is in |
Ok, I have a theory as to why this isn't working. When I introduce a small delay in between the two |
Yes, pretty sure the code works, given that we've used it in production for years now. So changing the code isn't necessary, which is what I think you are saying, only the test? |
Correct, this is only a test change. |
The small delay in setting up the 2 cleaners can be as low as 200ms for the test using 500 files and 400ms for the test using 2000 files. That is enough time for them both to delete but not step on each other. |
And only add this delay on macOS? e.g. |
Change the concurrent test in TimeBasedDirectoryCleanerConfigTest so that it uses '>=' instead of '==' on macOS when waiting for number of deletions and when making assertions about the total delete count. This accommodates (though certainly doesn't explain) the behavior we see on macOS in which there are more successful deletions than there are files created. On Linux (CentOS as well as Ubuntu) we have never seen that behavior, so for those OSes we retain the strict equality check. Relates to #143 (which is already closed)
* Refactor TimeBasedDirectoryCleanerConfigTest for macOS vs Linux Change the concurrent test in TimeBasedDirectoryCleanerConfigTest so that it uses '>=' instead of '==' on macOS when waiting for number of deletions and when making assertions about the total delete count. This accommodates (though certainly doesn't explain) the behavior we see on macOS in which there are more successful deletions than there are files created. On Linux (CentOS as well as Ubuntu) we have never seen that behavior, so for those OSes we retain the strict equality check. Relates to #143 (which is already closed)
No description provided.
The text was updated successfully, but these errors were encountered: