Skip to content

fix: stop DestinationMigrationCoordinator cycling on unrelated cluster events#2163

Open
thecodingshrimp wants to merge 1 commit into
opensearch-project:mainfrom
thecodingshrimp:fix/destination-migration-coordinator-cluster-scope-guard
Open

fix: stop DestinationMigrationCoordinator cycling on unrelated cluster events#2163
thecodingshrimp wants to merge 1 commit into
opensearch-project:mainfrom
thecodingshrimp:fix/destination-migration-coordinator-cluster-scope-guard

Conversation

@thecodingshrimp
Copy link
Copy Markdown

Problem

DestinationMigrationCoordinator.clusterChanged() has no index-scope filter. Any cluster state event resets finishFlag and reschedules the migration job — even events completely unrelated to the scheduled-jobs index (e.g., datastream mapping updates from security-analytics). On a cluster where destinations have already been migrated, this causes an infinite Reset→Cancel→Perform cycle that generates continuous log noise.

Root cause

The clusterChanged callback resets finishFlag = false and reschedules unconditionally. Once migration completes and finishFlag = true, the next unrelated cluster event immediately restarts the cycle.

Fix

Add the same index-scope guard used by JobSweeper:
```kotlin
if (!event.indexRoutingTableChanged(ScheduledJob.SCHEDULED_JOBS_INDEX)) return
```
This ensures the coordinator only acts on routing-table changes to .opensearch-alerting-scheduled-jobs — the only index whose state is actually relevant to destination migration.

Testing

  • Verified guard fires correctly: unrelated cluster events (mapping updates, etc.) return early without touching finishFlag or the migration scheduler
  • Migration still completes correctly when .opensearch-alerting-scheduled-jobs routing changes

…Changed() to stop migration cycle on unrelated cluster events
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