-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Introduce forget follower API #39718
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
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
42cc3ca
Introduce forget follower API
jasontedor 27c3b68
Missing newline
jasontedor b0be97e
Fix precommit
jasontedor fde0537
Fix imports
jasontedor 1a31b3d
Fix docs
jasontedor 7976f8b
Merge branch 'master' into forget-follower
jasontedor ca59bf7
Remove beta
jasontedor b2f2cf1
Add javadocs
jasontedor 56ac397
Fix imports
jasontedor 20b2038
Remove unused class
jasontedor e68b0c0
Add permission
jasontedor 1564a7a
Make the test more realistic
jasontedor 3ab7cb7
Pause follower before remove leases
jasontedor 63721a4
Add HLRC docs
jasontedor f6592f5
Fix imports
jasontedor 33edd22
Fix method parameter
jasontedor 2e96e66
Fix permissions
jasontedor b5f6150
Simplify
jasontedor b31f6d3
Rename variable
jasontedor 3d372b3
Fix imports
jasontedor bbef603
Merge remote-tracking branch 'es/master' into forget-follower
martijnvg 2c3ef2e
Fix failing test
jasontedor 238c29b
Make failures more obvious
jasontedor 072e2e4
Simplify
jasontedor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/ForgetFollowerRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.client.ccr; | ||
|
||
import org.elasticsearch.client.Validatable; | ||
import org.elasticsearch.common.xcontent.ToXContentObject; | ||
import org.elasticsearch.common.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Represents a forget follower request. Note that this an expert API intended to be used only when unfollowing a follower index fails to | ||
* remove the follower retention leases. Please be sure that you understand the purpose this API before using. | ||
*/ | ||
public final class ForgetFollowerRequest implements ToXContentObject, Validatable { | ||
|
||
private final String followerCluster; | ||
|
||
private final String followerIndex; | ||
|
||
private final String followerIndexUUID; | ||
|
||
private final String leaderRemoteCluster; | ||
|
||
private final String leaderIndex; | ||
|
||
/** | ||
* The name of the leader index. | ||
* | ||
* @return the name of the leader index | ||
*/ | ||
public String leaderIndex() { | ||
return leaderIndex; | ||
} | ||
|
||
/** | ||
* Construct a forget follower request. | ||
* | ||
* @param followerCluster the name of the cluster containing the follower index to forget | ||
* @param followerIndex the name of follower index | ||
* @param followerIndexUUID the UUID of the follower index | ||
* @param leaderRemoteCluster the alias of the remote cluster containing the leader index from the perspective of the follower index | ||
* @param leaderIndex the name of the leader index | ||
*/ | ||
public ForgetFollowerRequest( | ||
final String followerCluster, | ||
final String followerIndex, | ||
final String followerIndexUUID, | ||
final String leaderRemoteCluster, | ||
final String leaderIndex) { | ||
this.followerCluster = Objects.requireNonNull(followerCluster); | ||
this.followerIndex = Objects.requireNonNull(followerIndex); | ||
this.followerIndexUUID = Objects.requireNonNull(followerIndexUUID); | ||
this.leaderRemoteCluster = Objects.requireNonNull(leaderRemoteCluster); | ||
this.leaderIndex = Objects.requireNonNull(leaderIndex); | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(final XContentBuilder builder, final Params params) throws IOException { | ||
builder.startObject(); | ||
{ | ||
builder.field("follower_cluster", followerCluster); | ||
builder.field("follower_index", followerIndex); | ||
builder.field("follower_index_uuid", followerIndexUUID); | ||
builder.field("leader_remote_cluster", leaderRemoteCluster); | ||
} | ||
builder.endObject(); | ||
return builder; | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why are the changes to the groovy files needed?
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.
For the docs tests where we fire forget follower requests, it is entirely too hard to set up a request that is not going to fail. For example, to set up a request that is not going to fail, we have to know the index UUID of the follower. Obtaining that in a docs test is not possible to my knowledge, we do not have a way to set a value to use in a later docs test? Maybe I am missing something?
However, the docs infrastructure automatically adds
is_false: _shards.failures
to every docs test. Therefore, I had to add a hook that enables us to say skip that check for these tests where we expect failures.Again, if there's a way to avoid the failures that I am not seeing, please let me know!
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.
Got it, thanks for the explanation!