Skip to content

Commit

Permalink
Merge branch 'main' into version/plugin-descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
williamrandolph committed Oct 18, 2023
2 parents 7481f55 + 28e6e4f commit 90b2b02
Show file tree
Hide file tree
Showing 28 changed files with 2,610 additions and 1,633 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/100990.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 100990
summary: Add status code to `rest.suppressed` log output
area: "Infra/Logging"
type: enhancement
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class TestSystemIndexDescriptor extends SystemIndexDescriptor {
0,
"version",
"stack",
Version.fromString(Build.current().minWireCompatVersion()),
null,
Type.INTERNAL_MANAGED,
List.of(),
List.of(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

package org.elasticsearch.search;

import org.apache.lucene.tests.util.LuceneTestCase;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.action.ActionFuture;
import org.elasticsearch.action.search.MultiSearchAction;
Expand All @@ -33,6 +32,7 @@
import org.elasticsearch.tasks.TaskCancelledException;
import org.elasticsearch.test.AbstractSearchCancellationTestCase;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.junit.annotations.TestIssueLogging;
import org.elasticsearch.transport.TransportService;

import java.util.ArrayList;
Expand All @@ -50,10 +50,15 @@
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.notNullValue;

@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/99929")
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE)
public class SearchCancellationIT extends AbstractSearchCancellationTestCase {

@Override
// TODO all tests need to be updated to work with concurrent search
protected boolean enableConcurrentSearch() {
return false;
}

public void testCancellationDuringQueryPhase() throws Exception {

List<ScriptedBlockPlugin> plugins = initBlockFactory();
Expand Down Expand Up @@ -226,6 +231,10 @@ public void testCancelMultiSearch() throws Exception {
}
}

@TestIssueLogging(
value = "org.elasticsearch.action.search:TRACE,org.elasticsearch.search:TRACE," + "org.elasticsearch.tasks:TRACE",
issueUrl = "https://github.com/elastic/elasticsearch/issues/99929"
)
public void testCancelFailedSearchWhenPartialResultDisallowed() throws Exception {
int numberOfShards = between(2, 5);
createIndex("test", numberOfShards, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.OperationRouting;
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.Node;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.xcontent.XContentType;
Expand Down Expand Up @@ -245,7 +245,7 @@ public void testCustomPreferenceUnaffectedByOtherShardMovements() {
.put(SETTING_NUMBER_OF_REPLICAS, 0)
.put(
IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_PREFIX + "._name",
internalCluster().getDataNodeInstance(Node.class).settings().get(Node.NODE_NAME_SETTING.getKey())
internalCluster().getNodeNameThat(DiscoveryNode::canContainData)
),
"test2"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ protected SystemIndexDescriptor(
int indexFormat,
String mappingsNodeVersionMetaKey,
String origin,
Version minimumNodeVersion,
@Deprecated Version minimumNodeVersion,
Type type,
List<String> allowedElasticProductOrigins,
List<SystemIndexDescriptor> priorSystemIndexDescriptors,
Expand Down Expand Up @@ -301,7 +301,6 @@ protected SystemIndexDescriptor(
throw new IllegalArgumentException("External system indices without allowed products is not a valid combination");
}

Objects.requireNonNull(minimumNodeVersion, "minimumNodeVersion must be provided!");
Objects.requireNonNull(priorSystemIndexDescriptors, "priorSystemIndexDescriptors must not be null");
if (priorSystemIndexDescriptors.isEmpty() == false) {
// the rules for prior system index descriptors
Expand All @@ -310,15 +309,20 @@ protected SystemIndexDescriptor(
// 3. Prior system index descriptors may not have other prior system index descriptors
// to avoid multiple branches that need followed
// 4. Must have same indexPattern, primaryIndex, and alias
Set<Version> versions = Sets.newHashSetWithExpectedSize(priorSystemIndexDescriptors.size() + 1);
versions.add(minimumNodeVersion);
Set<MappingsVersion> versions = Sets.newHashSetWithExpectedSize(priorSystemIndexDescriptors.size() + 1);
versions.add(mappingsVersion);
for (SystemIndexDescriptor prior : priorSystemIndexDescriptors) {
if (versions.add(prior.minimumNodeVersion) == false) {
throw new IllegalArgumentException(prior + " has the same minimum node version as another descriptor");
if (versions.add(prior.mappingsVersion) == false) {
throw new IllegalArgumentException(prior + " has the same mappings version as another descriptor");
}
if (prior.minimumNodeVersion.after(minimumNodeVersion)) {
if (prior.mappingsVersion.version() > mappingsVersion.version()) {
throw new IllegalArgumentException(
prior + " has minimum node version [" + prior.minimumNodeVersion + "] which is after [" + minimumNodeVersion + "]"
prior
+ " has mappings version ["
+ prior.mappingsVersion.version()
+ "] which is after ["
+ mappingsVersion.version()
+ "]"
);
}
if (prior.priorSystemIndexDescriptors.isEmpty() == false) {
Expand Down
Loading

0 comments on commit 90b2b02

Please sign in to comment.