Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Brooks committed Jan 30, 2019
1 parent eea717e commit 34a8879
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,23 @@ public boolean isCcrAllowed() {
}

/**
* Fetches the leader index metadata and history UUIDs for leader index shards from the remote cluster.
* Before fetching the index metadata, the remote cluster is checked for license compatibility with CCR.
* If the remote cluster is not licensed for CCR, the {@code onFailure} consumer is is invoked. Otherwise,
* the specified consumer is invoked with the leader index metadata fetched from the remote cluster.
* Fetches the remote cluster state, leader index metadata, and history UUIDs for leader index shards from
* the remote cluster. Before fetching the index metadata, the remote cluster is checked for license
* compatibility with CCR. If the remote cluster is not licensed for CCR, the {@code onFailure} consumer
* is is invoked. Otherwise, the specified consumer is invoked with the cluster state and leader index metadata
* fetched from the remote cluster.
*
* @param client the client
* @param clusterAlias the remote cluster alias
* @param fetchNodes whether this request should fetch the nodes of the remote cluster
* @param leaderIndex the name of the leader index
* @param onFailure the failure consumer
* @param consumer the consumer for supplying the leader index metadata and historyUUIDs of all leader shards
*/
public void checkRemoteClusterLicenseAndFetchLeaderIndexMetadataAndHistoryUUIDs(
public void checkRemoteClusterLicenseAndFetchClusterStateLeaderIndexMetadataAndHistoryUUIDs(
final Client client,
final String clusterAlias,
final boolean fetchNodes,
final String leaderIndex,
final Consumer<Exception> onFailure,
final BiConsumer<String[], Tuple<ClusterState, IndexMetaData>> consumer) {
Expand All @@ -117,6 +120,7 @@ public void checkRemoteClusterLicenseAndFetchLeaderIndexMetadataAndHistoryUUIDs(
request.clear();
request.metaData(true);
request.indices(leaderIndex);
request.nodes(fetchNodes);
checkRemoteClusterLicenseAndFetchClusterState(
client,
clusterAlias,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ protected void masterOperation(

String leaderIndex = request.getLeaderIndex();
Version minNodeVersion = state.getNodes().getMinNodeVersion();
ccrLicenseChecker.checkRemoteClusterLicenseAndFetchLeaderIndexMetadataAndHistoryUUIDs(
ccrLicenseChecker.checkRemoteClusterLicenseAndFetchClusterStateLeaderIndexMetadataAndHistoryUUIDs(
client,
remoteCluster,
true,
leaderIndex,
listener::onFailure,
(historyUUID, metaDataTuple) -> createFollowerIndex(metaDataTuple, historyUUID, request, listener, minNodeVersion));
Expand Down Expand Up @@ -146,8 +147,8 @@ private void createFollowerIndex(
|| metaDataTuple.v1().getNodes().getMinNodeVersion().before(Version.V_6_7_0);

if (pre67CompatibilityMode) {
logger.warn("Pre-6.7 nodes present in local/remote cluster. Cannot bootstrap from remote. Creating empty follower index [{}] " +
"and initiating following [{}, {}].", request.getFollowRequest().getFollowerIndex(), request.getRemoteCluster(),
logger.debug("Pre-6.7 nodes present in local/remote cluster. Cannot bootstrap from remote. Creating empty follower index " +
"[{}] and initiating following [{}, {}].", request.getFollowRequest().getFollowerIndex(), request.getRemoteCluster(),
request.getLeaderIndex());
pre67PutFollow.doPre67PutFollow(request, leaderIndexMetaData, historyUUID, listener);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ protected void masterOperation(final ResumeFollowAction.Request request,
// Validates whether the leader cluster has been configured properly:
client.getRemoteClusterClient(leaderCluster);
final String leaderIndex = ccrMetadata.get(Ccr.CCR_CUSTOM_METADATA_LEADER_INDEX_NAME_KEY);
ccrLicenseChecker.checkRemoteClusterLicenseAndFetchLeaderIndexMetadataAndHistoryUUIDs(
ccrLicenseChecker.checkRemoteClusterLicenseAndFetchClusterStateLeaderIndexMetadataAndHistoryUUIDs(
client,
leaderCluster,
false,
leaderIndex,
listener::onFailure,
(leaderHistoryUUID, metaDataTuple) -> {
Expand Down

0 comments on commit 34a8879

Please sign in to comment.