Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -221,21 +221,21 @@ protected Response newResponse() {
@Override
protected void masterOperation(
final Request request, final ClusterState state, final ActionListener<Response> listener) throws Exception {
if (ccrLicenseChecker.isCcrAllowed()) {
final String[] indices = new String[]{request.getFollowRequest().getLeaderIndex()};
final Map<String, List<String>> remoteClusterIndices = remoteClusterService.groupClusterIndices(indices, s -> false);
if (remoteClusterIndices.containsKey(RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY)) {
createFollowerIndexAndFollowLocalIndex(request, state, listener);
} else {
assert remoteClusterIndices.size() == 1;
final Map.Entry<String, List<String>> entry = remoteClusterIndices.entrySet().iterator().next();
assert entry.getValue().size() == 1;
final String clusterAlias = entry.getKey();
final String leaderIndex = entry.getValue().get(0);
createFollowerIndexAndFollowRemoteIndex(request, clusterAlias, leaderIndex, listener);
}
} else {
if (ccrLicenseChecker.isCcrAllowed() == false) {
listener.onFailure(LicenseUtils.newComplianceException("ccr"));
return;
}
final String[] indices = new String[]{request.getFollowRequest().getLeaderIndex()};
final Map<String, List<String>> remoteClusterIndices = remoteClusterService.groupClusterIndices(indices, s -> false);
if (remoteClusterIndices.containsKey(RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY)) {
createFollowerIndexAndFollowLocalIndex(request, state, listener);
} else {
assert remoteClusterIndices.size() == 1;
final Map.Entry<String, List<String>> entry = remoteClusterIndices.entrySet().iterator().next();
assert entry.getValue().size() == 1;
final String clusterAlias = entry.getKey();
final String leaderIndex = entry.getValue().get(0);
createFollowerIndexAndFollowRemoteIndex(request, clusterAlias, leaderIndex, listener);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,21 +328,21 @@ public TransportAction(
protected void doExecute(final Task task,
final Request request,
final ActionListener<AcknowledgedResponse> listener) {
if (ccrLicenseChecker.isCcrAllowed()) {
final String[] indices = new String[]{request.leaderIndex};
final Map<String, List<String>> remoteClusterIndices = remoteClusterService.groupClusterIndices(indices, s -> false);
if (remoteClusterIndices.containsKey(RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY)) {
followLocalIndex(request, listener);
} else {
assert remoteClusterIndices.size() == 1;
final Map.Entry<String, List<String>> entry = remoteClusterIndices.entrySet().iterator().next();
assert entry.getValue().size() == 1;
final String clusterAlias = entry.getKey();
final String leaderIndex = entry.getValue().get(0);
followRemoteIndex(request, clusterAlias, leaderIndex, listener);
}
} else {
if (ccrLicenseChecker.isCcrAllowed() == false) {
listener.onFailure(LicenseUtils.newComplianceException("ccr"));
return;
}
final String[] indices = new String[]{request.leaderIndex};
final Map<String, List<String>> remoteClusterIndices = remoteClusterService.groupClusterIndices(indices, s -> false);
if (remoteClusterIndices.containsKey(RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY)) {
followLocalIndex(request, listener);
} else {
assert remoteClusterIndices.size() == 1;
final Map.Entry<String, List<String>> entry = remoteClusterIndices.entrySet().iterator().next();
assert entry.getValue().size() == 1;
final String clusterAlias = entry.getKey();
final String leaderIndex = entry.getValue().get(0);
followRemoteIndex(request, clusterAlias, leaderIndex, listener);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ protected void doExecute(
final Task task,
final CcrStatsAction.TasksRequest request,
final ActionListener<CcrStatsAction.TasksResponse> listener) {
if (ccrLicenseChecker.isCcrAllowed()) {
super.doExecute(task, request, listener);
} else {
if (ccrLicenseChecker.isCcrAllowed() == false) {
listener.onFailure(LicenseUtils.newComplianceException("ccr"));
return;
}
super.doExecute(task, request, listener);
}

@Override
Expand Down