apache / apache/gravitino

[Subtask] Collect orphaned principal and membership relation rows

Open
#13,003 0 comments 0 reactions 0 assignees View on GitHub
subtask
Dominant language
Java
Stars
3.2k
Forks
935
Avg merge
1d 16h
Merged PRs (30d)
298

Description

### Describe the subtask

The collector introduced by #12154 checks metadata_object_id/type liveness for generic metadata relations. It does not collect user_role_rel/group_role_rel or owner_meta rows whose owner User/Group was deleted while the owned object remains live. Write-side fencing alone will not repair rows already left by these races.

Extend the existing GC framework to soft-delete active memberships with a missing/deleted User, Group, or Role endpoint, and ownership rows with a missing/deleted owner principal. Reuse existing scheduling, batching, retention, and failure-isolation conventions; do not introduce a second cleanup scheduler.

Acceptance:
- Cover soft-deleted and physically absent endpoints, live relations, stable-ID recreation, owner-type and metalake isolation, and repeated bounded runs.
- Cover concurrent valid assignment and cleanup without deleting live relationships.
- Preserve relation history and existing hard-delete retention; validate H2, MySQL, and PostgreSQL.

This task repairs historical rows independently of the two write-fencing tasks.

### Parent issue

https://github.com/apache/gravitino/issues/10238

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing collector introduced by #12154 and the parent issue #10238, then inspect the current GC scheduler, batching, retention, and failure-isolation conventions. Done means bounded runs repair orphaned user_role_rel, group_role_rel, and owner_meta rows while preserving history, stable-ID recreation, isolation, concurrency safety, and H2, MySQL, and PostgreSQL behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.