Skip to content

Commit

Permalink
Remove some more old references to Version constants (elastic#102526)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecoop authored Nov 24, 2023
1 parent d44e05d commit d3a5087
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 303 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ResourceAlreadyExistsException;
import org.elasticsearch.ResourceNotFoundException;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.client.internal.OriginSettingClient;
Expand Down Expand Up @@ -197,8 +196,8 @@ public void clusterChanged(ClusterChangedEvent event) {
}

DiscoveryNode masterNode = event.state().nodes().getMasterNode();
if (masterNode == null || masterNode.getVersion().before(Version.V_7_14_0)) {
// wait for master to be upgraded so it understands geoip task
if (masterNode == null) {
// no master yet
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ReleasableLock;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.index.IndexSettings;
Expand Down Expand Up @@ -59,9 +60,9 @@
/**
* A legacy version of {@link ReplicaShardAllocatorIT#testPreferCopyCanPerformNoopRecovery()} verifying
* that the {@link ReplicaShardAllocator} prefers copies with matching sync_id.
* TODO: Remove this test in 9.0
*/
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0)
@UpdateForV9 // remove this test in v9
public class ReplicaShardAllocatorSyncIdIT extends ESIntegTestCase {

private static final AtomicBoolean allowFlush = new AtomicBoolean();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
package org.elasticsearch.cluster.action.index;

import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.mapping.put.AutoPutMappingAction;
import org.elasticsearch.action.support.PlainActionFuture;
Expand Down Expand Up @@ -128,7 +127,7 @@ protected void sendUpdateMapping(Index index, Mapping mappingUpdate, ActionListe
}

public void testSendUpdateMappingUsingAutoPutMappingAction() {
DiscoveryNodes nodes = DiscoveryNodes.builder().add(DiscoveryNodeUtils.builder("first").version(Version.V_7_9_0).build()).build();
DiscoveryNodes nodes = DiscoveryNodes.builder().add(DiscoveryNodeUtils.builder("first").build()).build();
ClusterState clusterState = ClusterState.builder(new ClusterName("_name")).nodes(nodes).build();
ClusterService clusterService = mock(ClusterService.class);
when(clusterService.state()).thenReturn(clusterState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.search.MultiSearchResponse;
import org.elasticsearch.action.search.SearchRequest;
Expand Down Expand Up @@ -54,7 +53,6 @@
public final class RuntimeUtils {

static final Logger QUERY_LOG = LogManager.getLogger(QueryClient.class);
public static final Version SWITCH_TO_MULTI_VALUE_FIELDS_VERSION = Version.V_7_15_0;

private RuntimeUtils() {}

Expand Down Expand Up @@ -173,7 +171,7 @@ public static HitExtractor createExtractor(FieldExtraction ref, EqlConfiguration
}

public static SearchRequest prepareRequest(SearchSourceBuilder source, boolean includeFrozen, String... indices) {
SearchRequest searchRequest = new SearchRequest(SWITCH_TO_MULTI_VALUE_FIELDS_VERSION);
SearchRequest searchRequest = new SearchRequest();
searchRequest.indices(indices);
searchRequest.source(source);
searchRequest.allowPartialSearchResults(false);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ public String storageName() {
}

public void testMountFullCopyAndRecoversCorrectly() throws Exception {
final Storage storage = Storage.FULL_COPY;
assumeVersion(Version.V_7_10_0, storage);

executeMountAndRecoversCorrectlyTestCase(storage, 6789L);
executeMountAndRecoversCorrectlyTestCase(Storage.FULL_COPY, 6789L);
}

public void testMountPartialCopyAndRecoversCorrectly() throws Exception {
Expand Down Expand Up @@ -115,10 +112,7 @@ private void executeMountAndRecoversCorrectlyTestCase(Storage storage, long numb
}

public void testBlobStoreCacheWithFullCopyInMixedVersions() throws Exception {
final Storage storage = Storage.FULL_COPY;
assumeVersion(Version.V_7_10_0, storage);

executeBlobCacheCreationTestCase(storage, 9876L);
executeBlobCacheCreationTestCase(Storage.FULL_COPY, 9876L);
}

public void testBlobStoreCacheWithPartialCopyInMixedVersions() throws Exception {
Expand Down Expand Up @@ -324,13 +318,6 @@ private void executeBlobCacheCreationTestCase(Storage storage, long numberOfDocs
}
}

private static void assumeVersion(Version minSupportedVersion, Storage storageType) {
assumeTrue(
"Searchable snapshots with storage type [" + storageType + "] is supported since version [" + minSupportedVersion + ']',
isOriginalClusterVersionAtLeast(minSupportedVersion)
);
}

private static void indexDocs(String indexName, long numberOfDocs) throws IOException {
final StringBuilder builder = new StringBuilder();
for (long i = 0L; i < numberOfDocs; i++) {
Expand Down

0 comments on commit d3a5087

Please sign in to comment.