Skip to content

Commit 536c2cc

Browse files
committed
Merge branch '6.x' into ccr-6.x
* 6.x: Update Tika version to 1.15 Introduce templating support to timezone/locale in DateProcessor (#27089) Increase logging on qa:mixed-cluster tests Update to AWS SDK 1.11.223 (#27278) Improve error message for parse failures of completion fields (#27297) Remove optimisations to reuse objects when applying a new `ClusterState` (#27317) Decouple `ChannelFactory` from Tcp classes (#27286) Use PlainListenableActionFuture for CloseFuture (#26242) Fix find remote when building BWC Remove colons from task and configuration names Fix snapshot getting stuck in INIT state (#27214) Snapshot/Restore: better handle incorrect chunk_size settings in FS repo (#26844) Add unreleased 5.6.5 version number testCreateSplitIndexToN: do not set `routing_partition_size` to >= `number_of_routing_shards` Correct comment in index shard test Roll translog generation on primary promotion ObjectParser: Replace IllegalStateException with ParsingException (#27302) scripted_metric _agg parameter disappears if params are provided (#27159) Update discovery-ec2.asciidoc
2 parents 2a151ff + 0a50fca commit 536c2cc

File tree

78 files changed

+987
-300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+987
-300
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class BuildPlugin implements Plugin<Project> {
239239

240240
/** Return the configuration name used for finding transitive deps of the given dependency. */
241241
private static String transitiveDepConfigName(String groupId, String artifactId, String version) {
242-
return "_transitive_${groupId}:${artifactId}:${version}"
242+
return "_transitive_${groupId}_${artifactId}_${version}"
243243
}
244244

245245
/**

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ class ClusterFormationTasks {
429429

430430
Project pluginProject = plugin.getValue()
431431
verifyProjectHasBuildPlugin(name, node.nodeVersion, project, pluginProject)
432-
String configurationName = "_plugin_${prefix}_${pluginProject.path}"
432+
String configurationName = pluginConfigurationName(prefix, pluginProject)
433433
Configuration configuration = project.configurations.findByName(configurationName)
434434
if (configuration == null) {
435435
configuration = project.configurations.create(configurationName)
@@ -458,13 +458,21 @@ class ClusterFormationTasks {
458458
return copyPlugins
459459
}
460460

461+
private static String pluginConfigurationName(final String prefix, final Project project) {
462+
return "_plugin_${prefix}_${project.path}".replace(':', '_')
463+
}
464+
465+
private static String pluginBwcConfigurationName(final String prefix, final Project project) {
466+
return "_plugin_bwc_${prefix}_${project.path}".replace(':', '_')
467+
}
468+
461469
/** Configures task to copy a plugin based on a zip file resolved using dependencies for an older version */
462470
static Task configureCopyBwcPluginsTask(String name, Project project, Task setup, NodeInfo node, String prefix) {
463471
Configuration bwcPlugins = project.configurations.getByName("${prefix}_elasticsearchBwcPlugins")
464472
for (Map.Entry<String, Project> plugin : node.config.plugins.entrySet()) {
465473
Project pluginProject = plugin.getValue()
466474
verifyProjectHasBuildPlugin(name, node.nodeVersion, project, pluginProject)
467-
String configurationName = "_plugin_bwc_${prefix}_${pluginProject.path}"
475+
String configurationName = pluginBwcConfigurationName(prefix, pluginProject)
468476
Configuration configuration = project.configurations.findByName(configurationName)
469477
if (configuration == null) {
470478
configuration = project.configurations.create(configurationName)
@@ -503,9 +511,9 @@ class ClusterFormationTasks {
503511
static Task configureInstallPluginTask(String name, Project project, Task setup, NodeInfo node, Project plugin, String prefix) {
504512
final FileCollection pluginZip;
505513
if (node.nodeVersion != VersionProperties.elasticsearch) {
506-
pluginZip = project.configurations.getByName("_plugin_bwc_${prefix}_${plugin.path}")
514+
pluginZip = project.configurations.getByName(pluginBwcConfigurationName(prefix, plugin))
507515
} else {
508-
pluginZip = project.configurations.getByName("_plugin_${prefix}_${plugin.path}")
516+
pluginZip = project.configurations.getByName(pluginConfigurationName(prefix, plugin))
509517
}
510518
// delay reading the file location until execution time by wrapping in a closure within a GString
511519
final Object file = "${-> new File(node.pluginsTmpDir, pluginZip.singleFile.getName()).toURI().toURL().toString()}"

core/src/main/java/org/elasticsearch/Version.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ public class Version implements Comparable<Version> {
100100
public static final Version V_5_6_3 = new Version(V_5_6_3_ID, org.apache.lucene.util.Version.LUCENE_6_6_1);
101101
public static final int V_5_6_4_ID = 5060499;
102102
public static final Version V_5_6_4 = new Version(V_5_6_4_ID, org.apache.lucene.util.Version.LUCENE_6_6_1);
103+
public static final int V_5_6_5_ID = 5060599;
104+
public static final Version V_5_6_5 = new Version(V_5_6_5_ID, org.apache.lucene.util.Version.LUCENE_6_6_1);
103105
public static final int V_6_0_0_alpha1_ID = 6000001;
104106
public static final Version V_6_0_0_alpha1 = new Version(V_6_0_0_alpha1_ID, org.apache.lucene.util.Version.LUCENE_7_0_0);
105107
public static final int V_6_0_0_alpha2_ID = 6000002;
@@ -148,6 +150,8 @@ public static Version fromId(int id) {
148150
return V_6_0_0_alpha2;
149151
case V_6_0_0_alpha1_ID:
150152
return V_6_0_0_alpha1;
153+
case V_5_6_5_ID:
154+
return V_5_6_5;
151155
case V_5_6_4_ID:
152156
return V_5_6_4;
153157
case V_5_6_3_ID:

core/src/main/java/org/elasticsearch/action/ActionListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public interface ActionListener<Response> {
4545
* Creates a listener that listens for a response (or failure) and executes the
4646
* corresponding consumer when the response (or failure) is received.
4747
*
48-
* @param onResponse the consumer of the response, when the listener receives one
48+
* @param onResponse the checked consumer of the response, when the listener receives one
4949
* @param onFailure the consumer of the failure, when the listener receives one
5050
* @param <Response> the type of the response
5151
* @return a listener that listens for responses and invokes the consumer when received

core/src/main/java/org/elasticsearch/action/support/PlainListenableActionFuture.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class PlainListenableActionFuture<T> extends AdapterActionFuture<T, T> im
3333
volatile Object listeners;
3434
boolean executedListeners = false;
3535

36-
private PlainListenableActionFuture() {}
36+
protected PlainListenableActionFuture() {}
3737

3838
/**
3939
* This method returns a listenable future. The listeners will be called on completion of the future.

core/src/main/java/org/elasticsearch/common/blobstore/fs/FsBlobContainer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ public void move(String source, String target) throws IOException {
140140
Path targetPath = path.resolve(target);
141141
// If the target file exists then Files.move() behaviour is implementation specific
142142
// the existing file might be replaced or this method fails by throwing an IOException.
143-
assert !Files.exists(targetPath);
143+
if (Files.exists(targetPath)) {
144+
throw new FileAlreadyExistsException("blob [" + targetPath + "] already exists, cannot overwrite");
145+
}
144146
Files.move(sourcePath, targetPath, StandardCopyOption.ATOMIC_MOVE);
145147
IOUtils.fsync(path, true);
146148
}

core/src/main/java/org/elasticsearch/common/xcontent/ObjectParser.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public Value parse(XContentParser parser, Value value, Context context) throws I
147147
} else {
148148
token = parser.nextToken();
149149
if (token != XContentParser.Token.START_OBJECT) {
150-
throw new IllegalStateException("[" + name + "] Expected START_OBJECT but was: " + token);
150+
throw new ParsingException(parser.getTokenLocation(), "[" + name + "] Expected START_OBJECT but was: " + token);
151151
}
152152
}
153153

@@ -159,13 +159,13 @@ public Value parse(XContentParser parser, Value value, Context context) throws I
159159
fieldParser = getParser(currentFieldName);
160160
} else {
161161
if (currentFieldName == null) {
162-
throw new IllegalStateException("[" + name + "] no field found");
162+
throw new ParsingException(parser.getTokenLocation(), "[" + name + "] no field found");
163163
}
164164
if (fieldParser == null) {
165165
assert ignoreUnknownFields : "this should only be possible if configured to ignore known fields";
166166
parser.skipChildren(); // noop if parser points to a value, skips children if parser is start object or start array
167167
} else {
168-
fieldParser.assertSupports(name, token, currentFieldName);
168+
fieldParser.assertSupports(name, token, currentFieldName, parser.getTokenLocation());
169169
parseSub(parser, fieldParser, currentFieldName, value, context);
170170
}
171171
fieldParser = null;
@@ -330,7 +330,7 @@ private void parseSub(XContentParser parser, FieldParser fieldParser, String cur
330330
case END_OBJECT:
331331
case END_ARRAY:
332332
case FIELD_NAME:
333-
throw new IllegalStateException("[" + name + "]" + token + " is unexpected");
333+
throw new ParsingException(parser.getTokenLocation(), "[" + name + "]" + token + " is unexpected");
334334
case VALUE_STRING:
335335
case VALUE_NUMBER:
336336
case VALUE_BOOLEAN:
@@ -361,12 +361,12 @@ private class FieldParser {
361361
this.type = type;
362362
}
363363

364-
void assertSupports(String parserName, XContentParser.Token token, String currentFieldName) {
364+
void assertSupports(String parserName, XContentParser.Token token, String currentFieldName, XContentLocation location) {
365365
if (parseField.match(currentFieldName) == false) {
366-
throw new IllegalStateException("[" + parserName + "] parsefield doesn't accept: " + currentFieldName);
366+
throw new ParsingException(location, "[" + parserName + "] parsefield doesn't accept: " + currentFieldName);
367367
}
368368
if (supportedTokens.contains(token) == false) {
369-
throw new IllegalArgumentException(
369+
throw new ParsingException(location,
370370
"[" + parserName + "] " + currentFieldName + " doesn't support values of type: " + token);
371371
}
372372
}

core/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,6 @@ boolean processNextCommittedClusterState(String reason) {
735735

736736
final ClusterState newClusterState = pendingStatesQueue.getNextClusterStateToProcess();
737737
final ClusterState currentState = committedState.get();
738-
final ClusterState adaptedNewClusterState;
739738
// all pending states have been processed
740739
if (newClusterState == null) {
741740
return false;
@@ -773,54 +772,23 @@ boolean processNextCommittedClusterState(String reason) {
773772
if (currentState.blocks().hasGlobalBlock(discoverySettings.getNoMasterBlock())) {
774773
// its a fresh update from the master as we transition from a start of not having a master to having one
775774
logger.debug("got first state from fresh master [{}]", newClusterState.nodes().getMasterNodeId());
776-
adaptedNewClusterState = newClusterState;
777-
} else if (newClusterState.nodes().isLocalNodeElectedMaster() == false) {
778-
// some optimizations to make sure we keep old objects where possible
779-
ClusterState.Builder builder = ClusterState.builder(newClusterState);
780-
781-
// if the routing table did not change, use the original one
782-
if (newClusterState.routingTable().version() == currentState.routingTable().version()) {
783-
builder.routingTable(currentState.routingTable());
784-
}
785-
// same for metadata
786-
if (newClusterState.metaData().version() == currentState.metaData().version()) {
787-
builder.metaData(currentState.metaData());
788-
} else {
789-
// if its not the same version, only copy over new indices or ones that changed the version
790-
MetaData.Builder metaDataBuilder = MetaData.builder(newClusterState.metaData()).removeAllIndices();
791-
for (IndexMetaData indexMetaData : newClusterState.metaData()) {
792-
IndexMetaData currentIndexMetaData = currentState.metaData().index(indexMetaData.getIndex());
793-
if (currentIndexMetaData != null && currentIndexMetaData.isSameUUID(indexMetaData.getIndexUUID()) &&
794-
currentIndexMetaData.getVersion() == indexMetaData.getVersion()) {
795-
// safe to reuse
796-
metaDataBuilder.put(currentIndexMetaData, false);
797-
} else {
798-
metaDataBuilder.put(indexMetaData, false);
799-
}
800-
}
801-
builder.metaData(metaDataBuilder);
802-
}
803-
804-
adaptedNewClusterState = builder.build();
805-
} else {
806-
adaptedNewClusterState = newClusterState;
807775
}
808776

809-
if (currentState == adaptedNewClusterState) {
777+
if (currentState == newClusterState) {
810778
return false;
811779
}
812780

813-
committedState.set(adaptedNewClusterState);
781+
committedState.set(newClusterState);
814782

815783
// update failure detection only after the state has been updated to prevent race condition with handleLeaveRequest
816784
// and handleNodeFailure as those check the current state to determine whether the failure is to be handled by this node
817-
if (adaptedNewClusterState.nodes().isLocalNodeElectedMaster()) {
785+
if (newClusterState.nodes().isLocalNodeElectedMaster()) {
818786
// update the set of nodes to ping
819-
nodesFD.updateNodesAndPing(adaptedNewClusterState);
787+
nodesFD.updateNodesAndPing(newClusterState);
820788
} else {
821789
// check to see that we monitor the correct master of the cluster
822-
if (masterFD.masterNode() == null || !masterFD.masterNode().equals(adaptedNewClusterState.nodes().getMasterNode())) {
823-
masterFD.restart(adaptedNewClusterState.nodes().getMasterNode(),
790+
if (masterFD.masterNode() == null || !masterFD.masterNode().equals(newClusterState.nodes().getMasterNode())) {
791+
masterFD.restart(newClusterState.nodes().getMasterNode(),
824792
"new cluster state received and we are monitoring the wrong master [" + masterFD.masterNode() + "]");
825793
}
826794
}

core/src/main/java/org/elasticsearch/index/mapper/CompletionFieldMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
import org.apache.lucene.search.suggest.document.PrefixCompletionQuery;
3131
import org.apache.lucene.search.suggest.document.RegexCompletionQuery;
3232
import org.apache.lucene.search.suggest.document.SuggestField;
33-
import org.elasticsearch.ElasticsearchParseException;
3433
import org.elasticsearch.Version;
3534
import org.elasticsearch.common.ParseField;
35+
import org.elasticsearch.common.ParsingException;
3636
import org.elasticsearch.common.settings.Settings;
3737
import org.elasticsearch.common.unit.Fuzziness;
3838
import org.elasticsearch.common.util.set.Sets;
@@ -560,7 +560,7 @@ private void parse(ParseContext parseContext, Token token, XContentParser parser
560560
}
561561
}
562562
} else {
563-
throw new ElasticsearchParseException("failed to parse expected text or object got" + token.name());
563+
throw new ParsingException(parser.getTokenLocation(), "failed to parse [" + parser.currentName() + "]: expected text or object, but got " + token.name());
564564
}
565565
}
566566

core/src/main/java/org/elasticsearch/index/shard/IndexShard.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,12 @@ public void updateShardState(final ShardRouting newRouting,
471471
* subsequently fails before the primary/replica re-sync completes successfully and we are now being
472472
* promoted, the local checkpoint tracker here could be left in a state where it would re-issue sequence
473473
* numbers. To ensure that this is not the case, we restore the state of the local checkpoint tracker by
474-
* replaying the translog and marking any operations there are completed.
474+
* replaying the translog and marking any operations there are completed. Rolling the translog generation is
475+
* not strictly needed here (as we will never have collisions between sequence numbers in a translog
476+
* generation in a new primary as it takes the last known sequence number as a starting point), but it
477+
* simplifies reasoning about the relationship between primary terms and translog generations.
475478
*/
479+
getEngine().rollTranslogGeneration();
476480
getEngine().restoreLocalCheckpointFromTranslog();
477481
getEngine().fillSeqNoGaps(newPrimaryTerm);
478482
getEngine().seqNoService().updateLocalCheckpointForShard(currentRouting.allocationId().getId(),

0 commit comments

Comments
 (0)