Remove BWC conditions after backport of #35731

This PR was backported to 6.x, so the extra BWC conditions are not needed anymore
This commit is contained in:
Yannick Welsch 2018-11-23 17:11:06 +01:00
parent e22a83554e
commit 51d2e986c5
2 changed files with 2 additions and 7 deletions

View File

@ -214,14 +214,13 @@ public class RepositoriesService implements ClusterStateApplier {
public void verifyRepository(final String repositoryName, final ActionListener<VerifyResponse> listener) { public void verifyRepository(final String repositoryName, final ActionListener<VerifyResponse> listener) {
final Repository repository = repository(repositoryName); final Repository repository = repository(repositoryName);
final boolean readOnly = repository.isReadOnly();
try { try {
threadPool.executor(ThreadPool.Names.SNAPSHOT).execute(() -> { threadPool.executor(ThreadPool.Names.SNAPSHOT).execute(() -> {
try { try {
final String verificationToken = repository.startVerification(); final String verificationToken = repository.startVerification();
if (verificationToken != null) { if (verificationToken != null) {
try { try {
verifyAction.verify(repositoryName, readOnly, verificationToken, new ActionListener<VerifyResponse>() { verifyAction.verify(repositoryName, verificationToken, new ActionListener<VerifyResponse>() {
@Override @Override
public void onResponse(VerifyResponse verifyResponse) { public void onResponse(VerifyResponse verifyResponse) {
threadPool.executor(ThreadPool.Names.SNAPSHOT).execute(() -> { threadPool.executor(ThreadPool.Names.SNAPSHOT).execute(() -> {

View File

@ -24,7 +24,6 @@ import com.carrotsearch.hppc.cursors.ObjectCursor;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.node.DiscoveryNodes;
@ -67,7 +66,7 @@ public class VerifyNodeRepositoryAction {
transportService.registerRequestHandler(ACTION_NAME, VerifyNodeRepositoryRequest::new, ThreadPool.Names.SNAPSHOT, new VerifyNodeRepositoryRequestHandler()); transportService.registerRequestHandler(ACTION_NAME, VerifyNodeRepositoryRequest::new, ThreadPool.Names.SNAPSHOT, new VerifyNodeRepositoryRequestHandler());
} }
public void verify(String repository, boolean readOnly, String verificationToken, final ActionListener<VerifyResponse> listener) { public void verify(String repository, String verificationToken, final ActionListener<VerifyResponse> listener) {
final DiscoveryNodes discoNodes = clusterService.state().nodes(); final DiscoveryNodes discoNodes = clusterService.state().nodes();
final DiscoveryNode localNode = discoNodes.getLocalNode(); final DiscoveryNode localNode = discoNodes.getLocalNode();
@ -75,9 +74,6 @@ public class VerifyNodeRepositoryAction {
final List<DiscoveryNode> nodes = new ArrayList<>(); final List<DiscoveryNode> nodes = new ArrayList<>();
for (ObjectCursor<DiscoveryNode> cursor : masterAndDataNodes) { for (ObjectCursor<DiscoveryNode> cursor : masterAndDataNodes) {
DiscoveryNode node = cursor.value; DiscoveryNode node = cursor.value;
if (readOnly && node.getVersion().before(Version.V_7_0_0)) {
continue;
}
nodes.add(node); nodes.add(node);
} }
final CopyOnWriteArrayList<VerificationFailure> errors = new CopyOnWriteArrayList<>(); final CopyOnWriteArrayList<VerificationFailure> errors = new CopyOnWriteArrayList<>();