Skip to content

Minor TableOperations changes #5510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kevinrr888
Copy link
Member

  • Added early return true for all system tables for TableOperations.exists()
  • Move built in table check for TableOperations.setTabletAvailability() to be handled on server side instead of client side. Result is RPC now occurs for a built in table, and exception for calling setTabletAvailability on a built in table is changed from IllegalArgumentException to AccumuloException. All the other TableOperations that can't be called on a system table result in an AccumuloException if they are called on a system table, so this change keeps consistency with the other TableOperations
  • This commit additionally made it so that, for all TableOperations, the only validation done on the client side for a table is checking whether the argument is formatted correctly (via Validators.EXISTING_TABLE_NAME and Validators.NEW_TABLE_NAME) (e.g., table name is not blank, not too long, etc.). I believe this was the originally intention with Throw IllegalArgumentException in public API when table names aren't valid #1953

I think this behavior of:

  • IllegalArgumentException - The table name doesn't make sense. Not expected format
  • AccumuloException - The table operation cannot be performed on that table

Makes sense, and is now what occurs for applicable TableOperations. However, could argue that IllegalArgumentException makes sense for passing a system table, we should just be consistent across all TableOperations

- Added early `return true` for all system tables for `TableOperations.exists()`
- Move built in table check for `TableOperations.setTabletAvailability()` to be handled on server side instead of client side. Result is RPC now occurs for a built in table, and exception for calling `setTabletAvailability` on a built in table is changed from `IllegalArgumentException` to `AccumuloException`. All the other `TableOperations` that can't be called on a system table result in an `AccumuloException` if they are called on a system table, so this change keeps consistency with the other `TableOperations`
- This commit additionally made it so that, for all `TableOperations`, on the client side, the only validation done on a table is checking whether the argument is formatted correctly (via Validators.EXISTING_TABLE_NAME and Validators.NEW_TABLE_NAME) (e.g., table name is not blank, not too long, etc.).
@kevinrr888 kevinrr888 added this to the 4.0.0 milestone Apr 25, 2025
@kevinrr888 kevinrr888 self-assigned this Apr 25, 2025
@kevinrr888
Copy link
Member Author

I may add more commits to this PR based on discussions in #5474.

@@ -2243,7 +2241,6 @@ private void validatePropertiesToSet(Map<String,String> opts, Map<String,String>
public void setTabletAvailability(String tableName, Range range, TabletAvailability availability)
throws AccumuloSecurityException, AccumuloException {
EXISTING_TABLE_NAME.validate(tableName);
NOT_BUILTIN_TABLE.validate(tableName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should leave this in, but add the check in FateServiceHandler. No reason for the RPC to the Manager when we know it's going to fail.

Copy link
Member Author

@kevinrr888 kevinrr888 Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case we get an IllegalArgumentException for a built in table here instead of a AccumuloException. I agree that there is no need for the RPC beforehand, but this is the pattern taken for all the other methods:

IllegalArgumentException - The table name doesn't make sense. Not expected format
AccumuloException - The table operation cannot be performed on that table

And was probably the original intention with #1953

and I think it should be consistent across all operations. If we want to keep built in table here, we should have it everywhere applicable on client-side

Copy link
Member Author

@kevinrr888 kevinrr888 Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think IllegalArgumentException would also make sense for system tables with the added benefit of avoiding RPC, we just need to decide what is the behavior across all table operations

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we have two options, make it consistent everywhere, or keep past behavior. I don't think we need to remove the check to keep past behavior, we can just catch the IllegalArgumentException and raise an AccumuloException instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we would want to catch a IAE then immediately throw AE throughout TableOperations

I would prefer to keep it consistent everywhere. This single method is the only one not consistent with the rest, and I don't think it was intentional.

If we want to go with checking for BUILTIN_TABLE, METADATA_TABLE, or ROOT_TABLE on the client side, maybe that could be it's own PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, maybe a compromise would be to remove NOT_BUILTIN_TABLE, but add:

  if (SystemTables.tableNames().contains(tableName) {
    throw new AccumuloException("Cannot set table availability on a system table");
  }

This is similar to what is happening here

Copy link
Member Author

@kevinrr888 kevinrr888 Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code you linked should have been looking at all system tables (or none and just let it be handled server side), so fixed that in c564e58
Also added the suggested change.

@ctubbsii
Copy link
Member

@kevinrr888 This was approved 2 weeks ago, but hasn't yet been merged. Is something blocking this from being able to be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants