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

Validate that soft delete settings is enabled at leader #84

Merged
merged 1 commit into from
Aug 6, 2021

Conversation

soosinha
Copy link
Member

@soosinha soosinha commented Aug 4, 2021

Description

Replication should occur only when the setting index.soft_deletes.enabled is enabled for the leader index. It is enabled by default and can be set only at index creation. Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/7.x/index-modules.html
Adding validation to ensure that this setting is enabled for leader index before starting replication.

Tested by setting this to true while creating index. Got below exception:

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "Cannot Replicate an index where the setting index.soft_deletes.enabled is disabled"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "Cannot Replicate an index where the setting index.soft_deletes.enabled is disabled"
    },
    "status": 400
}

Check List

  • 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.

Copy link
Member

@saikaranam-amazon saikaranam-amazon left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 77 to 79
if (!leaderSettings.getAsBoolean(IndexSettings.INDEX_SOFT_DELETES_SETTING.key, true)) {
throw IllegalArgumentException("Cannot Replicate an index where the setting ${IndexSettings.INDEX_SOFT_DELETES_SETTING.key} is disabled")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like other static index settings this can be changed by closing and reopening index.
https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html

Can we also validate this in resume?

Copy link
Collaborator

Choose a reason for hiding this comment

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

And add a corresponding integ test?

Copy link
Member Author

Choose a reason for hiding this comment

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

This setting cannot be updated even after closing index. I have verified the same. Getting this on trying to add the setting: final my-index setting [index.soft_deletes.enabled], not updateable

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for validating.

krishna-ggk
krishna-ggk previously approved these changes Aug 6, 2021
@soosinha soosinha merged commit 2fd173b into opensearch-project:main Aug 6, 2021
@soosinha soosinha deleted the t-soft-delete branch August 6, 2021 08:28
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.

3 participants