Skip to content
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b946bd2
[#12297] feat(secret): Add catalog and schema create-time secrets
lasdf1234 Aug 7, 2026
0ef0553
[#12297] refactor(secret): Align catalog/schema with fileset secret h…
lasdf1234 Aug 7, 2026
e0384fd
[#12297] refactor(secret): Align catalog/schema with SecretMaterial APIs
lasdf1234 Aug 11, 2026
b557334
[#12297] refactor(secret): Align catalog/schema create with #12366 style
lasdf1234 Aug 11, 2026
abfc6a0
[#12297] refactor(secret): Drop listCatalogsInfo filter overload
lasdf1234 Aug 11, 2026
28d1fff
[#12297] refactor(secret): Align catalog/schema create with fileset
lasdf1234 Aug 11, 2026
63a9fb2
[#12297] refactor(secret): Drop needSecretClean in CatalogManager
lasdf1234 Aug 11, 2026
cf541f8
[#12297] refactor(secret): Leave CatalogManager.testConnection unchanged
lasdf1234 Aug 11, 2026
4b78ba1
[#12297] refactor(secret): Restore SchemaCreateRequest final fields
lasdf1234 Aug 11, 2026
08a4387
[#12297] test: Pass required schema props in TestPartitionNormalizeDi…
lasdf1234 Aug 12, 2026
bf9ecc9
[#12297] fix(secret): Preserve null properties when create has no sec…
lasdf1234 Aug 12, 2026
c9da34a
[#12297] chore: Retrigger CI after flaky FrontendIT
lasdf1234 Aug 12, 2026
c32ecdb
[#12297] fix(secret): Address schema/catalog secret cleanup review co…
lasdf1234 Aug 12, 2026
4c28c10
Revert "[#12297] fix(secret): Address schema/catalog secret cleanup r…
lasdf1234 Aug 13, 2026
761d125
[#12297] fix(secret): Persist schema properties on SchemaEntity
lasdf1234 Aug 13, 2026
fea00d9
[#12297] fix(secret): Clean schema/fileset secrets on catalog drop
lasdf1234 Aug 13, 2026
796cd50
[#12297] fix(secret): Avoid mixed-mutability return in fileset snapshot
lasdf1234 Aug 13, 2026
c136a49
[#12297] fix(secret): Clean fileset secrets on schema cascade drop
lasdf1234 Aug 13, 2026
c44237e
[#12297] fix(secret): Do not block schema drop on pre-drop load errors
lasdf1234 Aug 13, 2026
2010fc8
[#12297] fix(api): Clarify unsupported create-with-secrets messages
lasdf1234 Aug 14, 2026
300f240
[#12297] fix(api): Clarify fileset UnsupportedOperationException mess…
lasdf1234 Aug 14, 2026
d5e8785
[#12297] fix(api): Clarify fileset create-with-secrets unsupported me…
lasdf1234 Aug 14, 2026
b4dce2a
[#12297] fix(api): Align unsupported messages with existing conventions
lasdf1234 Aug 14, 2026
b55fc93
[#12297] fix(client): Keep create overloads for binary compatibility
lasdf1234 Aug 14, 2026
e24fe73
[#12297] fix(secret): Preserve schema properties on alterSchema
lasdf1234 Aug 14, 2026
b5af53d
[#12297] refactor(secret): Align schema alter properties with catalog
lasdf1234 Aug 14, 2026
603b947
[#12297] fix(secret): Roll back create secrets only when needClean
lasdf1234 Aug 14, 2026
e0b681e
[#12297] refactor(secret): Move writeSecrets into create lock try
lasdf1234 Aug 14, 2026
78d2bb9
[#12297] fix(secret): Read schema drop secrets from entity store
lasdf1234 Aug 14, 2026
3527020
[#12297] refactor(secret): Inline schema properties load for drop cle…
lasdf1234 Aug 14, 2026
6422be2
[#12297] refactor(secret): Drop filesets via dispatcher on cascade de…
lasdf1234 Aug 14, 2026
accb66c
[#12297] refactor(secret): Inject FilesetDispatcher for cascade drop
lasdf1234 Aug 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 57 additions & 10 deletions api/src/main/java/org/apache/gravitino/SupportsCatalogs.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.gravitino;

import java.util.Collections;
import java.util.Map;
import org.apache.gravitino.annotation.Evolving;
import org.apache.gravitino.exceptions.CatalogAlreadyExistsException;
Expand All @@ -26,6 +27,8 @@
import org.apache.gravitino.exceptions.NoSuchCatalogException;
import org.apache.gravitino.exceptions.NoSuchMetalakeException;
import org.apache.gravitino.exceptions.NonEmptyEntityException;
import org.apache.gravitino.secret.SecretBinding;
import org.apache.gravitino.secret.SecretReference;

/**
* Client interface for supporting catalogs. It includes methods for listing, loading, creating,
Expand Down Expand Up @@ -84,22 +87,66 @@ default boolean catalogExists(String catalogName) {
* the created catalog is the managed catalog, like model, fileset catalog. For the details of the
* provider definition, see {@link CatalogProvider}.
*
* @param catalogName the name of the catalog.
* @param type the type of the catalog.
* @param provider the provider of the catalog, or null if the catalog is a managed catalog.
* @param comment the comment of the catalog.
* @param properties the properties of the catalog.
* @return The created catalog.
* @throws NoSuchMetalakeException If the metalake does not exist.
* @throws CatalogAlreadyExistsException If the catalog already exists.
* <p>Delegates to {@link #createCatalog(String, Catalog.Type, String, String, Map, Map, Map)}
* with empty secret maps.
*
* @param catalogName the name of the catalog
* @param type the type of the catalog
* @param provider the provider of the catalog, or null if the catalog is a managed catalog
* @param comment the comment of the catalog
* @param properties the properties of the catalog
* @return the created catalog
* @throws NoSuchMetalakeException if the metalake does not exist
* @throws CatalogAlreadyExistsException if the catalog already exists
*/
Catalog createCatalog(
default Catalog createCatalog(
String catalogName,
Catalog.Type type,
String provider,
String comment,
Map<String, String> properties)
throws NoSuchMetalakeException, CatalogAlreadyExistsException;
throws NoSuchMetalakeException, CatalogAlreadyExistsException {
return createCatalog(
catalogName,
type,
provider,
comment,
properties,
Collections.emptyMap(),
Collections.emptyMap());
}

/**
* Create a catalog with optional secret maps.
*
* <p>The default implementation rejects create-time secrets. Implementations that support secrets
* must override this method.
*
* @param catalogName the name of the catalog
* @param type the type of the catalog
* @param provider the provider of the catalog, or null if managed
* @param comment the comment of the catalog
* @param properties the properties of the catalog
* @param secretBindings optional property key → binding ({@code provider} + {@code plaintext})
* for write-through
* @param secretReferences optional property key → secret locator ({@code provider} plus
* provider-specific attributes)
* @return the created catalog
* @throws NoSuchMetalakeException if the metalake does not exist
* @throws CatalogAlreadyExistsException if the catalog already exists
* @throws UnsupportedOperationException if create-time secrets are not supported
*/
default Catalog createCatalog(
String catalogName,
Catalog.Type type,
String provider,
String comment,
Map<String, String> properties,
Map<String, SecretBinding> secretBindings,
Map<String, SecretReference> secretReferences)
throws NoSuchMetalakeException, CatalogAlreadyExistsException {
throw new UnsupportedOperationException("Not implemented");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could u use complete error message here? For example. xxxx is not implemented.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Got. Use 'Creating xxx with secrets is not supported' instead.(Consistent with the original code of the project)

}

/**
* Create a managed catalog with specified catalog name, type, comment, and properties.
Expand Down
40 changes: 38 additions & 2 deletions api/src/main/java/org/apache/gravitino/SupportsSchemas.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@

package org.apache.gravitino;

import java.util.Collections;
import java.util.Map;
import org.apache.gravitino.annotation.Evolving;
import org.apache.gravitino.exceptions.NoSuchCatalogException;
import org.apache.gravitino.exceptions.NoSuchSchemaException;
import org.apache.gravitino.exceptions.NonEmptySchemaException;
import org.apache.gravitino.exceptions.SchemaAlreadyExistsException;
import org.apache.gravitino.secret.SecretBinding;
import org.apache.gravitino.secret.SecretReference;

/**
* The client interface to support schema operations. The server side should use the other one with
Expand Down Expand Up @@ -93,15 +96,48 @@ default boolean schemaExists(String schemaName) {
* need the schema with default values applied, use the {@link #loadSchema(String)} method after
* creation.
*
* <p>Delegates to {@link #createSchema(String, String, Map, Map, Map)} with empty secret maps.
*
* @param schemaName The name of the schema.
* @param comment The comment of the schema.
* @param properties The properties of the schema.
* @return The schema as defined by the caller, without all default values.
* @throws NoSuchCatalogException If the catalog does not exist.
* @throws SchemaAlreadyExistsException If the schema already exists.
*/
default Schema createSchema(String schemaName, String comment, Map<String, String> properties)
throws NoSuchCatalogException, SchemaAlreadyExistsException {
return createSchema(
schemaName, comment, properties, Collections.emptyMap(), Collections.emptyMap());
}

/**
* Creates a schema with optional secret maps.
*
* <p>The default implementation rejects create-time secrets. Implementations that support secrets
* must override this method.
*
* @param schemaName The name of the schema.
* @param comment The comment of the schema.
* @param properties The properties of the schema.
* @param secretBindings optional property key → binding ({@code provider} + {@code plaintext})
* for write-through
* @param secretReferences optional property key → secret locator ({@code provider} plus
* provider-specific attributes)
* @return The schema as defined by the caller, without all default values.
* @throws NoSuchCatalogException If the catalog does not exist.
* @throws SchemaAlreadyExistsException If the schema already exists.
* @throws UnsupportedOperationException if create-time secrets are not supported
*/
Schema createSchema(String schemaName, String comment, Map<String, String> properties)
throws NoSuchCatalogException, SchemaAlreadyExistsException;
default Schema createSchema(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Got. Use 'Creating xxx with secrets is not supported' instead.(Consistent with the original code of the project)

String schemaName,
String comment,
Map<String, String> properties,
Map<String, SecretBinding> secretBindings,
Map<String, SecretReference> secretReferences)
throws NoSuchCatalogException, SchemaAlreadyExistsException {
throw new UnsupportedOperationException("Not implemented");
}

/**
* Load metadata properties for a schema.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import org.apache.gravitino.dto.responses.DropResponse;
import org.apache.gravitino.dto.responses.EntityListResponse;
import org.apache.gravitino.dto.responses.SchemaResponse;
import org.apache.gravitino.dto.secret.SecretBindingDTO;
import org.apache.gravitino.dto.secret.SecretReferenceDTO;
import org.apache.gravitino.exceptions.NoSuchCatalogException;
import org.apache.gravitino.exceptions.NoSuchPolicyException;
import org.apache.gravitino.exceptions.NoSuchSchemaException;
Expand All @@ -56,6 +58,8 @@
import org.apache.gravitino.policy.Policy;
import org.apache.gravitino.policy.SupportsPolicies;
import org.apache.gravitino.rest.RESTUtils;
import org.apache.gravitino.secret.SecretBinding;
import org.apache.gravitino.secret.SecretReference;
import org.apache.gravitino.tag.SupportsTags;
import org.apache.gravitino.tag.Tag;

Expand Down Expand Up @@ -167,20 +171,35 @@ public String[] listSchemas(String parentSchema)
}

/**
* Create a new schema with specified identifier, comment and metadata.
* Create a new schema with specified identifier, comment, properties, and optional secret maps.
*
* @param schemaName The name identifier of the schema.
* @param comment The comment of the schema.
* @param properties The properties of the schema.
* @param secretBindings Optional property key → binding ({@code provider} + {@code plaintext})
* for write-through.
* @param secretReferences Optional property key → secret locator ({@code provider} plus
* provider-specific attributes).
* @return The created {@link Schema}.
* @throws NoSuchCatalogException if the catalog with specified namespace does not exist.
* @throws SchemaAlreadyExistsException if the schema with specified identifier already exists.
*/
@Override
public Schema createSchema(String schemaName, String comment, Map<String, String> properties)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do u modify the method signature? We should keep backwards compatibility.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for your review. This issue has been fixed.

public Schema createSchema(
String schemaName,
String comment,
Map<String, String> properties,
Map<String, SecretBinding> secretBindings,
Map<String, SecretReference> secretReferences)
throws NoSuchCatalogException, SchemaAlreadyExistsException {

SchemaCreateRequest req = new SchemaCreateRequest(schemaName, comment, properties);
SchemaCreateRequest req =
new SchemaCreateRequest(
schemaName,
comment,
properties,
SecretBindingDTO.fromSecretBindings(secretBindings),
SecretReferenceDTO.fromSecretReferences(secretReferences));
req.validate();

SchemaResponse resp =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
import org.apache.gravitino.policy.PolicyChange;
import org.apache.gravitino.policy.PolicyContent;
import org.apache.gravitino.policy.PolicyOperations;
import org.apache.gravitino.secret.SecretBinding;
import org.apache.gravitino.secret.SecretReference;
import org.apache.gravitino.tag.Tag;
import org.apache.gravitino.tag.TagChange;
import org.apache.gravitino.tag.TagOperations;
Expand Down Expand Up @@ -137,9 +139,13 @@ public Catalog createCatalog(
Catalog.Type type,
String provider,
String comment,
Map<String, String> properties)
Map<String, String> properties,
Map<String, SecretBinding> secretBindings,
Map<String, SecretReference> secretReferences)
throws NoSuchMetalakeException, CatalogAlreadyExistsException {
return getMetalake().createCatalog(catalogName, type, provider, comment, properties);
return getMetalake()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for your review. This issue has been fixed.

.createCatalog(
catalogName, type, provider, comment, properties, secretBindings, secretReferences);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@
import org.apache.gravitino.dto.responses.TagResponse;
import org.apache.gravitino.dto.responses.UserListResponse;
import org.apache.gravitino.dto.responses.UserResponse;
import org.apache.gravitino.dto.secret.SecretBindingDTO;
import org.apache.gravitino.dto.secret.SecretReferenceDTO;
import org.apache.gravitino.exceptions.CatalogAlreadyExistsException;
import org.apache.gravitino.exceptions.CatalogInUseException;
import org.apache.gravitino.exceptions.GroupAlreadyExistsException;
Expand Down Expand Up @@ -128,6 +130,8 @@
import org.apache.gravitino.policy.PolicyContent;
import org.apache.gravitino.policy.PolicyOperations;
import org.apache.gravitino.rest.RESTUtils;
import org.apache.gravitino.secret.SecretBinding;
import org.apache.gravitino.secret.SecretReference;
import org.apache.gravitino.tag.Tag;
import org.apache.gravitino.tag.TagChange;
import org.apache.gravitino.tag.TagOperations;
Expand Down Expand Up @@ -236,13 +240,18 @@ public Catalog loadCatalog(String catalogName) throws NoSuchCatalogException {
}

/**
* Create a new catalog with specified identifier, type, comment and properties.
* Create a new catalog with specified identifier, type, comment, properties, and optional secret
* maps.
*
* @param catalogName The identifier of the catalog.
* @param type The type of the catalog.
* @param provider The provider of the catalog.
* @param comment The comment of the catalog.
* @param properties The properties of the catalog.
* @param secretBindings Optional property key → binding ({@code provider} + {@code plaintext})
* for write-through.
* @param secretReferences Optional property key → secret locator ({@code provider} plus
* provider-specific attributes).
* @return The created {@link Catalog}.
* @throws NoSuchMetalakeException if the metalake with specified namespace does not exist.
* @throws CatalogAlreadyExistsException if the catalog with specified identifier already exists.
Expand All @@ -253,10 +262,19 @@ public Catalog createCatalog(
Catalog.Type type,
String provider,
String comment,
Map<String, String> properties)
Map<String, String> properties,
Map<String, SecretBinding> secretBindings,
Map<String, SecretReference> secretReferences)
throws NoSuchMetalakeException, CatalogAlreadyExistsException {
CatalogCreateRequest req =
new CatalogCreateRequest(catalogName, type, provider, comment, properties);
new CatalogCreateRequest(
catalogName,
type,
provider,
comment,
properties,
SecretBindingDTO.fromSecretBindings(secretBindings),
SecretReferenceDTO.fromSecretReferences(secretReferences));
req.validate();

CatalogResponse resp =
Expand Down
16 changes: 14 additions & 2 deletions clients/client-python/gravitino/api/supports_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@
# under the License.

from abc import ABC, abstractmethod
from typing import Dict, List, Optional
from types import MappingProxyType
from typing import Dict, List, Mapping, Optional

from gravitino.api.schema import Schema
from gravitino.api.schema_change import SchemaChange
from gravitino.api.secret import SecretBinding, SecretReference
from gravitino.exceptions.base import NoSuchSchemaException

_EMPTY_SECRET_BINDINGS: Mapping[str, SecretBinding] = MappingProxyType({})
_EMPTY_SECRET_REFERENCES: Mapping[str, SecretReference] = MappingProxyType({})


class SupportsSchemas(ABC):
"""
Expand Down Expand Up @@ -79,14 +84,21 @@ def schema_exists(self, schema_name: str) -> bool:

@abstractmethod
def create_schema(
self, schema_name: str, comment: str, properties: Dict[str, str]
self,
schema_name: str,
comment: str,
properties: Dict[str, str],
secret_bindings: Mapping[str, SecretBinding] = _EMPTY_SECRET_BINDINGS,
secret_references: Mapping[str, SecretReference] = _EMPTY_SECRET_REFERENCES,
) -> Schema:
"""Create a schema in the catalog.

Args:
schema_name: The name of the schema.
comment: The comment of the schema.
properties: The properties of the schema.
secret_bindings: Optional property key → binding (provider + plaintext) for write-through.
secret_references: Optional property key → locator attributes.

Raises:
NoSuchCatalogException: If the catalog does not exist.
Expand Down
Loading
Loading