-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
TESTS: Relax Assertion About Deleting Shard Dir #34120
Conversation
original-brownbear
commented
Sep 27, 2018
- Allow empty state directory to prevent test from failing
- Closes [CI] IndexRecoveryIT.testRerouteRecovery : Paths exist that should have been deleted #32686
* Allow empty state directory to prevent test from failing * Closes elastic#32686
Pinging @elastic/es-distributed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left one small suggestion, looks good otherwise. I think this should also go into the 6.4 branch as we are still actively running CI there.
Set<Path> existingPaths = new HashSet<>(); | ||
for (Path path : paths) { | ||
if (FileSystemUtils.exists(path)) { | ||
existingPaths.add(path); | ||
} | ||
} | ||
// Relaxed assertion for the special case where only the empty state directory exists after deleting | ||
// the shard directory because it was created again as a result of a metadata read action concurrently. | ||
if (existingPaths.size() == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's easier to move the "check if there's only a left-over MetaDataStateFormat.STATE_DIR_NAME
" logic into the if (FileSystemUtils.exists(path)) {
condition above. Then you won't have to remove stuff again from existingPaths
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea that would save a few lines :) sec adjusting
And 5.6. |
@ywelsch applied your suggestion, much nicer this way I think ... with the initial version we would've also lost the logging of the name of the leftover paths. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@ywelsch thanks! |
* TESTS: Relax Assertion About Deleting Shard Dir * Allow empty state directory to prevent test from failing * Closes #32686
* TESTS: Relax Assertion About Deleting Shard Dir * Allow empty state directory to prevent test from failing * Closes #32686
* TESTS: Relax Assertion About Deleting Shard Dir * Allow empty state directory to prevent test from failing * Closes elastic#32686 Backport of elastic#34120 and some associated changes. Co-authored-by: Armin Braun <[email protected]>
Backport to 5.6 wasn't totally trivial so I opened #34266. |
* TESTS: Relax Assertion About Deleting Shard Dir * Allow empty state directory to prevent test from failing * Closes #32686 Backport of #34120 and some associated changes. Co-authored-by: Armin Braun <[email protected]>
* TESTS: Relax Assertion About Deleting Shard Dir * Allow empty state directory to prevent test from failing * Closes #32686
* Retry loading latest state to deal with concurrent deletes of the state file * Relates elastic#34120 that ran into similar concurrency issues with the state files * Closes elastic#36189