-
Notifications
You must be signed in to change notification settings - Fork 70
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
Add feature flag for QueryPhaseSearcher #214
Add feature flag for QueryPhaseSearcher #214
Conversation
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
* and false otherwise. | ||
* Checks alternative flag names as they may be different for plugins | ||
*/ | ||
public static boolean isEnabled(String featureFlagName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to try "transport" feature prefix, as this is the way core adding features that are set in plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then why both? Shouldn't we only check with "transport" feature prefix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to encapsulate that logic so client can do only one call. Otherwise on a client we need to do two calls:
featureFlags.isEnabled(flag) || customFeatureFlags.isEnabled(flag)
. Depending on scenario one feature flag can be set in one form or another (with or without prefix)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think it is client's responsibility to pass correct key. In this case transport.features.neural_search_hybrid_search_enabled
.
There is no such case that neural_search_hybrid_search_enabled
can be enabled by setting neural_search_hybrid_search_enabled
as true but only by setting transport.features.neural_search_hybrid_search_enabled
as true I believe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point, it can be that flag is set in two places and as we read it with OR and one that set in plugin is always TRUE then we cannot set it to FALSE ever. I'll rework to only use one name or another, in fact it should be always with the prefix except the definition.
80baad0
to
2933240
Compare
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
2933240
to
4985c33
Compare
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
* and false otherwise. | ||
* Checks alternative flag names as they may be different for plugins | ||
*/ | ||
public static boolean isEnabled(String featureFlagName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static boolean isEnabled(String featureFlagName) { | |
public static boolean isEnabled(final String featureFlagName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
* and false otherwise. | ||
* Checks alternative flag names as they may be different for plugins | ||
*/ | ||
public static boolean isEnabled(String featureFlagName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then why both? Shouldn't we only check with "transport" feature prefix?
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Codecov Report
@@ Coverage Diff @@
## feature/normalization #214 +/- ##
===========================================================
+ Coverage 84.91% 84.95% +0.04%
- Complexity 215 216 +1
===========================================================
Files 15 15
Lines 676 678 +2
Branches 109 109
===========================================================
+ Hits 574 576 +2
Misses 60 60
Partials 42 42
|
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
@@ -50,9 +52,14 @@ public class NeuralSearch extends Plugin implements ActionPlugin, SearchPlugin, | |||
* Gates the functionality of hybrid search | |||
* Currently query phase searcher added with hybrid search will conflict with concurrent search in core. | |||
* Once that problem is resolved this feature flag can be removed. | |||
* Key is the name string, value is key + transport feature specific prefix, prefix is added by core when we register feature | |||
* We need to write and read by the value, key is only for definition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this previous comment having a code link to core was good and would be nice to have it here.
https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/plugins/PluginsService.java#L277
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
9e9f932
to
c1356cf
Compare
Why we want to make it by default true? This is strange? Can we make this false for now. and then take a decision what needs to be done. |
We can only make the feature "true" with this approach, but I think you mean it's not about the exact value, but we need to interpret that default "true" as feature is disabled, is that what you mean? In other words user need to opt-in explicitly, rather that opt-out with current approach |
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
58af228
to
620aadf
Compare
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
620aadf
to
a63b983
Compare
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
@VisibleForTesting | ||
public static final Pair<String, String> NEURAL_SEARCH_HYBRID_SEARCH_DISABLED = Pair.of( | ||
"neural_search_hybrid_search_disabled", | ||
String.join(".", TransportSettings.FEATURE_PREFIX, "neural_search_hybrid_search_disabled") | ||
); | ||
public static final String NEURAL_SEARCH_HYBRID_SEARCH_ENABLED = "neural_search_hybrid_search_enabled"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable is already public we can remove @VisbleForTesting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made it public only because it's required for tests otherwise private will be enough, my understanding is that @VisbleForTesting is required in this case to mark that it's intentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh.. sorry my bad. I read it wrong then
@@ -42,15 +42,15 @@ public void testQueryPhaseSearcher() { | |||
assertNotNull(queryPhaseSearcher); | |||
assertTrue(queryPhaseSearcher.isEmpty()); | |||
|
|||
System.setProperty(NEURAL_SEARCH_HYBRID_SEARCH_DISABLED.getValue(), "true"); | |||
System.setProperty(NEURAL_SEARCH_HYBRID_SEARCH_ENABLED, "true"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we set this property in base class?
and why test are extending OpenSearchTestCase, there is should be a base Neural Search test class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that for some unit tests we may want to disable it, that would be complex if it's set in base class.
I'll make setting in a method and will call it in a setup phase for this test class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
happy to see all checks succeeding. This is happening after a long time |
@martin-gaievski tests are failing. |
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
267a716
to
86b51f5
Compare
* Adding hybrid_search_enabled settings Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Description
Added feature flag
neural_search_hybrid_search_enabled
for query phase searcher. This is required as a safeguard in case concurrent search feature is enabled and another implementation of query phase searcher is registered.This new flag can be set as system property or in opensearch.yml (with use of
transport.features
), by default flag isfalse
(feature is disabled). Enable flag for integ tests.Issues Resolved
#194
Check List
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.