keith-turner commented on code in PR #4996:
URL: https://github.com/apache/accumulo/pull/4996#discussion_r1819315028
##########
core/src/main/java/org/apache/accumulo/core/clientImpl/Namespaces.java:
##########
@@ -42,7 +38,8 @@ public class Namespaces {
public static boolean exists(ClientContext context, NamespaceId namespaceId)
{
ZooCache zc = context.getZooCache();
- List<String> namespaceIds = zc.getChildren(context.getZooKeeperRoot() +
Constants.ZNAMESPACES);
+ List<String> namespaceIds = new ArrayList<>(NamespaceMapping
Review Comment:
This whole method could be the following oneliner.
```java
return context.getNamespaces().getIdToNameMap().containsKey(namespaceId);
```
This avoids deserializing the json unless needed and it also avoids the
linear scan of the list looking for the id instead doing a lookup in the map
key set.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]