Skip to content
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

Add Privilege for Updating Maintenance Properties in Catalog #457

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

Conversation

flyrain
Copy link
Contributor

@flyrain flyrain commented Nov 18, 2024

Description

This is the first PRs to add table maintenance properties in Polaris. This PRs focus on adding a privilege for catalog write maintenance. Please see more details in this design doc, https://docs.google.com/document/d/1Pd_mzZcfvnUvcH98IbwsIYf4eryet1lQDfclKYx-t-M/edit?usp=sharing

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added unit test

Checklist:

Please delete options that are not relevant.

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • If adding new functionality, I have discussed my implementation with the community using the linked GitHub issue

@flyrain flyrain changed the title Add privilege for catalog write maintenance privilege Add a privilege for catalog write maintenance properties Nov 18, 2024
Comment on lines +105 to +106
TABLE_WRITE_MAINTENANCE_PROPERTIES(70, PolarisEntityType.TABLE_LIKE, PolarisEntitySubType.TABLE),
NAMESPACE_WRITE_MAINTENANCE_PROPERTIES(71, PolarisEntityType.NAMESPACE),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR focus on the catalog privilege only. The detailed implementation for table and namespace will be in follow-up PRs.

Comment on lines +24 to +25
COMPACTION(MAINTENANCE_PREFIX + "compaction"),
SNAPSHOT_RETENTION(MAINTENANCE_PREFIX + "snapshot_expiration");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add more types, and validation in follow-up PRs.

@@ -121,6 +122,7 @@ public enum PolarisAuthorizableOperation {
CREATE_CATALOG(CATALOG_CREATE),
GET_CATALOG(CATALOG_READ_PROPERTIES),
UPDATE_CATALOG(CATALOG_WRITE_PROPERTIES),
UPDATE_CATALOG_MAINTENANCE_PROPERTIES(CATALOG_WRITE_MAINTENANCE_PROPERTIES),
Copy link
Contributor

@dimas-b dimas-b Nov 18, 2024

Choose a reason for hiding this comment

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

tangential: This change LGTM, but I'm thinking about breaking down the operation enum into several enums with dedicated scope (operations within a catalog, catalog management (add/remote), permission management)... Just FYI :)

@flyrain flyrain changed the title Add a privilege for catalog write maintenance properties Add Privilege for Updating Maintenance Properties in Catalog Nov 19, 2024

public enum PolarisMaintenanceProperties {
COMPACTION(MAINTENANCE_PREFIX + "compaction"),
SNAPSHOT_RETENTION(MAINTENANCE_PREFIX + "snapshot_expiration");
Copy link
Member

Choose a reason for hiding this comment

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

I think you are referring to the "expire snapshots"? Shouldn't the enum be EXPIRE_SNAPSHOTS to align with iceberg interpretation -> https://iceberg.apache.org/docs/1.4.1/maintenance/#expire-snapshots

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, the enum name says RETENTION but the property has expiration – would be good to standardize.


public enum PolarisMaintenanceProperties {
COMPACTION(MAINTENANCE_PREFIX + "compaction"),
SNAPSHOT_RETENTION(MAINTENANCE_PREFIX + "snapshot_expiration");
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, the enum name says RETENTION but the property has expiration – would be good to standardize.

COMPACTION(MAINTENANCE_PREFIX + "compaction"),
SNAPSHOT_RETENTION(MAINTENANCE_PREFIX + "snapshot_expiration");

private final String value;
Copy link
Contributor

Choose a reason for hiding this comment

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

the name value is misleading, it's rather the property name.

return value;
}

public static PolarisMaintenanceProperties fromValue(String value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the added value of this method, as opposed to PolarisMaintenanceProperties.valueOf()?

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

Successfully merging this pull request may close these issues.

4 participants