-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate retention leases to recovery from remote (#38829)
This commit is the first step in integrating shard history retention leases with CCR. In this commit we integrate shard history retention leases with recovery from remote. Before we start transferring files, we take out a retention lease on the primary. Then during the file copy phase, we repeatedly renew the retention lease. Finally, when recovery from remote is complete, we disable the background renewing of the retention lease.
- Loading branch information
1 parent
5a58c9e
commit 2024e33
Showing
14 changed files
with
989 additions
and
96 deletions.
There are no files selected for viewing
This file contains 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 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 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
40 changes: 40 additions & 0 deletions
40
x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/CcrRetentionLeases.java
This file contains 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,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", | ||
localClusterName, | ||
followerIndex.getName(), | ||
followerIndex.getUUID(), | ||
remoteClusterAlias, | ||
leaderIndex.getName(), | ||
leaderIndex.getUUID()); | ||
} | ||
|
||
} |
Oops, something went wrong.