lasdf1234 opened a new issue, #14784:
URL: https://github.com/apache/gravitino/issues/14784

   ### What would you like to be improved?
   
   TMS built-in Iceberg maintenance jobs need complete before (S0) / after (S1) 
metrics for the maintenance dashboard, plus shared flow fixes (drift gate 
scope, manifest in-job trigger, orphan S1 byte measurement).
   
   Do **not** put `maintenanceType` or `snapshotId` in `metricsJson` (those 
already live on the action/policy and `table_snapshot_metrics.snapshot_id`). 
Dashboard "how many tables ran" should aggregate the **action** table, not 
metrics JSON.
   
   Metric naming: `custom-` prefix, use `number` (not `count`), at most four 
hyphen segments.
   
   ### How should we improve?
   
   Align with the landed job behavior (this issue tracks the code as 
implemented):
   
   1. **Report S1 after a successful procedure** (in addition to existing S0 + 
finish).
   2. **Snapshot drift skip** only for **compaction** and **manifest rewrite**. 
Expiry and orphan cleanup proceed if HEAD moves.
   3. **Compaction** S0/S1 share the same schema:
      - `custom-data-file-mse`
      - `custom-delete-file-number`
      - `custom-avg-file-size`
      - `custom-total-file-size`
      - `custom-file-number`
   4. **Manifest rewrite** — different S0/S1:
      - **S0:** `custom-manifest-number`, `custom-avg-manifest-size`
      - **S1:** `custom-rewritten-manifest-number` (procedure rewritten count)
   5. **Manifest in-job trigger:** `MaintenanceTriggerGate` evaluates 
`trigger-expr` against S0 (missing manifest metrics → skip). Default expression 
ships in `IcebergRewriteManifestsContent.rules()`, aligned with optimizer 
thresholds.
   6. **Snapshot expiry:**
      - **S0:** `custom-snapshot-number`, `custom-total-file-size` (reachable 
`all_files` inventory)
      - **S1:** `custom-expired-snapshot-number`, `custom-reclaimed-file-size` 
via **set difference** (S0 − S1), not raw after totals
      - In-job gate **always maintain** (no trigger-expr skip)
   7. **Orphan cleanup:**
      - **No S0** / before-metrics row (TMS path returns early; never samples 
drift/trigger gate)
      - **S1 only** via TMS `executeWithMetrics` (CLI stays procedure-only): 
`custom-removed-orphan-number`, `custom-orphan-bytes-reclaimed` (dry-run list → 
FileIO sizes → optional real delete)
   8. Bump built-in templates: `iceberg-maintenance-task` → **v2**, 
`iceberg-remove-orphan-files` → **v4**. Sink S0/S1 helpers onto the four job 
classes.
   
   ### Acceptance
   
   - [ ] Compaction / manifest: drift gate + S0/S1 schemas above
   - [ ] Manifest: in-job `trigger-expr` can SKIP
   - [ ] Expiry: set-difference S1; no drift skip; gate always maintain
   - [ ] Orphan: no before-metrics; S1 only on TMS path; metrics names above
   - [ ] `metricsJson` has no `maintenanceType` / `snapshotId`


-- 
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]

Reply via email to