Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize feature flags before extensions manager #6082

Merged

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Jan 30, 2023

Signed-off-by: Craig Perkins cwperx@amazon.com

Description

While testing with the experimental extensions feature flag, I found that the NoopExtensionsManager was being instantiated because the feature flags were not initialized by the time that extensions manager is being instantiated. This is a small PR to re-order Node.java to ensure the FeatureFlags are initialized before ExtensionsManager instantiation.

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
@cwperks
Copy link
Member Author

cwperks commented Jan 30, 2023

@ryanbogan @saratvemulapalli @dbwiddis Small PR on the order of initializing feature flags before instantiating the ExtensionsManager.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.action.admin.cluster.node.tasks.ResourceAwareTasksTests.testTaskResourceTrackingDuringTaskCancellation

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@cwperks
Copy link
Member Author

cwperks commented Jan 30, 2023

@ryanbogan Is this a flaky test failure? Can the gradle check be re-run?

Tests with failures:
 - org.opensearch.indices.replication.SegmentReplicationRelocationIT.testRelocateWhileContinuouslyIndexingAndWaitingForRefresh

CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: Craig Perkins <cwperx@amazon.com>
@ryanbogan
Copy link
Member

@ryanbogan Is this a flaky test failure? Can the gradle check be re-run?

Tests with failures:
 - org.opensearch.indices.replication.SegmentReplicationRelocationIT.testRelocateWhileContinuouslyIndexingAndWaitingForRefresh

I think that one is flaky

@saratvemulapalli saratvemulapalli added extensions backport 2.x Backport to 2.x branch labels Jan 30, 2023
@saratvemulapalli
Copy link
Member

Thanks @cwperks !!

Ideally a test should have caught this problem. @ryanbogan / @cwperks do you want to contribute a test for opensearch.yml having feature flag set and expecting ExtensionsManager to run?

@cwperks
Copy link
Member Author

cwperks commented Jan 30, 2023

@saratvemulapalli Are there any example ITs for extensions? I am looking into a setup similar to this: https://github.com/opensearch-project/OpenSearch/blob/main/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreIT.java#L57-L64

Do you think its possible to use internalCluster().getInstance(ExtensionManager.class) to get the extension manager that was instantiated to see if its a NoopExtensionManager vs an ExtensionManager?

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@saratvemulapalli
Copy link
Member

saratvemulapalli commented Jan 31, 2023

@saratvemulapalli Are there any example ITs for extensions? I am looking into a setup similar to this: https://github.com/opensearch-project/OpenSearch/blob/main/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreIT.java#L57-L64

Do you think its possible to use internalCluster().getInstance(ExtensionManager.class) to get the extension manager that was instantiated to see if its a NoopExtensionManager vs an ExtensionManager?

@cwperks Thats a good question. It should be possible to do it as we inject it[1].

[1] https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/node/Node.java#L1010

…t to true

Signed-off-by: Craig Perkins <cwperx@amazon.com>
@cwperks
Copy link
Member Author

cwperks commented Feb 2, 2023

@saratvemulapalli @ryanbogan @andrross I added a test for this. When adding the test, I had to remove the feature flag check around binding the extensions manager otherwise the call to internalCluster().getInstance(ExtensionsManager.class) would always return ExtensionsManager and not the actual instance that was bound to the node. Please let me know if there is a better way to do this.

This means that when the experimental feature flag is not enabled, there will always be a NoopExtensionsManager that is binded. I figured that may alright, but want to double-check with the maintainers.

The test fails with the previous ordering.

Copy link
Member

@saratvemulapalli saratvemulapalli left a comment

Choose a reason for hiding this comment

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

Thanks @cwperks !!

@saratvemulapalli
Copy link
Member

@saratvemulapalli @ryanbogan @andrross I added a test for this. When adding the test, I had to remove the feature flag check around binding the extensions manager otherwise the call to internalCluster().getInstance(ExtensionsManager.class) would always return ExtensionsManager and not the actual instance that was bound to the node. Please let me know if there is a better way to do this.

This means that when the experimental feature flag is not enabled, there will always be a NoopExtensionsManager that is binded. I figured that may alright, but want to double-check with the maintainers.

The test fails with the previous ordering.

That should be good. thanks for taking care of the test.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2023

Gradle Check (Jenkins) Run Completed with:

@cwperks
Copy link
Member Author

cwperks commented Feb 2, 2023

Merged the latest changes in from main to re-run CI

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2023

Gradle Check (Jenkins) Run Completed with:

@saratvemulapalli saratvemulapalli merged commit 3164a3a into opensearch-project:main Feb 3, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Feb 3, 2023
* Initialize feature flags before extensions manager

Signed-off-by: Craig Perkins <cwperx@amazon.com>
(cherry picked from commit 3164a3a)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kotwanikunal pushed a commit that referenced this pull request Feb 3, 2023
* Initialize feature flags before extensions manager

Signed-off-by: Craig Perkins <cwperx@amazon.com>
(cherry picked from commit 3164a3a)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
saratvemulapalli pushed a commit that referenced this pull request Feb 3, 2023
* Initialize feature flags before extensions manager


(cherry picked from commit 3164a3a)

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants