Skip to content

Conversation

chlins
Copy link
Member

@chlins chlins commented Jul 3, 2025

This pull request introduces a new garbage collection (GC) task for cleaning up inactive schedulers in the manager module. It includes the implementation of the scheduler GC logic and its integration into the server initialization process.

Scheduler GC Implementation:

  • Added a new scheduler GC task in manager/gc/scheduler.go:
    • Defined constants for default GC parameters, such as batch size, TTL, interval, and timeout.
    • Implemented the scheduler struct and its RunGC method to delete inactive schedulers based on the TTL. The method uses a database query to identify and remove records in batches, logging the results.
    • Integrated a jobRecorder to track and record the GC task's execution details.

Integration into Server Initialization:

  • Registered the new scheduler GC task in the server initialization process (manager/manager.go) to ensure it runs periodically.

Description

Related Issue

Completed part of #4179.

Motivation and Context

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

Signed-off-by: chlins <chlins.zhang@gmail.com>
@chlins chlins added the enhancement New feature or request label Jul 3, 2025
@chlins chlins requested a review from a team as a code owner July 3, 2025 08:01
@chlins chlins enabled auto-merge (squash) July 3, 2025 08:03
Copy link

codecov bot commented Jul 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 47 lines in your changes missing coverage. Please review.

Project coverage is 32.91%. Comparing base (e57c831) to head (77e7283).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
manager/gc/scheduler.go 0.00% 44 Missing ⚠️
manager/manager.go 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4175      +/-   ##
==========================================
- Coverage   32.94%   32.91%   -0.04%     
==========================================
  Files         346      347       +1     
  Lines       40945    40992      +47     
==========================================
+ Hits        13490    13491       +1     
- Misses      26561    26607      +46     
  Partials      894      894              
Flag Coverage Δ
unittests 32.91% <0.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
manager/manager.go 0.00% <0.00%> (ø)
manager/gc/scheduler.go 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@Liam-Zhao Liam-Zhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chlins chlins merged commit b3b7d15 into main Jul 3, 2025
18 checks passed
@chlins chlins deleted the feat/gc-inactive-schedulers branch July 3, 2025 08:45
@gaius-qi gaius-qi added this to the v2.4.0 milestone Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants