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

Integrate retention leases to recovery from remote #38829

Merged
merged 40 commits into from
Feb 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
82d464d
Integrate retention leases to recovery from remote
jasontedor Feb 13, 2019
6138176
Fix accidental import
jasontedor Feb 13, 2019
9ca7526
Update x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/re…
jasontedor Feb 13, 2019
530b55b
Update x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/re…
jasontedor Feb 13, 2019
f6e129e
Force follower to fall behind
jasontedor Feb 13, 2019
d294e99
Add more tests
jasontedor Feb 13, 2019
11120d4
Merge branch 'master' into retention-lease-ccr
jasontedor Feb 13, 2019
b13c6c5
Make linter happy
jasontedor Feb 13, 2019
ab4d61c
Fix lost import
jasontedor Feb 13, 2019
30f1366
Finally
jasontedor Feb 13, 2019
e58bbbc
Merge branch 'master' into retention-lease-ccr
jasontedor Feb 13, 2019
d5dee9b
Tweak some log messages
jasontedor Feb 13, 2019
ae9cff2
wip
jasontedor Feb 14, 2019
d027302
Merge remote-tracking branch 'elastic/master' into retention-lease-ccr
jasontedor Feb 14, 2019
a42d229
Fix under security
jasontedor Feb 14, 2019
2e6e705
Shift log message
jasontedor Feb 14, 2019
cbe044c
More tests
jasontedor Feb 14, 2019
0ac5533
Fix comment
jasontedor Feb 14, 2019
6791827
Fix imports
jasontedor Feb 14, 2019
0dcf6c9
Remove newline
jasontedor Feb 14, 2019
b8b2537
Merge remote-tracking branch 'elastic/master' into retention-lease-ccr
jasontedor Feb 14, 2019
1633dfb
Merge branch 'master' into retention-lease-ccr
jasontedor Feb 14, 2019
4005309
Merge branch 'master' into retention-lease-ccr
jasontedor Feb 14, 2019
086e87e
Refactor to helper
jasontedor Feb 14, 2019
69d757c
Enhance logging messages
jasontedor Feb 15, 2019
cdf9bdc
Refactor
jasontedor Feb 15, 2019
fa7b4df
Merge remote-tracking branch 'elastic/master' into retention-lease-ccr
jasontedor Feb 15, 2019
5bbb07f
Fix imports
jasontedor Feb 15, 2019
6fc440b
Background syncs should be async
jasontedor Feb 15, 2019
30232bb
Remove leftover comment from previous iteration
jasontedor Feb 15, 2019
d45d829
Merge branch 'master' into retention-lease-ccr
jasontedor Feb 15, 2019
8fd90fe
Fix imports
jasontedor Feb 15, 2019
21edf1d
Fix mocking tests
jasontedor Feb 16, 2019
7e547ee
Refactor
jasontedor Feb 16, 2019
d471872
Update x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/re…
jasontedor Feb 16, 2019
fc9a300
Update x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/re…
jasontedor Feb 16, 2019
2c77ad4
Merge remote-tracking branch 'elastic/master' into retention-lease-ccr
jasontedor Feb 16, 2019
6da443a
Tweak logging message
jasontedor Feb 16, 2019
4262372
Merge branch 'master' into retention-lease-ccr
jasontedor Feb 16, 2019
dec3d28
Test awaits fix
jasontedor Feb 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void onFailure(final Exception e) {
}

@Override
protected Response shardOperation(final T request, final ShardId shardId) throws IOException {
protected Response shardOperation(final T request, final ShardId shardId) {
throw new UnsupportedOperationException();
}

Expand All @@ -136,10 +136,10 @@ protected boolean resolveIndex(final T request) {
public static class Add extends Action<Response> {

public static final Add INSTANCE = new Add();
public static final String NAME = "indices:admin/seq_no/add_retention_lease";
public static final String ACTION_NAME = "indices:admin/seq_no/add_retention_lease";

private Add() {
super(NAME);
super(ACTION_NAME);
}

public static class TransportAction extends TransportRetentionLeaseAction<AddRequest> {
Expand All @@ -153,7 +153,7 @@ public TransportAction(
final IndexNameExpressionResolver indexNameExpressionResolver,
final IndicesService indicesService) {
super(
NAME,
ACTION_NAME,
threadPool,
clusterService,
transportService,
Expand Down Expand Up @@ -186,10 +186,10 @@ public Response newResponse() {
public static class Renew extends Action<Response> {

public static final Renew INSTANCE = new Renew();
public static final String NAME = "indices:admin/seq_no/renew_retention_lease";
public static final String ACTION_NAME = "indices:admin/seq_no/renew_retention_lease";

private Renew() {
super(NAME);
super(ACTION_NAME);
}

public static class TransportAction extends TransportRetentionLeaseAction<RenewRequest> {
Expand All @@ -203,7 +203,7 @@ public TransportAction(
final IndexNameExpressionResolver indexNameExpressionResolver,
final IndicesService indicesService) {
super(
NAME,
ACTION_NAME,
threadPool,
clusterService,
transportService,
Expand Down Expand Up @@ -232,10 +232,10 @@ public Response newResponse() {
public static class Remove extends Action<Response> {

public static final Remove INSTANCE = new Remove();
public static final String NAME = "indices:admin/seq_no/remove_retention_lease";
public static final String ACTION_NAME = "indices:admin/seq_no/remove_retention_lease";

private Remove() {
super(NAME);
super(ACTION_NAME);
}

public static class TransportAction extends TransportRetentionLeaseAction<RemoveRequest> {
Expand All @@ -249,7 +249,7 @@ public TransportAction(
final IndexNameExpressionResolver indexNameExpressionResolver,
final IndicesService indicesService) {
super(
NAME,
ACTION_NAME,
threadPool,
clusterService,
transportService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public class RetentionLeaseAlreadyExistsException extends ResourceAlreadyExistsException {

RetentionLeaseAlreadyExistsException(final String id) {
public RetentionLeaseAlreadyExistsException(final String id) {
super("retention lease with ID [" + Objects.requireNonNull(id) + "] already exists");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public class RetentionLeaseNotFoundException extends ResourceNotFoundException {

RetentionLeaseNotFoundException(final String id) {
public RetentionLeaseNotFoundException(final String id) {
super("retention lease with ID [" + Objects.requireNonNull(id) + "] not found");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

package org.elasticsearch.xpack.ccr;

import org.elasticsearch.index.Index;

import java.util.Locale;

public class CcrRetentionLeases {

/**
* The retention lease ID used by followers.
*
* @param localClusterName the local cluster name
* @param followerIndex the follower index
* @param remoteClusterAlias the remote cluster alias
* @param leaderIndex the leader index
* @return the retention lease ID
*/
public static String retentionLeaseId(
final String localClusterName,
final Index followerIndex,
final String remoteClusterAlias,
final Index leaderIndex) {
return String.format(
Locale.ROOT,
"%s/%s/%s-following-%s/%s/%s",
jasontedor marked this conversation as resolved.
Show resolved Hide resolved
localClusterName,
followerIndex.getName(),
followerIndex.getUUID(),
remoteClusterAlias,
leaderIndex.getName(),
leaderIndex.getUUID());
}

}
Loading