This is an automated email from the ASF dual-hosted git repository.
jerryshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new e89916551c [#14878] docs: Clarify fileset location precedence and
lifecycle (#14879)
e89916551c is described below
commit e89916551c5707ec8da7bab6e834bfa678d3d7f1
Author: mchades <[email protected]>
AuthorDate: Wed Nov 11 14:52:10 2026 +0800
[#14878] docs: Clarify fileset location precedence and lifecycle (#14879)
### What changes were proposed in this pull request?
Show how a create request maps `storageLocation` to `unknown`, retains
named and inherited paths, and selects a GVFS default. Document which
directories Gravitino creates and what happens to their data when a
managed or external fileset is dropped.
### Why are the changes needed?
The guides showed the two location fields separately and implied that an
external fileset directory must already exist.
Fixes #14878
### Does this PR introduce _any_ user-facing change?
Documentation only.
### How was this patch tested?
Ran `./gradlew :docs:build` and 94 fileset catalog tests covering
location resolution and create/drop behavior. Verified that the REST and
OpenAPI examples match and resolve to the three paths shown in the
guide.
---
docs/fileset-catalog.md | 17 ++++++++++
docs/filesets.md | 29 ++++++++--------
docs/manage-fileset-metadata-using-gravitino.md | 44 +++++++++++++++++--------
docs/open-api/filesets.yaml | 32 ++++++++++++------
4 files changed, 85 insertions(+), 37 deletions(-)
diff --git a/docs/fileset-catalog.md b/docs/fileset-catalog.md
index e42b474285..ee11d21cb8 100644
--- a/docs/fileset-catalog.md
+++ b/docs/fileset-catalog.md
@@ -224,6 +224,23 @@ setting in the following order of precedence:
2. Schema properties
3. Catalog properties
+### How fileset locations are resolved
+
+Gravitino merges locations by name. At the catalog and schema levels,
`location` supplies the
+reserved name `unknown`, and `location-{name}` supplies a named location. For
example, the
+`landing` catalog below gives `unknown` and `eu` the same URI. Its `raw`
schema overrides only `eu`.
+
+| Level | Property | Value |
+| --- | --- | --- |
+| Catalog `landing` | `location` | `s3a://example-bucket/landing` |
+| Catalog `landing` | `location-eu` | `s3a://example-bucket/landing` |
+| Schema `raw` | `location-eu` | `s3a://example-eu/landing/raw` |
+
+For each name, a fileset location overrides the schema location, which
overrides the catalog
+location. A partial create request inherits the names it omits. For example, a
fileset named
+`raw_events` that supplies only `unknown` and `us` inherits
`s3a://example-eu/landing/raw/raw_events`
+as `eu`. See the [create request and resolved
locations](./manage-fileset-metadata-using-gravitino.md#create-a-fileset-with-several-locations).
+
### Fileset Operations
Refer to [Fileset
operations](./manage-fileset-metadata-using-gravitino.md#fileset-operations)
for more details.
diff --git a/docs/filesets.md b/docs/filesets.md
index f286eca867..5fbb8ac860 100644
--- a/docs/filesets.md
+++ b/docs/filesets.md
@@ -57,17 +57,17 @@ See [How to use GVFS](./how-to-use-gvfs.md).
### Managed and External
-A managed fileset belongs to Gravitino. Creating it creates the directory if
needed, and deleting
-it deletes the data. An existing empty directory can also be used. With
filesystem operations enabled,
-creating a managed fileset on an existing non-empty location is rejected by
default. Register such a
-location as an external fileset, or set `allow-existing-location-as-managed`
to `true` to explicitly
-allow Gravitino to manage the existing data and delete it when the fileset is
dropped.
+With filesystem operations enabled, Gravitino creates missing directories for
both managed and
+external filesets. The fileset type determines what happens on drop.
-An external fileset leaves data lifecycle management to the user. Deleting it
removes only the
-Gravitino record and preserves the files. With filesystem operations enabled,
creating either
-type creates the storage directory if it does not exist.
+- Dropping a managed fileset recursively deletes every resolved fileset
directory and its contents,
+ including directories derived from schema or catalog locations.
+- Dropping an external fileset removes only its metadata and preserves data at
every location.
-Choose the type based on who owns the data and whether dropping the fileset
should delete it.
+With filesystem operations enabled, a managed fileset can use an existing
empty directory.
+To use a non-empty directory, register it as an external fileset or set
+`allow-existing-location-as-managed=true` to let Gravitino delete the existing
data on drop.
+With `disable-filesystem-ops=true`, creating and dropping either type changes
only its metadata.
An existing fileset can be converted between the two types using
[`FilesetChange.updateType`](./manage-fileset-metadata-using-gravitino.md#change-the-fileset-type).
@@ -78,15 +78,16 @@ its metadata, even after conversion to `MANAGED`.
### Storage Locations
-A fileset has at least one storage location and can have several, each with a
name. The default is
-chosen by the `default-location-name` property, and a location supplied
without a name is recorded
-as `unknown`.
+A fileset has at least one named storage location. A location supplied without
a name is recorded
+as `unknown`. With a single location, Gravitino selects it as the default.
With multiple resolved
+names, set `default-location-name` to one of them. GVFS uses this default
unless the reader
+[selects another location](./how-to-use-gvfs.md#examples).
Several locations on one fileset is how the same logical dataset is described
across clusters or
regions, with readers selecting the one they should use rather than each
carrying its own path.
-Locations can also be inherited: a catalog or schema with a `location`
property supplies a base, and
-a fileset created beneath it can take its placement from that rather than
spelling out a full path.
+Filesets inherit locations by name from their schema and catalog. See
+[how fileset locations are
resolved](./fileset-catalog.md#how-fileset-locations-are-resolved).
A location can be a template rather than a fixed path. Placeholders such as
`{{catalog}}`,
`{{schema}}`, `{{user}}`, and `{{project}}` are filled in when the fileset is
created, with values
diff --git a/docs/manage-fileset-metadata-using-gravitino.md
b/docs/manage-fileset-metadata-using-gravitino.md
index 57f5febc41..024d42f8d0 100755
--- a/docs/manage-fileset-metadata-using-gravitino.md
+++ b/docs/manage-fileset-metadata-using-gravitino.md
@@ -19,12 +19,14 @@ managed and external, how storage locations and
placeholders work, and how GVFS
### Create a Fileset
-A fileset needs a name, a type, and a storage location. A `MANAGED` fileset is
created and deleted
-with its data; an `EXTERNAL` one points at a location that already exists.
-With filesystem operations enabled, creating a `MANAGED` fileset on an
existing non-empty location
-is rejected by default. Set `allow-existing-location-as-managed=true` at
creation to explicitly adopt
-that data, including deleting it when the fileset is dropped. An existing
empty directory needs no
-override.
+A `MANAGED` fileset can inherit all its locations from its schema or catalog.
An `EXTERNAL` fileset
+must supply at least one location in the create request.
+
+With filesystem operations enabled, Gravitino creates missing directories for
either type. By
+default, it rejects existing non-empty directories for a `MANAGED` fileset. Set
+`allow-existing-location-as-managed=true` at creation to adopt that data and
delete it on drop.
+An existing empty directory needs no override. With
`disable-filesystem-ops=true`, creation only
+registers the fileset metadata.
<Tabs groupId='language' queryString>
<TabItem value="shell" label="REST">
@@ -75,8 +77,10 @@ fileset = filesets.create_fileset(
### Create a Fileset With Several Locations
-`storageLocations` takes a map of location name to path. The name is what a
reader selects, and
-`default-location-name` picks the one used when none is named.
+The create request accepts both `storageLocation` and `storageLocations`. A
non-null
+`storageLocation` overrides `storageLocations["unknown"]` and keeps the other
named entries.
+In this example, the `raw` schema also supplies
`location-eu=s3a://example-eu/landing/raw`,
+as shown in [the catalog
configuration](./fileset-catalog.md#how-fileset-locations-are-resolved).
<Tabs groupId='language' queryString>
<TabItem value="shell" label="REST">
@@ -85,11 +89,11 @@ fileset = filesets.create_fileset(
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"name": "raw_events",
- "comment": "Raw event drops, two regions",
"type": "MANAGED",
+ "storageLocation": "s3a://example-bucket/imports/raw_events",
"storageLocations": {
- "us": "s3a://example-us/landing/raw_events",
- "eu": "s3a://example-eu/landing/raw_events"
+ "unknown": "s3a://example-bucket/staging/raw_events",
+ "us": "s3a://example-us/landing/raw_events"
},
"properties": {"default-location-name": "us"}
}'
http://localhost:8090/api/metalakes/example/catalogs/landing/schemas/raw/filesets
@@ -98,6 +102,18 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json"
\
</TabItem>
</Tabs>
+The resulting fileset has three locations.
+
+| Name | Fileset path | Source |
+| --- | --- | --- |
+| `unknown` | `s3a://example-bucket/imports/raw_events` | `storageLocation` |
+| `us` | `s3a://example-us/landing/raw_events` | `storageLocations["us"]` |
+| `eu` | `s3a://example-eu/landing/raw/raw_events` | Inherited from the schema
|
+
+With multiple resolved names, `default-location-name` must match one of them.
GVFS uses `us` by
+default here. A reader can [select another
location](./how-to-use-gvfs.md#examples) by specifying
+`unknown` or `eu`.
+
### Create a Fileset From a Location Template
A catalog or schema can carry a location template, and a fileset created
beneath it fills the
@@ -242,8 +258,10 @@ fileset = filesets.alter_fileset(
### Drop a Fileset
-Dropping a `MANAGED` fileset deletes its files. Dropping an `EXTERNAL` one
removes only the
-Gravitino record.
+With filesystem operations enabled, dropping a `MANAGED` fileset deletes every
resolved fileset
+directory and its contents, including directories derived from schema or
catalog locations.
+Dropping an `EXTERNAL` fileset preserves data at every location. With
`disable-filesystem-ops=true`,
+dropping either type removes only its metadata. See [Managed and
External](./filesets.md#managed-and-external).
<Tabs groupId='language' queryString>
<TabItem value="shell" label="REST">
diff --git a/docs/open-api/filesets.yaml b/docs/open-api/filesets.yaml
index c41238e88f..ede7a19dde 100644
--- a/docs/open-api/filesets.yaml
+++ b/docs/open-api/filesets.yaml
@@ -57,6 +57,8 @@ paths:
$ref: "#/components/examples/FilesetCreateRequest"
MultipleLocationsFilesetCreateRequest:
$ref:
"#/components/examples/MultipleLocationsFilesetCreateRequest"
+ MixedLocationsFilesetCreateRequest:
+ $ref:
"#/components/examples/MixedLocationsFilesetCreateRequest"
responses:
"200":
$ref: "#/components/responses/FilesetResponse"
@@ -401,20 +403,18 @@ components:
storageLocation:
type: string
description: >-
- The location of the fileset. When omitted for a managed fileset,
the location is
- derived from its schema, which may inherit locations from the
catalog. External
- filesets must specify a storage location.
+ When non-null, this field sets the reserved "unknown" location and
takes precedence
+ over storageLocations["unknown"]. All other named locations are
retained. A managed
+ fileset may inherit all its locations. An external fileset must
supply at least one
+ location through storageLocation or storageLocations.
nullable: true
storageLocations:
type: object
description: >-
- The named storage locations of the fileset. Locations are resolved
by name:
- request locations override schema locations, which override
catalog locations
- with the same name. Other inherited location names are retained.
Managed filesets
- may omit storageLocations and use locations derived from their
schema and catalog.
- External filesets must specify storage locations. When the
resulting fileset has
- more than one location, including inherited locations, properties
must include
- default-location-name with a value matching one of the resolved
location keys.
+ Locations are resolved by name. Request locations override schema
locations, which
+ override catalog locations with the same name. Omitted names are
inherited. When
+ there is more than one resolved name, properties must include
default-location-name
+ with a value matching one of those names.
nullable: true
default: { }
additionalProperties:
@@ -792,6 +792,18 @@ components:
properties:
default-location-name: primary
+ MixedLocationsFilesetCreateRequest:
+ summary: Use both location fields and select a named default
+ value:
+ name: raw_events
+ type: MANAGED
+ storageLocation: s3a://example-bucket/imports/raw_events
+ storageLocations:
+ unknown: s3a://example-bucket/staging/raw_events
+ us: s3a://example-us/landing/raw_events
+ properties:
+ default-location-name: us
+
FilesetResponse:
value: {
"code": 0,