This is an automated email from the ASF dual-hosted git repository. krathbun pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit 3f8f41577076a133f9b74c05af79f053e55073c1 Merge: 2198ddf1bd 8b6a49ad9a Author: Kevin Rathbun <kevinrr...@gmail.com> AuthorDate: Wed Apr 16 17:05:20 2025 -0400 Merge branch '2.1' .../main/java/org/apache/accumulo/core/util/Validators.java | 10 ++++++++++ .../java/org/apache/accumulo/manager/FateServiceHandler.java | 11 +++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --cc core/src/main/java/org/apache/accumulo/core/util/Validators.java index c60a118baa,2e3df5f3e9..2d103385cc --- a/core/src/main/java/org/apache/accumulo/core/util/Validators.java +++ b/core/src/main/java/org/apache/accumulo/core/util/Validators.java @@@ -230,11 -231,11 +230,21 @@@ public class Validators if (id == null) { return Optional.of("Table id must not be null"); } - if (MetadataTable.ID.equals(id)) { - return Optional.of( - "Table must not be the " + MetadataTable.NAME + "(Id: " + MetadataTable.ID + ") table"); + if (AccumuloTable.METADATA.tableId().equals(id)) { + return Optional.of("Table must not be the " + AccumuloTable.METADATA.tableName() + "(Id: " + + AccumuloTable.METADATA.tableId() + ") table"); + } + return Validator.OK; + }); + ++ public static final Validator<TableId> NOT_BUILTIN_TABLE_ID = new Validator<>(id -> { ++ if (id == null) { ++ return Optional.of("Table id must not be null"); ++ } ++ if (AccumuloTable.allTableIds().contains(id)) { ++ return Optional.of("Table must not be in the '" + Namespace.ACCUMULO.name() + "' namespace"); + } + return Validator.OK; + }); + } diff --cc server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java index 56ce16b7b1,52320225ba..89428fa026 --- a/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java @@@ -26,8 -26,8 +26,8 @@@ import static org.apache.accumulo.core. import static org.apache.accumulo.core.util.Validators.NEW_TABLE_NAME; import static org.apache.accumulo.core.util.Validators.NOT_BUILTIN_NAMESPACE; import static org.apache.accumulo.core.util.Validators.NOT_BUILTIN_TABLE; ++import static org.apache.accumulo.core.util.Validators.NOT_BUILTIN_TABLE_ID; import static org.apache.accumulo.core.util.Validators.NOT_METADATA_TABLE; --import static org.apache.accumulo.core.util.Validators.NOT_METADATA_TABLE_ID; import static org.apache.accumulo.core.util.Validators.NOT_ROOT_TABLE_ID; import static org.apache.accumulo.core.util.Validators.VALID_TABLE_ID; import static org.apache.accumulo.core.util.Validators.sameNamespaceAs; @@@ -409,7 -383,9 +409,9 @@@ class FateServiceHandler implements Fat case TABLE_ONLINE: { TableOperation tableOp = TableOperation.ONLINE; validateArgumentCount(arguments, tableOp, 1); - final var tableId = validateTableIdArgument(arguments.get(0), tableOp, NOT_ROOT_TABLE_ID); - final var tableId = validateTableIdArgument(arguments.get(0), tableOp, - NOT_ROOT_TABLE_ID.and(NOT_METADATA_TABLE_ID)); ++ final var tableId = ++ validateTableIdArgument(arguments.get(0), tableOp, NOT_BUILTIN_TABLE_ID); + NamespaceId namespaceId = getNamespaceIdFromTableId(tableOp, tableId); final boolean canOnlineOfflineTable; @@@ -437,8 -413,9 +439,9 @@@ case TABLE_OFFLINE: { TableOperation tableOp = TableOperation.OFFLINE; validateArgumentCount(arguments, tableOp, 1); -- final var tableId = validateTableIdArgument(arguments.get(0), tableOp, -- NOT_ROOT_TABLE_ID.and(NOT_METADATA_TABLE_ID)); ++ final var tableId = ++ validateTableIdArgument(arguments.get(0), tableOp, NOT_BUILTIN_TABLE_ID); + NamespaceId namespaceId = getNamespaceIdFromTableId(tableOp, tableId); final boolean canOnlineOfflineTable;