Implement job scheduler #19
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Create job scheduler with stats and checkpoints so that we have a background thread pool for concurrent job execution, that has a priority based job queueing system and job dependency management and scheduling policies.
GPT PR summary:
• Multi-threaded job execution: Worker thread pool processes jobs concurrently without blocking main database operations, supporting configurable thread counts for optimal resource utilization
• Priority-based job queue: Four-tier priority system (CRITICAL, HIGH, NORMAL, LOW) ensures critical maintenance tasks like checkpoints execute before routine operations, maintaining system responsiveness under load
• Automatic checkpoint management: Time-based and WAL-size triggers automatically flush dirty pages and create recovery points, preventing unbounded log growth while maintaining data durability
• Recurring job scheduling: Background tasks like health checks, version pruning, and WAL cleanup run at configurable intervals, providing continuous system maintenance without manual intervention
• Job lifecycle tracking: Complete job state management (PENDING → RUNNING → COMPLETED/FAILED) with timeout handling, retry capabilities, and detailed execution statistics for monitoring system health
• Health monitoring integration: Real-time success rate tracking and system health indicators support 99.98% uptime requirements through proactive failure detection and automated recovery mechanisms