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

Adding segment replication setting for index #2904

Closed

Conversation

Poojita-Raj
Copy link
Contributor

@Poojita-Raj Poojita-Raj commented Apr 14, 2022

Signed-off-by: Poojita Raj [email protected]

Description

At the index level, we add in a new setting to enable segment replication. It is set to false by default, in which case the index uses the document replication strategy.

This is a part of the process of merging our feature branch - feature/segment-replication - back into main by re-PRing our changes from the feature branch.
The breakdown of the plan to merge to main is detailed here: #2355
For added context on segment replication - here's the design proposal #2229

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

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.

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 832b446
Log 4486

Reports 4486

Copy link
Collaborator

@nknize nknize left a comment

Choose a reason for hiding this comment

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

Did we decide to feature flag segrep for 2x?

If so do we want to wrap this setting in a feature flag and only enable if the flag is set? /cc @mch2 @kartg

public static final boolean SEGREP_FEATURE_FLAG_ENABLED = "true".equals(System.getProperty("opensearch.segment_replication_feature_flag_enabled"));

@mch2
Copy link
Member

mch2 commented Apr 15, 2022

Did we decide to feature flag segrep for 2x?

If so do we want to wrap this setting in a feature flag and only enable if the flag is set? /cc @mch2 @kartg

public static final boolean SEGREP_FEATURE_FLAG_ENABLED = "true".equals(System.getProperty("opensearch.segment_replication_feature_flag_enabled"));

Hey @nknize. Just to be clear we are talking about merging to main in anticipation of 3x, with an option to pull into 2x when the feature is ready to experiment with? I would rather not backport these changes immediately into 2x before the feature is useable. We are hoping to go to main with these changes to remove our long running feature branch, but we have issues like failover and some refactoring that would need to be addressed before it is ready for experimentation.

As far as the feature flag, what benefit would this give over the new setting? Is it that a user would have the additional step/warning of having to set it as a jvm parameter over a setting during index creation?

@andrross
Copy link
Member

Did we decide to feature flag segrep for 2x?

@nknize I agree with Marc about not backporting anything to 2.x just yet, but I have a general question... Is there a standard practice for using a "feature flag" that you described above? I don't see the benefit of needing to both set a Java system property and a new setting a configuration file, since the feature would be disabled by default in any case.

@nknize
Copy link
Collaborator

nknize commented Apr 15, 2022

we are talking about merging to main in anticipation of 3x, with an option to pull into 2x

Exactly.. the way that I would approach this is to bring into main w/ the feature flag. If we collectively decide to backport to 2x, we can open a backport PR with the feature flag. If we then collectively decide the feature is at a mature enough state for 3x, we open a follow on PR to remove the feature flag in main only. This gives us a nice progressive maturation mechanism with off ramps along the way.

what benefit would this give over the new setting?

With feature flags the index setting isn't even available in the API w/o the opensearch.segment_replication_feature_flag_enabled=true. You can also go a step further with the feature flag and mask what you want out of the build in build.gradle and even go a step further only including certain implementations in snapshot only builds. With feature flags there is more flexibility in how we unleash the bits.

Follow up: We can commit w/ the feature flag enabled in all test module's build.gradle file. That way tests run with it enabled. We can also enable the feature flag in nightly snapshots. You can continue to safely develop the feature in main w/o carrying the long running feature branch and dealing w/ merge conflicts. 💀 🔫

@@ -260,6 +260,17 @@ public Iterator<Setting<?>> settings() {
Property.IndexScope
);

public static final String SETTING_SEGMENT_REPLICATION = "index.replication.segment_replication";
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick, but I'd consider making this an enum setting, like index.replication.type=["DOCUMENT"|"SEGMENT"], defaulting to "DOCUMENT". It conveys a little more information that the replication methods are mutually exclusive for a given index, and also gives a name to "document replication" instead of being implicit.

@nknize
Copy link
Collaborator

nknize commented Apr 15, 2022

Is there a standard practice for using a "feature flag" that you described above?

Several approaches; I linked one in my response to @mch2 and here's another good resource

I don't see the benefit of needing to both set a Java system property and a new setting a configuration file, since the feature would be disabled by default in any case.

Think of the feature flag like a compile time Macro... You can safely wrap the in-work feature and prevent it from ever being exposed until the project deems ready; whereas the index setting commits it as a feature. The index setting is the power button, the feature flag is the locked cover to the power button.

@mch2
Copy link
Member

mch2 commented Apr 15, 2022

This makes sense to me, thanks @nknize. So our feature flag is not setting a default value of the setting, but its an additional gate to flipping it on if the setting is passed.

We'll need to think about how to conditionally bring in the additional logic and turn it on. We don't have isolated components that get installed/uninstalled based on the flag on our feature branch. There are many updates to existing classes with conditional logic.

@nknize
Copy link
Collaborator

nknize commented Apr 25, 2022

I think this is supplanted by #3037? /cc @kartg

@kartg
Copy link
Member

kartg commented Apr 25, 2022

I think this is supplanted by #3037?

Yes, closing in favor of that one

@kartg kartg closed this Apr 25, 2022
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.

6 participants