jerryshao commented on code in PR #15025:
URL: https://github.com/apache/gravitino/pull/15025#discussion_r4613805553
##########
design-docs/domain-design.md:
##########
@@ -58,23 +58,23 @@ DomainRel { parentId, childId, audit_info } // one
edge per subdomain
- Domains live under a metalake. A subdomain and its parent are in the same
metalake.
- Domain names are unique within a metalake across both levels: top-level
domains and subdomains share one namespace, so a domain is addressed by its
name alone. Domain names follow the same constraints as tag names (up to 128
characters) and may contain `/` (see REST API, Encoding).
- A unique index on `DomainRel (child_id, deleted_at)` keeps one parent per
domain. `parent` is not stored on `Domain`; the API derives it. Dropping the
index and checks would allow multiple parents later without a data migration.
-- The backing tag is stored on the domain row as the tag's ID and an optional
value, with an index on `(metalake_id, backing_tag_id, backing_tag_value,
deleted_at)` for the reverse lookup "which domain does this (tag, value) back".
`DOMAIN` is not a taggable object type, so the tag code paths are unchanged
(see Alternatives considered).
+- The backing tag is stored on the domain row as the tag's ID, with an index
on `(metalake_id, backing_tag_id, backing_tag_value, deleted_at)` for the
reverse lookup "which domain does this tag back". The `backing_tag_value`
column is kept in storage for a possible future extension, but the API never
sets it. Domains created by 2.0.0 development builds with a value keep
filtering membership by it; to clear the values, bind each domain to its own
tag with `PUT /domains/{domain}/backingTag`. When several domains share one tag
through different values (for example `department=finance` and
`department=risk`), the existing assignments stay on the old tag, so switching
to dedicated tags drops every member that carries only the old tag. To preserve
membership: (1) record each domain's current members with `GET
/domains/{domain}/objects`; (2) create the dedicated tags and assign each to
the recorded direct members of its domain; (3) switch the bindings to the
dedicated tags; (4) optionally
remove the old tag's assignments by name. `DOMAIN` is not a taggable object
type, so the tag code paths are unchanged (see Alternatives considered).
Review Comment:
Fixed in 50b2415000: the steps now record each domain's own leaf members
with `expand=true` (Direct or Inherited relations) and assign the new tag
directly to those leaves, with the schema/table widening example and a note
that the operator needs read and tag-assignment access to every affected object.
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
##########
design-docs/domain-design.md:
##########
@@ -214,27 +213,27 @@ Under `/api/metalakes/{metalake}`, following Gravitino
conventions: `?details=`
| Operation | Endpoint
| Request → response
|
| :----------------------- |
:---------------------------------------------------------------------------- |
:-----------------------------------------------------------------------------------------------------------
|
| List | `GET /domains?details=false`
| → `NameListResponse` / `DomainListResponse`
|
-| Create | `POST /domains`
| `DomainCreateRequest{name, comment, properties,
backingTag{name, value, create}, parent}` → `DomainResponse` |
+| Create | `POST /domains`
| `DomainCreateRequest{name, comment, properties,
backingTag{name, create}, parent}` → `DomainResponse` |
| Get | `GET /domains/{domain}`
| → `DomainResponse`
|
| Alter | `PUT /domains/{domain}`
| `DomainUpdatesRequest{updates: [rename,
updateComment, setProperty, removeProperty]}` → `DomainResponse` |
| Publish / unpublish | `PATCH /domains/{domain}`
| `DomainSetRequest{status}` → `DomainResponse`
|
| Drop | `DELETE /domains/{domain}`
| → `DropResponse` (`false` if absent)
|
| Attach / move | `PUT /domains/{domain}/parent`
| `DomainParentSetRequest{parent}` →
`DomainResponse` |
| Detach | `DELETE /domains/{domain}/parent`
| → `DomainResponse` (no-op for a top-level domain)
|
-| Set / remove backing tag | `PUT /domains/{domain}/backingTag`
| `DomainBackingTagSetRequest{backingTag{name,
value}}` (null `backingTag` removes it) → `DomainResponse` |
+| Set / remove backing tag | `PUT /domains/{domain}/backingTag`
| `DomainBackingTagSetRequest{backingTag{name}}`
(null `backingTag` removes it) → `DomainResponse` |
| List subdomains | `GET /domains/{domain}/subdomains?details=false`
| → `NameListResponse` / `DomainListResponse`
|
| List members | `GET /domains/{domain}/objects`
| → `DomainMemberListResponse`
|
| Domains of an object | `GET
/objects/{type}/{fullName}/domains?details=false` (leaf types only) | →
`NameListResponse` / `DomainListResponse`
|
| Add / remove members | Existing `POST /objects/{type}/{fullName}/tags`
with the domain's backing tag | `TagValuesAssociateRequest` (v2) or
`TagsAssociateRequest` (v1) |
```
-DomainDTO { name, comment, properties, status, parent, backingTag{name,
value}, audit,
+DomainDTO { name, comment, properties, status, parent, backingTag{name},
audit,
relations? } // [{relation, source?}], only on domains of
an object
DomainMemberDTO { object: MetadataObjectDTO, relations: [{relation, source?}] }
```
-- **Create**: `backingTag.create = true` creates a new tag with the given name
(no `value`); `false` binds the existing (tag, value). Domain, new tag and
parent edge are written in one transaction; on any failure nothing is created,
and no new tag is left behind.
-- **Membership requests**: adding a member with a value needs the v2
`TagValuesAssociateRequest` (`Content-Type:
application/vnd.gravitino.v2+json`), which carries (name, value) pairs.
Removing a tag by name with the v1 `TagsAssociateRequest` removes all its
values on the object. The Java and Python clients already support both.
+- **Create**: `backingTag.create = true` creates a new tag with the given
name; `false` binds the existing tag. Domain, new tag and parent edge are
written in one transaction; on any failure nothing is created, and no new tag
is left behind.
+- **Membership requests**: a member is added by assigning the backing tag,
without a value or, for a tag with an allowed-values list, with one of its
allowed values, with the v1 `TagsAssociateRequest` or the v2
`TagValuesAssociateRequest`. Removing a tag by name with the v1
`TagsAssociateRequest` removes all its values on the object. The Java and
Python clients already support both.
Review Comment:
Fixed in 50b2415000: valueless assignments work with v1 or v2; a tag with an
allowed-values list must be assigned with the v2 `TagValuesAssociateRequest`.
`docs/domains.md` says the same.
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
--
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]