lasdf1234 opened a new pull request, #13897:
URL: https://github.com/apache/gravitino/pull/13897

   ### What changes were proposed in this pull request?
   
   Follow-up on the TMS scheduler pools from Epic #13760.
   
   When a maintenance policy carries `timeTrigger`, create, alter, enable, 
disable, and delete keep a matching `policy-expand` row in 
`scheduled_expand_tasks`:
   
   - Enabled policy with a non-blank cron: insert or move the row. The task 
instance id is the policy id, and the due time is the next Quartz cron fire 
time.
   - Disabled policy, blank `timeTrigger`, or a successful delete: remove the 
row.
   - Non-maintenance policies are ignored.
   
   The expand handler is still a no-op. This change only registers the row. The 
db-scheduler client forces auto-commit, and the pools commit when auto-commit 
is off, so writes survive the entity-store connection pool.
   
   ### Why are the changes needed?
   
   Policy content stores `timeTrigger`, but nothing was writing that schedule 
into db-scheduler. Without this, a created or updated maintenance policy never 
becomes an expand lease, and a deleted or disabled policy would leave a stale 
row.
   
   Fix: #13760
   
   ### Does this PR introduce _any_ user-facing change?
   
   No new REST API or configuration key. Creating, altering, enabling, 
disabling, or deleting a maintenance policy that has `timeTrigger` now inserts, 
moves, or deletes the corresponding `policy-expand` row while TMS scheduler 
pools are running.
   
   ### How was this patch tested?
   
   - `TestPolicyTimeTriggerEventListener` covers create, alter, enable, 
disable, delete, a failed delete, and non-maintenance policies.
   - `TestPolicyExpandScheduler` inserts, reschedules, and removes the expand 
row on the H2 entity-store schema.
   - `./gradlew :plugins:tms:test --tests 
org.apache.gravitino.maintenance.scheduler.TestPolicyTimeTriggerEventListener 
--tests org.apache.gravitino.maintenance.scheduler.TestPolicyExpandScheduler 
--tests 
org.apache.gravitino.maintenance.scheduler.TestTableMaintenanceSchedulerPools 
-PskipITs`
   
   
   Made with [Cursor](https://cursor.com)


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