meatballspaghetti commented on code in PR #5451:
URL: https://github.com/apache/accumulo/pull/5451#discussion_r2047452311


##########
core/src/main/java/org/apache/accumulo/core/util/tables/TableZooHelper.java:
##########
@@ -62,82 +55,81 @@ public TableZooHelper(ClientContext context) {
    *         getCause() of NamespaceNotFoundException
    */
   public TableId getTableId(String tableName) throws TableNotFoundException {
-    for (AccumuloTable systemTable : AccumuloTable.values()) {
-      if (systemTable.tableName().equals(tableName)) {
-        return systemTable.tableId();
-      }
+    Pair<String,String> qualified = TableNameUtil.qualify(tableName);
+    NamespaceId nid = 
context.getNamespaces().getNameToIdMap().get(qualified.getFirst());
+    if (nid == null) {
+      throw new TableNotFoundException(tableName, new 
NamespaceNotFoundException(null,
+          qualified.getFirst(), "No mapping found for namespace"));
     }
-    try {
-      return 
_getTableIdDetectNamespaceNotFound(EXISTING_TABLE_NAME.validate(tableName));
-    } catch (NamespaceNotFoundException e) {
-      throw new TableNotFoundException(tableName, e);
+    TableId tid = 
context.getTableMapping(nid).getNameToIdMap().get(qualified.getSecond());

Review Comment:
   Case of deleted namespace is addressed in related comment above (`else if 
(data == null) `added to `TableMapping.update` and `requireNonNull` added to 
NamespaceId in `ClientContext.getTableMapping` in [recent 
commit](https://github.com/apache/accumulo/pull/5451/commits/42ada3e5251694d5b11f5cec88cbd47efacaa458)).



-- 
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: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to