Skip to content

fix: concurrency issue with filtering and caching update#3191

Open
csviri wants to merge 10 commits intooperator-framework:nextfrom
csviri:fix-indexing-new-event
Open

fix: concurrency issue with filtering and caching update#3191
csviri wants to merge 10 commits intooperator-framework:nextfrom
csviri:fix-indexing-new-event

Conversation

@csviri
Copy link
Collaborator

@csviri csviri commented Feb 28, 2026

Fixes a race condition with the event filtering and caching issue, described in a comment. Added also a dedicated e2e test for this case.
Also increased the timeout for the MySQL e2e test, which seems to be flaky as well.

Improved logging for workflow execution, so that it is more readable in the logs what is happening.

Signed-off-by: Attila Mészáros a_meszaros@apple.com

Copilot AI review requested due to automatic review settings February 28, 2026 12:33
@openshift-ci openshift-ci bot requested review from metacosm and xstefank February 28, 2026 12:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates InformerEventSourceTest to better validate behavior when a secondary resource is updated via event-filtering + caching, specifically ensuring the secondary can be retrieved immediately afterward (via getSecondaryResources) and that the primary-to-secondary index is updated accordingly.

Changes:

  • Reuses a dedicated SecondaryToPrimaryMapper mock instance in the test class setup.
  • Overrides get(ResourceID) in the test InformerEventSource to read directly from TemporaryResourceCache.
  • Adds a new test asserting that eventFilteringUpdateAndCacheResource updates the primary-to-secondary index such that getSecondaryResources(primary) returns results.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 86 to 90
when(informerEventSourceConfiguration.getSecondaryToPrimaryMapper())
.thenReturn(mock(SecondaryToPrimaryMapper.class));
.thenReturn(mockSecondaryToPrimaryMapper);
when(informerEventSourceConfiguration.getResourceClass()).thenReturn(Deployment.class);

informerEventSource =
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

In setup(), getSecondaryToPrimaryMapper() is stubbed to return mockSecondaryToPrimaryMapper, but later in the same method it’s stubbed again to return a different secondaryToPrimaryMapper mock. This makes the test fixture inconsistent (the PrimaryToSecondaryIndex is constructed with the first mock, while propagateEvent() uses the later stubbed one) and can mask bugs. Prefer using a single mapper mock consistently (remove the later re-stubbing/local mock or remove the field).

Copilot uses AI. Check for mistakes.
…hing update

Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
@csviri csviri marked this pull request as draft February 28, 2026 13:04
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 28, 2026
@csviri csviri force-pushed the fix-indexing-new-event branch from eb61286 to 3db1ccb Compare February 28, 2026 13:48
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
@csviri csviri linked an issue Feb 28, 2026 that may be closed by this pull request
@csviri csviri self-assigned this Feb 28, 2026
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
@csviri csviri marked this pull request as ready for review February 28, 2026 14:51
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 28, 2026
@csviri csviri requested a review from Copilot February 28, 2026 14:52
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (1)

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSourceTest.java:28

  • ObjectMetaBuilder is imported but not used anywhere in this test. Since the build uses Spotless with removeUnusedImports, this should be removed (or the intended usage added) to avoid formatting/CI issues.
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.fabric8.kubernetes.api.model.apps.DeploymentBuilder;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

csviri and others added 5 commits February 28, 2026 15:59
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
…tor/processing/event/source/informer/ManagedInformerEventSource.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
@csviri csviri changed the title improve: test getting secondary resource directly after filtering caching update fix: concurrency issue with filtering and caching update Feb 28, 2026
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.

Flaky Integration test DependentResourceCrossRefReconciler

2 participants