Skip to content

Adds a safeguard to prevent duplicate VM scheduled jobs and prevent continuously printing errors in logs - #19

Open
manikonda wants to merge 1 commit into
att:att/4.22.0.0from
manikonda:FixRedundantExceptionPrintingInLogsForVMSchedules
Open

manikonda wants to merge 1 commit into
att:att/4.22.0.0from
manikonda:FixRedundantExceptionPrintingInLogsForVMSchedules

Conversation

@manikonda

Copy link
Copy Markdown

Description

This PR adds a safeguard to prevent duplicate VM scheduled jobs and prevent continuously printing errors in logs.
This pull request adds a safeguard to prevent duplicate VM scheduled jobs by checking for existing jobs before creating new ones. It introduces a new DAO method to efficiently find jobs by schedule and timestamp, and updates the scheduler logic to use this method. Additionally, it introduces some minor import changes.

Database access improvements:

Added a new method findByScheduleAndTimestamp(long scheduleId, Date scheduledTimestamp) to the VMScheduledJobDao interface and its implementation, along with the necessary SearchBuilder in VMScheduledJobDaoImpl, to efficiently look up scheduled jobs by schedule ID and timestamp.

Scheduler logic enhancements:

Updated VMSchedulerImpl.scheduleNextJob to use the new DAO method to check for an existing scheduled job before creating a new one, preventing duplicate scheduling for the same VM and time.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

Created schedules on the VM using the cloudstack UI and validated from the logs, to see if this change stopped printing the SQL ERROR statements continuously on each new poll check intervals, usually 1 minute.

…y checking for existing jobs before creating new ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant