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

Remove retention leases when unfollowing #39088

Merged
merged 11 commits into from
Feb 20, 2019

Conversation

jasontedor
Copy link
Member

@jasontedor jasontedor commented Feb 19, 2019

This commit attempts to remove the retention leases on the leader shards when unfollowing an index. This is best effort, since the leader might not be available.

Closes #34648
Relates #37165

This commit attempts to remove the retention leases on the leader shards
when unfollowing an index. This is best effort, since the leader might
not be available.
@jasontedor jasontedor added >enhancement WIP v7.0.0 :Distributed Indexing/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. v6.7.0 v8.0.0 v7.2.0 labels Feb 19, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@jasontedor jasontedor mentioned this pull request Feb 19, 2019
24 tasks
remoteClient,
ActionListener.wrap(
groupListener::onResponse,
// TODO: should this should exponentially backoff, or should we simply never retry?
Copy link
Member Author

Choose a reason for hiding this comment

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

@martijnvg @dnhatn I opened this PR as WIP for discussion on this point. I am curious to hear your thoughts. Note that failure is a definite possibility since a common use case for the unfollow API will be when the leader is unavailable.

Copy link
Member

Choose a reason for hiding this comment

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

I'm leaning towards not retrying. However I think that we should add a field in the response indication whether retention lease removal was successful. (retention_lease_removal boolean field?)

Copy link
Member

Choose a reason for hiding this comment

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

(my motivation for not retrying is, that because it is a common scenario and therefore retrying would be futile to begin with).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's my inclination as well.

@dnhatn Is this okay with you too?

Copy link
Member

Choose a reason for hiding this comment

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

I am + 1 to "not retry here" because a retention lease will be automatically expired. We need to make sure ILM works well in this scenario.

…follow

* elastic/master: (37 commits)
  Enable test logging for TransformIntegrationTests#testSearchTransform.
  stronger wording for ilm+rollover in docs (elastic#39159)
  Mute SingleNodeTests (elastic#39156)
  AwaitsFix XPackUsageIT#testXPackCcrUsage.
  Resolve concurrency with watcher trigger service (elastic#39092)
  Fix median calculation in MedianAbsoluteDeviationAggregatorTests (elastic#38979)
  [DOCS] Edits the remote clusters documentation (elastic#38996)
  add version 6.6.2
  Revert "Mute failing test 20_mix_typless_typefull (elastic#38781)" (elastic#38912)
  Rebuild remote connections on profile changes (elastic#37678)
  Document 'max_size' parameter as shard size for rollover (elastic#38750)
  Add some missing toString() implementations (elastic#39124)
  Migrate Streamable to Writeable for cluster block package (elastic#37391)
  fix RethrottleTests retry (elastic#38978)
  Disable date parsing test in non english locale (elastic#39052)
  Remove BCryptTests (elastic#39098)
  [ML] Stop the ML memory tracker before closing node (elastic#39111)
  Allow retention lease operations under blocks (elastic#39089)
  ML refactor DatafeedsConfig(Update) so defaults are not populated in queries or aggs (elastic#38822)
  Fix retention leases sync on recovery test
  ...
Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @jasontedor.

retentionLeasesRemoved = in.readBoolean();
// noinspection StatementWithEmptyBody
if (retentionLeasesRemoved) {

Copy link
Member

Choose a reason for hiding this comment

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

Did you try to have a symmetric flow with writeTo?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but now I have removed this code. 😇

@jasontedor
Copy link
Member Author

@gwbrown @dnhatn @martijnvg I have removed the WIP label, this is ready for review.

@gwbrown @martijnvg I decided to not implement the case of not being able to remove the shards the way that you have proposed. I went a different way for two reasons:

  • I did not like having a different way to express failure than we normally express failure; either the request succeeded or it did not and I think we should not indicate certain kinds of failures (inability to remove retention leases) differently from others. Instead, we indicate a failure to remove the retention leases via metadata on a wrapper exception.
  • We would have to lift UnfollowAction.Response transport response to a shard dependency between CCR and ILM (like x-pack-core).

Please me know your thoughts and if this will suffice for ILM.

@jasontedor
Copy link
Member Author

One last note, I think the integration tests I added cover all the branches.

@martijnvg
Copy link
Member

@jasontedor That should work too; the ilm unfollow step can check if the es.failed_to_remove_retention_leases metadata has been set and not threat that as a regular failure.

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM

@jasontedor jasontedor merged commit ae7b946 into elastic:master Feb 20, 2019
jasontedor added a commit that referenced this pull request Feb 20, 2019
This commit attempts to remove the retention leases on the leader shards
when unfollowing an index. This is best effort, since the leader might
not be available.
jasontedor added a commit that referenced this pull request Feb 20, 2019
This commit attempts to remove the retention leases on the leader shards
when unfollowing an index. This is best effort, since the leader might
not be available.
@jasontedor jasontedor deleted the retention-lease-unfollow branch February 20, 2019 12:20
jasontedor added a commit that referenced this pull request Feb 20, 2019
This commit attempts to remove the retention leases on the leader shards
when unfollowing an index. This is best effort, since the leader might
not be available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. >enhancement v6.7.0 v7.0.0-rc2 v7.2.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ILM] Allow ILM and CCR to work well together
5 participants