Skip to content

Commit 0f6f3b8

Browse files
committed
Merge branch 'master' into seqno-set
2 parents 0b96f39 + 1f89e9d commit 0f6f3b8

File tree

215 files changed

+2221
-774
lines changed

Some content is hidden

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

215 files changed

+2221
-774
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ class BuildPlugin implements Plugin<Project> {
131131
throw new GradleException("${minGradle} or above is required to build elasticsearch")
132132
}
133133

134-
final GradleVersion gradle42 = GradleVersion.version('4.2')
135-
final GradleVersion gradle43 = GradleVersion.version('4.3')
136-
if (currentGradleVersion >= gradle42 && currentGradleVersion < gradle43) {
137-
throw new GradleException("${currentGradleVersion} is not compatible with the elasticsearch build")
138-
}
139-
140134
// enforce Java version
141135
if (javaVersionEnum < minimumJava) {
142136
throw new GradleException("Java ${minimumJava} or above is required to build Elasticsearch")

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public class AntFixture extends AntTask implements Fixture {
6969
* as well as a groovy AntBuilder, to enable running ant condition checks. The default wait
7070
* condition is for http on the http port.
7171
*/
72-
@Input
7372
Closure waitCondition = { AntFixture fixture, AntBuilder ant ->
7473
File tmpFile = new File(fixture.cwd, 'wait.success')
7574
ant.get(src: "http://${fixture.addressAndPort}",

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,13 @@ class ClusterFormationTasks {
166166
Task setup = project.tasks.create(name: taskName(prefix, node, 'clean'), type: Delete, dependsOn: dependsOn) {
167167
delete node.homeDir
168168
delete node.cwd
169+
}
170+
setup = project.tasks.create(name: taskName(prefix, node, 'createCwd'), type: DefaultTask, dependsOn: setup) {
169171
doLast {
170172
node.cwd.mkdirs()
171173
}
174+
outputs.dir node.cwd
172175
}
173-
174176
setup = configureCheckPreviousTask(taskName(prefix, node, 'checkPrevious'), project, setup, node)
175177
setup = configureStopTask(taskName(prefix, node, 'stopPrevious'), project, setup, node)
176178
setup = configureExtractTask(taskName(prefix, node, 'extract'), project, setup, node, distribution)
@@ -281,6 +283,7 @@ class ClusterFormationTasks {
281283
rpmDatabase.deleteDir()
282284
rpmExtracted.deleteDir()
283285
}
286+
outputs.dir rpmExtracted
284287
}
285288
break;
286289
case 'deb':
@@ -292,6 +295,7 @@ class ClusterFormationTasks {
292295
doFirst {
293296
debExtracted.deleteDir()
294297
}
298+
outputs.dir debExtracted
295299
}
296300
break;
297301
default:

buildSrc/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
elasticsearch = 7.0.0-alpha1
2-
lucene = 7.1.0
2+
lucene = 7.2.0-snapshot-8c94404
33

44
# optional dependencies
55
spatial4j = 0.6

core/licenses/lucene-analyzers-common-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4c515e5152e6938129a5e97c5afb5b3b360faed3

core/licenses/lucene-backward-codecs-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
406c6cc0f8c2a47d42a1e343eaf2ad939fee905c

core/licenses/lucene-core-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4c93f7fbc6e0caf87f7948b8481d80e0167133bf

core/licenses/lucene-grouping-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
b078ca50c6d579085c7755b4fd8de60711964dcc

core/licenses/lucene-highlighter-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fc5e61c8879f22b65ee053f1665bc9f13af79c1d

core/licenses/lucene-join-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9a10839d3dfe7b369f0af8a78a630ee4d82e678e

core/licenses/lucene-memory-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d45f2f51cf6f47a66ecafddecb83c1e08eb4061f

core/licenses/lucene-misc-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
19cb7362be57104ad891259060af80fb4679e92c

core/licenses/lucene-queries-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ae24737048d95f56d0099fea77498324412eef50

core/licenses/lucene-queryparser-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a9d3422c9a72106026c19a8f76a4f4e62159ff5c

core/licenses/lucene-sandbox-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
66433006587ede3e01899fd6f5e55c8378032c2f

core/licenses/lucene-spatial-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
b6b3082ba845f7bd41641b015624f46d4f20afb6

core/licenses/lucene-spatial-extras-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7757cac49cb3e9f1a219346ce95fb80f61f7090e

core/licenses/lucene-spatial3d-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
92991fdcd185883050d9530ccc0d863b7a08e99c

core/licenses/lucene-suggest-7.1.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fb6a94b833a23a17e3721ea2f9679ad770dec48b

core/src/main/java/org/apache/lucene/queries/MinDocQuery.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ public Scorer scorer(LeafReaderContext context) throws IOException {
9393
final DocIdSetIterator disi = new MinDocIterator(segmentMinDoc, maxDoc);
9494
return new ConstantScoreScorer(this, score(), disi);
9595
}
96+
97+
@Override
98+
public boolean isCacheable(LeafReaderContext ctx) {
99+
// Let's not cache this query, the cached iterator would use more memory
100+
// and be slower anyway.
101+
// Also, matches in a given segment depend on the other segments, which
102+
// makes it a bad candidate for per-segment caching.
103+
return false;
104+
}
96105
};
97106
}
98107

core/src/main/java/org/apache/lucene/queries/SearchAfterSortedDocQuery.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
import org.apache.lucene.search.Weight;
3636

3737
import java.io.IOException;
38-
import java.util.ArrayList;
3938
import java.util.Arrays;
40-
import java.util.List;
4139
import java.util.Objects;
4240

4341
/**
@@ -90,6 +88,14 @@ public Scorer scorer(LeafReaderContext context) throws IOException {
9088
final DocIdSetIterator disi = new MinDocQuery.MinDocIterator(firstDoc, maxDoc);
9189
return new ConstantScoreScorer(this, score(), disi);
9290
}
91+
92+
@Override
93+
public boolean isCacheable(LeafReaderContext ctx) {
94+
// If the sort order includes _doc, then the matches in a segment
95+
// may depend on other segments, which makes this query a bad
96+
// candidate for caching
97+
return false;
98+
}
9399
};
94100
}
95101

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public class Version implements Comparable<Version> {
137137
public static final Version V_6_2_0 = new Version(V_6_2_0_ID, org.apache.lucene.util.Version.LUCENE_7_1_0);
138138
public static final int V_7_0_0_alpha1_ID = 7000001;
139139
public static final Version V_7_0_0_alpha1 =
140-
new Version(V_7_0_0_alpha1_ID, org.apache.lucene.util.Version.LUCENE_7_1_0);
140+
new Version(V_7_0_0_alpha1_ID, org.apache.lucene.util.Version.LUCENE_7_2_0);
141141
public static final Version CURRENT = V_7_0_0_alpha1;
142142

143143
static {

core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotStatus.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919

2020
package org.elasticsearch.action.admin.cluster.snapshots.status;
2121

22+
import org.elasticsearch.Version;
2223
import org.elasticsearch.cluster.SnapshotsInProgress.State;
2324
import org.elasticsearch.common.Strings;
25+
import org.elasticsearch.common.inject.internal.Nullable;
2426
import org.elasticsearch.common.io.stream.StreamInput;
2527
import org.elasticsearch.common.io.stream.StreamOutput;
2628
import org.elasticsearch.common.io.stream.Streamable;
@@ -57,10 +59,15 @@ public class SnapshotStatus implements ToXContentObject, Streamable {
5759

5860
private SnapshotStats stats;
5961

60-
SnapshotStatus(final Snapshot snapshot, final State state, final List<SnapshotIndexShardStatus> shards) {
62+
@Nullable
63+
private Boolean includeGlobalState;
64+
65+
SnapshotStatus(final Snapshot snapshot, final State state, final List<SnapshotIndexShardStatus> shards,
66+
final Boolean includeGlobalState) {
6167
this.snapshot = Objects.requireNonNull(snapshot);
6268
this.state = Objects.requireNonNull(state);
6369
this.shards = Objects.requireNonNull(shards);
70+
this.includeGlobalState = includeGlobalState;
6471
shardsStats = new SnapshotShardsStats(shards);
6572
updateShardStats();
6673
}
@@ -82,6 +89,14 @@ public State getState() {
8289
return state;
8390
}
8491

92+
/**
93+
* Returns true if global state is included in the snapshot, false otherwise.
94+
* Can be null if this information is unknown.
95+
*/
96+
public Boolean includeGlobalState() {
97+
return includeGlobalState;
98+
}
99+
85100
/**
86101
* Returns list of snapshot shards
87102
*/
@@ -132,6 +147,9 @@ public void readFrom(StreamInput in) throws IOException {
132147
builder.add(SnapshotIndexShardStatus.readShardSnapshotStatus(in));
133148
}
134149
shards = Collections.unmodifiableList(builder);
150+
if (in.getVersion().onOrAfter(Version.V_6_2_0)) {
151+
includeGlobalState = in.readOptionalBoolean();
152+
}
135153
updateShardStats();
136154
}
137155

@@ -143,6 +161,9 @@ public void writeTo(StreamOutput out) throws IOException {
143161
for (SnapshotIndexShardStatus shard : shards) {
144162
shard.writeTo(out);
145163
}
164+
if (out.getVersion().onOrAfter(Version.V_6_2_0)) {
165+
out.writeOptionalBoolean(includeGlobalState);
166+
}
146167
}
147168

148169
/**
@@ -174,6 +195,7 @@ public SnapshotStats getStats() {
174195
private static final String UUID = "uuid";
175196
private static final String STATE = "state";
176197
private static final String INDICES = "indices";
198+
private static final String INCLUDE_GLOBAL_STATE = "include_global_state";
177199

178200
@Override
179201
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
@@ -182,6 +204,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
182204
builder.field(REPOSITORY, snapshot.getRepository());
183205
builder.field(UUID, snapshot.getSnapshotId().getUUID());
184206
builder.field(STATE, state.name());
207+
if (includeGlobalState != null) {
208+
builder.field(INCLUDE_GLOBAL_STATE, includeGlobalState);
209+
}
185210
shardsStats.toXContent(builder, params);
186211
stats.toXContent(builder, params);
187212
builder.startObject(INDICES);

core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ private SnapshotsStatusResponse buildResponse(SnapshotsStatusRequest request, Li
196196
SnapshotIndexShardStatus shardStatus = new SnapshotIndexShardStatus(shardEntry.key, stage);
197197
shardStatusBuilder.add(shardStatus);
198198
}
199-
builder.add(new SnapshotStatus(entry.snapshot(), entry.state(), Collections.unmodifiableList(shardStatusBuilder)));
199+
builder.add(new SnapshotStatus(entry.snapshot(), entry.state(),
200+
Collections.unmodifiableList(shardStatusBuilder), entry.includeGlobalState()));
200201
}
201202
}
202203
// Now add snapshots on disk that are not currently running
@@ -248,7 +249,8 @@ private SnapshotsStatusResponse buildResponse(SnapshotsStatusRequest request, Li
248249
default:
249250
throw new IllegalArgumentException("Unknown snapshot state " + snapshotInfo.state());
250251
}
251-
builder.add(new SnapshotStatus(new Snapshot(repositoryName, snapshotId), state, Collections.unmodifiableList(shardStatusBuilder)));
252+
builder.add(new SnapshotStatus(new Snapshot(repositoryName, snapshotId), state,
253+
Collections.unmodifiableList(shardStatusBuilder), snapshotInfo.includeGlobalState()));
252254
}
253255
}
254256
}

core/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
import org.elasticsearch.common.inject.Inject;
3434
import org.elasticsearch.common.lease.Releasables;
3535
import org.elasticsearch.common.settings.Settings;
36+
import org.elasticsearch.index.IndexService;
3637
import org.elasticsearch.index.engine.Engine;
3738
import org.elasticsearch.index.get.GetResult;
39+
import org.elasticsearch.index.shard.IndexShard;
3840
import org.elasticsearch.index.shard.ShardId;
3941
import org.elasticsearch.search.SearchService;
4042
import org.elasticsearch.search.internal.AliasFilter;
@@ -86,6 +88,19 @@ protected void resolveRequest(ClusterState state, InternalRequest request) {
8688
}
8789
}
8890

91+
@Override
92+
protected void asyncShardOperation(ExplainRequest request, ShardId shardId, ActionListener<ExplainResponse> listener) throws IOException {
93+
IndexService indexService = searchService.getIndicesService().indexServiceSafe(shardId.getIndex());
94+
IndexShard indexShard = indexService.getShard(shardId.id());
95+
indexShard.awaitShardSearchActive(b -> {
96+
try {
97+
super.asyncShardOperation(request, shardId, listener);
98+
} catch (Exception ex) {
99+
listener.onFailure(ex);
100+
}
101+
});
102+
}
103+
89104
@Override
90105
protected ExplainResponse shardOperation(ExplainRequest request, ShardId shardId) throws IOException {
91106
ShardSearchLocalRequest shardSearchLocalRequest = new ShardSearchLocalRequest(shardId,

core/src/main/java/org/elasticsearch/action/get/TransportGetAction.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919

2020
package org.elasticsearch.action.get;
2121

22+
import org.elasticsearch.action.ActionListener;
2223
import org.elasticsearch.action.RoutingMissingException;
2324
import org.elasticsearch.action.support.ActionFilters;
2425
import org.elasticsearch.action.support.single.shard.TransportSingleShardAction;
2526
import org.elasticsearch.cluster.ClusterState;
2627
import org.elasticsearch.cluster.metadata.IndexMetaData;
2728
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
28-
import org.elasticsearch.cluster.routing.Preference;
2929
import org.elasticsearch.cluster.routing.ShardIterator;
3030
import org.elasticsearch.cluster.service.ClusterService;
3131
import org.elasticsearch.common.inject.Inject;
@@ -38,6 +38,8 @@
3838
import org.elasticsearch.threadpool.ThreadPool;
3939
import org.elasticsearch.transport.TransportService;
4040

41+
import java.io.IOException;
42+
4143
/**
4244
* Performs the get operation.
4345
*/
@@ -76,6 +78,23 @@ protected void resolveRequest(ClusterState state, InternalRequest request) {
7678
}
7779
}
7880

81+
@Override
82+
protected void asyncShardOperation(GetRequest request, ShardId shardId, ActionListener<GetResponse> listener) throws IOException {
83+
IndexService indexService = indicesService.indexServiceSafe(shardId.getIndex());
84+
IndexShard indexShard = indexService.getShard(shardId.id());
85+
if (request.realtime()) { // we are not tied to a refresh cycle here anyway
86+
listener.onResponse(shardOperation(request, shardId));
87+
} else {
88+
indexShard.awaitShardSearchActive(b -> {
89+
try {
90+
super.asyncShardOperation(request, shardId, listener);
91+
} catch (Exception ex) {
92+
listener.onFailure(ex);
93+
}
94+
});
95+
}
96+
}
97+
7998
@Override
8099
protected GetResponse shardOperation(GetRequest request, ShardId shardId) {
81100
IndexService indexService = indicesService.indexServiceSafe(shardId.getIndex());

0 commit comments

Comments
 (0)