EdColeman commented on code in PR #3003:
URL: https://github.com/apache/accumulo/pull/3003#discussion_r996921869


##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/PropStoreKey.java:
##########
@@ -90,24 +85,33 @@ protected PropStoreKey(final InstanceId instanceId, final 
String path, final ID_
   public static @Nullable PropStoreKey<?> fromPath(final String path) {
     String[] tokens = path.split("/");
 
+    if (tokens.length < 1) {
+      return null;
+    }
+
     InstanceId instanceId;
     try {
       instanceId = InstanceId.of(tokens[IID_TOKEN_POSITION]);
     } catch (ArrayIndexOutOfBoundsException ex) {
       log.warn("Path '{}' is an invalid path for a property cache key", path);
       return null;
     }
-    if (tokens.length < 1 || !tokens[tokens.length - 
1].equals(PROP_NODE_NAME)) {
-      // without tokens or it does not end with PROP_NAME_NAME
-      return null;
-    }
-    if (tokens[TYPE_TOKEN_POSITION].equals(TABLES_NODE_NAME)) {
+
+    String nodeName = "/" + tokens[tokens.length - 1];
+    if (tokens[TYPE_TOKEN_POSITION].equals(TABLES_NODE_NAME) && 
nodeName.equals(ZCONFIG)) {
       return TablePropKey.of(instanceId, 
TableId.of(tokens[ID_TOKEN_POSITION]));
     }
-    if (tokens[TYPE_TOKEN_POSITION].equals(NAMESPACE_NODE_NAME)) {
+
+    if (tokens[TYPE_TOKEN_POSITION].equals(NAMESPACE_NODE_NAME) && 
nodeName.equals(ZCONFIG)) {
       return NamespacePropKey.of(instanceId, 
NamespaceId.of(tokens[ID_TOKEN_POSITION]));
     }
-    return SystemPropKey.of(instanceId);
+
+    if (nodeName.equals(ZCONFIG)) {

Review Comment:
   They are ordered in the most likely occurrence  - in general the number of 
tables > number of namespaces > system so it seemed rational to order the check 
so that what would (hopefully) be more common to be checked first.



-- 
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]

Reply via email to