Attila Doroszlai created HDDS-14115:
---------------------------------------
Summary: Reduce List creation for inheriting prefix ACL
Key: HDDS-14115
URL: https://issues.apache.org/jira/browse/HDDS-14115
Project: Apache Ozone
Issue Type: Improvement
Components: Ozone Manager
Reporter: Attila Doroszlai
Assignee: Attila Doroszlai
{{PrefixManagerImpl#getLongestPrefixPathHelper}} converts and collects the
whole list:
{code:title=https://github.com/apache/ozone/blob/0d1ceb35ec29b62381270ff08e8de610fb734345/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/PrefixManagerImpl.java#L198-L200}
private List<OmPrefixInfo> getLongestPrefixPathHelper(String prefixPath) {
return prefixTree.getLongestPrefixPath(prefixPath).stream()
.map(c -> c.getValue()).collect(Collectors.toList());
{code}
but only the last item of the list is ever used:
{code:title=https://github.com/apache/ozone/blob/0d1ceb35ec29b62381270ff08e8de610fb734345/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/PrefixManagerImpl.java#L296-L301}
List<OmPrefixInfo> prefixList = getLongestPrefixPathHelper(
prefixTree.getLongestPrefix(ozoneObj.getPath()));
if (!prefixList.isEmpty()) {
// Add all acls from direct parent to key.
OmPrefixInfo parentPrefixInfo = prefixList.get(prefixList.size() - 1);
{code}
and:
{code:title=https://github.com/apache/ozone/blob/0d1ceb35ec29b62381270ff08e8de610fb734345/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRequest.java#L343-L351}
List< OmPrefixInfo > prefixList = prefixManager.getLongestPrefixPath(
OZONE_URI_DELIMITER +
keyArgs.getVolumeName() + OZONE_URI_DELIMITER +
keyArgs.getBucketName() + OZONE_URI_DELIMITER +
keyArgs.getKeyName());
if (!prefixList.isEmpty()) {
// Add all acls from direct parent to key.
OmPrefixInfo prefixInfo = prefixList.get(prefixList.size() - 1);
{code}
So these usages could be replaced with using {{getLastNodeInPrefixPath}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]