Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
This PR fix the acl module performance problem.
ISSUE TYPE
COMPONENT NAME
acl
ADDITIONAL INFORMATION
When you have more than 7 million files and you have to apply recursive acl, the ansible acl module uses tens of GB of memory.
This is due to the acl module, first try to "apply" acls with the "--test" parameter and analyze the output for any files that change, then apply the setfacl command, and in the last step, run another getfacl command to get the resulting acls, but when you use the recursive option, it makes no sense to get the resulting acls.
With this PR I try to improve performance by making those changes:
First, when you run setfacl with --test, I don't want to get the standard output of the command, the module does not use it, I just want to know if there are any files that change, once I found a file that changes, I terminate the command and do not store the stdout output.
In the last step if I am using the recursive option, I don't want to know the resulting acl, the output only makes sense if there is only one file, not for the recursive one.
With those changes it reduces the memory usage to nothing, before the changes, sometimes, applying it to a file system with more than 7 million files, it used more than 20GB of memory.
It also reduces the execution time, when there is no file that changes, the first step takes the same time, but if there are files that change, the first step is shortened and the last step is not executed.
Command with --check before this PR it also uses gigabytes of ram and the output only shows acls, don't show which file has what acls, so it has no possible use.
Command with --check after this PR: