-
Notifications
You must be signed in to change notification settings - Fork 522
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
HDDS-11946. Require all ozone repair commands to support a --dry-run option #7682
Conversation
@sarvekshayr @Tejaskriya please review |
In my opinion, it would be better to make the Since the primary focus of this PR is to add the |
I think we can decide and implement the default behavior here, that's why I initially created the PR as draft. I have no objection against making dry run the default, but I find |
We can go ahead and use the |
@errose28 could you please review? |
I actually prefer |
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
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.
Thanks for the patch @adoroszlai, LGTM
Thanks @errose28, patch is updated (reverted to previous commit). |
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.
Thanks for working on this @adoroszlai, looks very nicely implemented. Can we add tests for repair commands that they in fact do not make changes accidentally when --dry-run
is given? We might have to do this on a per-command basis, but I'm imagining a test like this:
- Write permissions are removed on the directory with the content to be repaired
- Command is run with
--dry-run
and it should still succeed without raising errors about being unable to modify content
Alternatively something like diff -rq
could be used on the before and after content to check for differences.
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/om/FSORepairTool.java
Show resolved
Hide resolved
We can put this PR on hold until #7689 is merged, and HDDS-12121 and HDDS-12122 are implemented. |
It looks like we will need to add tests individually, so I'm ok with just adding tests for |
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.
+1, The change looks good.
It would be nice if we can have an abstract prepare()
and execute()
method in RepairTool
class, we can only call prepare
for dry-run and skip the execute
part.
It will avoid if
checks in the actual Repair Command implementations.
This will be hard to do for commands like FSORepairTool
. We can merge this PR now and revisit later to see if we can simplify.
Thanks @errose28, @nandakumar131, @sarvekshayr, @Tejaskriya for the review. |
What changes were proposed in this pull request?
--dry-run
option to allozone repair
subcommands that modify state. The new option currently defaults tofalse
, so commands perform repair by default. (Otherwise we'd need to use it as--dry-run=false
.)https://issues.apache.org/jira/browse/HDDS-11946
How was this patch tested?
Enforce
--dry-run
optionAdded unit test to verify that each subcommand under
ozone repair
satisfies one of the following:--dry-run
optionReadOnlySubcommand
(currently onlyQuotaStatus
)Test failure before implementing
ReadOnlyCommand
inQuotaStatus
:Tool operation
Sample output of
ozone repair om fso-tree
from integration tests:Manual test of
ozone repair om update-transaction
in compose environment:CI:
https://github.com/adoroszlai/ozone/actions/runs/12714010228