Skip to content

Change default value of action.destructive_requires_name to True. #66908

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

Merged
merged 21 commits into from
Mar 31, 2021

Conversation

YashJipkate
Copy link
Contributor

This PR sets the default value of action.destructive_requires_name to True. Fixes #61074.

@matriv matriv added the :Core/Infra/Settings Settings infrastructure and APIs label Jan 4, 2021
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jan 4, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@matriv
Copy link
Contributor

matriv commented Jan 4, 2021

@YashJipkate Please check references of this setting in the docs and other places like for example: distribution/src/config/elasticsearch.yml and make the appropriate changes.

Copy link
Contributor Author

@YashJipkate YashJipkate left a comment

Choose a reason for hiding this comment

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

@matriv There are some changes I made to the doc. Please let me know if you find any issues.

@matriv
Copy link
Contributor

matriv commented Jan 5, 2021

I think we should also change in docs/reference/indices/open-close.asciidoc L53 the phrasing since now it's by default true. Also in docs/reference/modules/indices/index_management.asciidoc L16.

@matriv
Copy link
Contributor

matriv commented Jan 5, 2021

@javanna Could you please take a look as well?

@YashJipkate
Copy link
Contributor Author

I think we should also change in docs/reference/indices/open-close.asciidoc L53 the phrasing since now it's by default true. Also in docs/reference/modules/indices/index_management.asciidoc L16.

I too thought of rephrasing them at first, but they didn't say anything about 'changing' the setting to true. They merely state a condition, which is now satisfied by default.

Although I'm open to suggestions on how to phrase it even better.

@javanna
Copy link
Member

javanna commented Jan 5, 2021

jenkins test this please

@YashJipkate
Copy link
Contributor Author

@javanna @matriv I am not able to understand the cause for the failure of so many tests. I only changed one line in actual code here. Could you please help me resolve these.

@javanna
Copy link
Member

javanna commented Jan 5, 2021

@YashJipkate I quickly looked and I think that our integration tests rely on deleting all indices without specifying their names. This is done before every single test, which explains why every single integration test fails ;)

@rjernst
Copy link
Member

rjernst commented Jan 5, 2021

Separate from the tests, I have two comments:

  • Please make the PR title more precise, referring to the actual setting being change and what the value is changing to
  • Since this is a change in behavior, this should only be done in a major version. We may want to give a deprecation warning for this upcoming change in behavior in 7.x. @javanna wdyt?

@YashJipkate YashJipkate changed the title Changed default setting Change default value of action.destructive_requires_name to True. Jan 5, 2021
@YashJipkate
Copy link
Contributor Author

Please make the PR title more precise, referring to the actual setting being change and what the value is changing to

@rjernst Done.

@YashJipkate
Copy link
Contributor Author

@YashJipkate I quickly looked and I think that our integration tests rely on deleting all indices without specifying their names. This is done before every single test, which explains why every single integration test fails ;)

In that case, could you please guide me as to what can be done to resolve this?

@javanna
Copy link
Member

javanna commented Jan 5, 2021

@rjernst I was wondering the same about this change in behaviour. I agree it should be done in a major. I don't think I will get to properly review this PR, would you mind finding somebody to help moving this forward please?

Copy link
Contributor

@williamrandolph williamrandolph left a comment

Choose a reason for hiding this comment

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

In order to fix the tests, we now need to set action.destructive_requires_name cluster to false for our test clusters. It looks to me like the easiest place to do that is in the code for the test cluster setup, in the file buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java. Specifically, I added:

baseConfig.put("action.destructive_requires_name", "false");

...after line 1187 of that file, and that let some of the failing integration tests pass.

I'm not sure if this will fix everything, so we may have to iterate a little bit to allow wildcard deletions in every place where the tests expect them.

I requested some wording changes in other comments and meant for those requests to be part of this review.

Thank you for working with us on this PR!

@YashJipkate
Copy link
Contributor Author

@williamrandolph I've done the changes requested by you.

Also, can you start the Jenkins here since the tests are being flaky on my PC (also takes too long and freezes the system, times out), as it isn't running automatically for the subsequent pushes on this PR. Or is there any other way I can carry out the tests?

@williamrandolph
Copy link
Contributor

williamrandolph commented Jan 25, 2021

@spalger I have tried a couple of versions of trying to reproduce this with and without other indices or hidden indices and can't get the warning in the way you reported it. Is there anything else you can provide to help me reproduce it?

# create index
➜  curl -s -XPUT "localhost:9200/functional-test-actions-index"
{
  "acknowledged":true,
  "shards_acknowledged":true, 
  "index":"functional-test-actions-index"
}

# index is there to delete                           
➜  curl -XDELETE 'localhost:9200/functional-test-actions-index?ignore_unavailable=true' | jq '.'
{
  "acknowledged": true
}

# index is not there, but ignore-unavailable works
➜  curl -s -XDELETE 'localhost:9200/functional-test-actions-index?ignore_unavailable=true' | jq '.'
{
  "acknowledged": true
}

# using a wildcard - destructive_requires_name is set correctly
➜  curl -s -XDELETE 'localhost:9200/functional-*?ignore_unavailable=true' | jq '.'
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Wildcard expressions or all indices are not allowed"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Wildcard expressions or all indices are not allowed"
  },
  "status": 400
}

@spalger
Copy link
Contributor

spalger commented Jan 25, 2021

I'm running a master snapshot built by Kibana's ES Snapshot mechanism, which we use to allow tracking master without breaking CI when breaking changes are merged into ES. The snapshot can be downloaded from https://storage.googleapis.com/kibana-ci-es-snapshots-daily/8.0.0/archives/20210124-194645_63c85ff3e84/elasticsearch-8.0.0-SNAPSHOT-darwin-x86_64.tar.gz

We are currently running ES with security enabled, which maybe has something to do with it, and the CLI options: -E indices.query.bool.max_nested_depth=100 -E action.destructive_requires_name=true

I can reproduce the issue with a single request:

curl -s -XDELETE 'http://elastic:changeme@localhost:9200/functional-test-actions-index?ignore_unavailable=true&pretty'
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "Wildcard expressions or all indices are not allowed"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "Wildcard expressions or all indices are not allowed"
  },
  "status" : 400
}

@williamrandolph
Copy link
Contributor

@spalger Thanks for the additional information and clean reproduction line! It looks like having security enabled makes the difference. I've reproduced the issue on the 7.10.2 release, so it's not specific to this PR and I won't consider it a blocker for merging. I will, however, make sure we have an issue covering the bug and link it back to this PR.

@spalger
Copy link
Contributor

spalger commented Jan 25, 2021

On second thought I don't think it's a good idea to update Kibana in a bunch of places to handle ES responding with 400 instead of 404. If you decide to merge this PR before #67958 is fixed then Kibana will only work with action.destructive_requires_name=false, which we can use by default for most Kibana dev and testing, but it means Kibana master breaks in pretty major ways when run against ES master which is a state we don't want to be in for very long. Basically, I don't think I'm in any way eligible to dictate priorities here but it would make things a good deal more stable for us if we could fix #67958 first.

@williamrandolph
Copy link
Contributor

@spalger Thanks for the feedback. I've got PR #68021 in progress to fix the issue with unexpected wildcard warnings and Elasticsearch security, and I'll try to get it in ASAP so that you can verify the fix before this one is merged.

@williamrandolph
Copy link
Contributor

@elasticmachine update branch

@williamrandolph
Copy link
Contributor

@spalger I merged #68021 to master and 7.x — does that unblock things on your end?

@spalger
Copy link
Contributor

spalger commented Jan 28, 2021

I think that makes us g2g, much appreciated!

@mark-vieira
Copy link
Contributor

@elasticmachine update branch

@williamrandolph williamrandolph merged commit 60f4d22 into elastic:master Mar 31, 2021
yaauie added a commit to yaauie/logstash-output-elasticsearch that referenced this pull request Apr 6, 2021
The default value of Elasticsearch's `action.destructive_requires_rename` has
changed to true in elastic/elasticsearch#66908 which
causes our integration tests' wildcard deletes to fail. By specifying this
config explicitly, we ensure the desired behaviour is selected.
yaauie added a commit to logstash-plugins/logstash-output-elasticsearch that referenced this pull request Apr 6, 2021
* fix: prevent sub-batch 413's from infinitely retrying whole batch

The Http Client breaks batches of actions into sub-batches that are up to 20MB
in size, sending larger actions as batches-of-one, and zips the responses
together to emulate a single batch response from the Elasticsearch API.

When an individual HTTP request is rejected by Elasticsearch (or by an
intermediate proxy or load-balancer) with an HTTP/1.1 413, we can emulate
the error response instead of blowing an exception through to the whole batch.
This allows only the offending events/actions to be subject to retry logic.

Along the way, we improve logging at the `debug` level for sub-batches, and
emit clear `warn`-level logs with payload sizes when we hit HTTP 413 rejections.

* size batch by _decompressed_ payload size

* tests: config elasticsearch to allow wildcard deletes

The default value of Elasticsearch's `action.destructive_requires_rename` has
changed to true in elastic/elasticsearch#66908 which
causes our integration tests' wildcard deletes to fail. By specifying this
config explicitly, we ensure the desired behaviour is selected.
Leaf-Lin added a commit that referenced this pull request Apr 1, 2022
As per #66908, the setting now defaults to `True`, but it's not shown in the doc.  Can we please have the doc updated?
lockewritesdocs pushed a commit that referenced this pull request Aug 25, 2022
As per #66908, the setting now defaults to `True`, but it's not shown in the doc.  Can we please have the doc updated?
Leaf-Lin added a commit to Leaf-Lin/elasticsearch that referenced this pull request Aug 25, 2022
As per elastic#66908, the setting now defaults to `True`, but it's not shown in the doc.  Can we please have the doc updated?
Leaf-Lin added a commit to Leaf-Lin/elasticsearch that referenced this pull request Aug 25, 2022
As per elastic#66908, the setting now defaults to `True`, but it's not shown in the doc.  Can we please have the doc updated?
elasticsearchmachine pushed a commit that referenced this pull request Aug 25, 2022
As per #66908, the setting now defaults to `True`, but it's not shown in the doc.  Can we please have the doc updated?
elasticsearchmachine pushed a commit that referenced this pull request Aug 25, 2022
As per #66908, the setting now defaults to `True`, but it's not shown in the doc.  Can we please have the doc updated?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking :Core/Infra/Settings Settings infrastructure and APIs >enhancement Team:Core/Infra Meta label for core/infra team v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change action.destructive_requires_name to true by default to avoid data deleted by accident
9 participants