anilkumgopalap commented on code in PR #14862:
URL: https://github.com/apache/gravitino/pull/14862#discussion_r4643547381
##########
catalogs/catalog-lakehouse-generic/src/main/java/org/apache/gravitino/catalog/lakehouse/generic/LocationProvider.java:
##########
@@ -253,7 +265,78 @@ public interface TableLocationProvider {
* #provisionTableLocation(TableLocationContext)}, it is called concurrently
and must be
* thread-safe.
*
+ * <p>The result reports whether this call released anything. The catalog
only logs it; it does
+ * not change the outcome of the drop.
+ *
* @param context the table that is gone and the context needed to release
its location
+ * @return true if the provider released an allocation for the location,
false if there was
+ * nothing to release, such as a location it does not recognize or one
already released
+ */
+ boolean unprovisionTableLocation(TableLocationContext context);
+
+ /**
+ * Provisions the location of a schema that is being created. The default
implementation returns
+ * null.
+ *
+ * <p>The context carries the properties of the creation request, including
a caller-supplied
+ * {@code location}, if any. As with tables, what happens to a supplied
location is the provider's
+ * decision: return a location to place the schema there; return null or a
blank string to leave
+ * the location to the caller, in which case the schema is created with the
properties of the
+ * request as they are, including any {@code location} the caller supplied;
or throw to refuse the
+ * creation.
+ *
+ * <p>A location that is returned is stored verbatim as the schema's {@code
location} property.
+ * Because the built-in provider derives the location of a table from its
schema's {@code
+ * location}, recording it also keeps the schema consistent with the tables
placed under it.
+ *
+ * <p>It is called before the schema is stored, and before the catalog finds
out whether a schema
+ * of that name already exists, so it can be called for a name that is
taken; the creation then
+ * fails with {@link SchemaAlreadyExistsException}. A provider that knows
the schema exists may
+ * throw that itself. As with tables, there is no compensating unprovision
for a creation that
+ * fails after this method returned: a provider answering idempotently may
have returned the
+ * allocation of the schema that exists, and releasing it would take it from
that schema.
+ *
+ * @param context the schema being created, with the properties of the
creation request
+ * @return the location to store on the schema, or null or blank to leave
the properties of the
+ * request unchanged
+ * @throws SchemaAlreadyExistsException if the provider knows a schema of
that name exists
+ */
+ @Nullable
+ default String provisionSchemaLocation(SchemaLocationContext context)
+ throws SchemaAlreadyExistsException {
+ return null;
+ }
+
+ /**
+ * Unprovisions the location of a schema that is being dropped. The default
implementation does
+ * nothing and returns false.
+ *
+ * <p>It is called after the tables of the schema are dropped and before the
schema itself is
Review Comment:
Agreed, trimmed it to the contract: when it's called, that it must not
delete content, that a failure fails the drop and it must tolerate being called
again, and what the return value means.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]