This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
[BUG] Monitor jobs do not reschedule when flipping the SWEEPER_ENABLED setting #333
Labels
bug
Something isn't working
When the
SWEEPER_ENABLED
setting is set tofalse
, all Alerting jobs are descheduled as expected. However, once this setting is set back totrue
, the expectation is that existing enabled Monitors would be rescheduled but this is currently not the case.The issue seems to be occurring in the
sweep()
logic. This is indirectly invoked from theenable()
method when theSWEEPER_ENABLED
setting is set totrue
. At this time, any jobs owned by the shard in question are skipped if thenewVersion
being passed in is less than or equal to thecurrentVersion
. So when the sweeper is re-enabled, all the jobs that went through no change are skipped over and never rescheduled.Here is a snippet of the code in question:
alerting/core/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/core/JobSweeper.kt
Lines 348 to 361 in 8daf9e6
The solution would involve accounting for the case where the job version is unchanged only when coming from a scenario where the jobs are previously descheduled and coming from the
enable()
code path, so that the logic where the jobs are scheduled can occur. Not accounting for the aforementioned scenario could lead to existing jobs being repeatedly descheduled and rescheduled during the routine background runs, which should be avoided.The text was updated successfully, but these errors were encountered: