Skip to content

Commit b7727c6

Browse files
committed
Merge branch '6.x' into ccr-6.x
* 6.x: Watcher: Ensure mail message ids are unique per watch action (#30112) SQL: Correct error message (#30138) SQL: Add BinaryMathProcessor to named writeables list (#30127) Tests: Use buildDir as base for generated-resources (#30191) Fix SliceBuilderTests#testRandom failures Fix edge cases in CompositeKeyExtractorTests (#30175) Document time unit limitations for date histograms (#30177) Remove licenses missed by the migration [DOCS] Updates docker installation package details (#30110) Fix TermsSetQueryBuilder.doEquals() method (#29629) [Monitoring] Remove unhelpful Monitoring tests (#30144) [Test] Fix RenameProcessorTests.testRenameExistingFieldNullValue() (#29655) [test] include oss tar in packaging tests (#30155) TEST: Update settings should go through cluster state (#29682) Add additional shards routing info in ShardSearchRequest (#29533) Reinstate missing documentation (#28781) Clarify documentation of scroll_id (#29424) Fixes Eclipse build for sql jdbc project (#30114) Watcher: Fold two smoke test projects into smoke-test-watcher (#30137)
2 parents 950ddc3 + 6fed2d4 commit b7727c6

File tree

83 files changed

+1098
-789
lines changed

Some content is hidden

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

83 files changed

+1098
-789
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,15 @@ class VagrantTestPlugin implements Plugin<Project> {
3737
'ubuntu-1404',
3838
]
3939

40-
/** All onboarded archives by default, available for Bats tests even if not used **/
41-
static List<String> DISTRIBUTION_ARCHIVES = ['tar', 'rpm', 'deb', 'oss-rpm', 'oss-deb']
40+
/** All distributions to bring into test VM, whether or not they are used **/
41+
static List<String> DISTRIBUTIONS = [
42+
'archives:tar',
43+
'archives:oss-tar',
44+
'packages:rpm',
45+
'packages:oss-rpm',
46+
'packages:deb',
47+
'packages:oss-deb'
48+
]
4249

4350
/** Packages onboarded for upgrade tests **/
4451
static List<String> UPGRADE_FROM_ARCHIVES = ['rpm', 'deb']
@@ -117,13 +124,8 @@ class VagrantTestPlugin implements Plugin<Project> {
117124
upgradeFromVersion = Version.fromString(upgradeFromVersionRaw)
118125
}
119126

120-
DISTRIBUTION_ARCHIVES.each {
127+
DISTRIBUTIONS.each {
121128
// Adds a dependency for the current version
122-
if (it == 'tar') {
123-
it = 'archives:tar'
124-
} else {
125-
it = "packages:${it}"
126-
}
127129
project.dependencies.add(PACKAGING_CONFIGURATION,
128130
project.dependencies.project(path: ":distribution:${it}", configuration: 'default'))
129131
}

buildSrc/src/main/resources/checkstyle_suppressions.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,6 @@
554554
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]ReplicaShardAllocatorTests.java" checks="LineLength" />
555555
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]ReusePeerRecoverySharedTest.java" checks="LineLength" />
556556
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]get[/\\]GetActionIT.java" checks="LineLength" />
557-
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]IndexServiceTests.java" checks="LineLength" />
558557
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]IndexingSlowLogTests.java" checks="LineLength" />
559558
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]MergePolicySettingsTests.java" checks="LineLength" />
560559
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]SearchSlowLogTests.java" checks="LineLength" />

docs/reference/aggregations/bucket/datehistogram-aggregation.asciidoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ POST /sales/_search?size=0
2727
// CONSOLE
2828
// TEST[setup:sales]
2929

30-
Available expressions for interval: `year`, `quarter`, `month`, `week`, `day`, `hour`, `minute`, `second`
30+
Available expressions for interval: `year` (`1y`), `quarter` (`1q`), `month` (`1M`), `week` (`1w`),
31+
`day` (`1d`), `hour` (`1h`), `minute` (`1m`), `second` (`1s`)
3132

3233
Time values can also be specified via abbreviations supported by <<time-units,time units>> parsing.
3334
Note that fractional time values are not supported, but you can address this by shifting to another
34-
time unit (e.g., `1.5h` could instead be specified as `90m`).
35+
time unit (e.g., `1.5h` could instead be specified as `90m`). Also note that time intervals larger than
36+
than days do not support arbitrary values but can only be one unit large (e.g. `1y` is valid, `2y` is not).
3537

3638
[source,js]
3739
--------------------------------------------------

docs/reference/docs/delete.asciidoc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ The result of the above delete operation is:
3939
[[delete-versioning]]
4040
=== Versioning
4141

42-
Each document indexed is versioned. When deleting a document, the
43-
`version` can be specified to make sure the relevant document we are
44-
trying to delete is actually being deleted and it has not changed in the
45-
meantime. Every write operation executed on a document, deletes included,
46-
causes its version to be incremented.
42+
Each document indexed is versioned. When deleting a document, the `version` can
43+
be specified to make sure the relevant document we are trying to delete is
44+
actually being deleted and it has not changed in the meantime. Every write
45+
operation executed on a document, deletes included, causes its version to be
46+
incremented. The version number of a deleted document remains available for a
47+
short time after deletion to allow for control of concurrent operations. The
48+
length of time for which a deleted document's version remains available is
49+
determined by the `index.gc_deletes` index setting and defaults to 60 seconds.
4750

4851
[float]
4952
[[delete-routing]]

docs/reference/index-modules.asciidoc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,27 @@ specific index module:
193193
The maximum number of terms that can be used in Terms Query.
194194
Defaults to `65536`.
195195

196+
`index.routing.allocation.enable`::
197+
198+
Controls shard allocation for this index. It can be set to:
199+
* `all` (default) - Allows shard allocation for all shards.
200+
* `primaries` - Allows shard allocation only for primary shards.
201+
* `new_primaries` - Allows shard allocation only for newly-created primary shards.
202+
* `none` - No shard allocation is allowed.
203+
204+
`index.routing.rebalance.enable`::
205+
206+
Enables shard rebalancing for this index. It can be set to:
207+
* `all` (default) - Allows shard rebalancing for all shards.
208+
* `primaries` - Allows shard rebalancing only for primary shards.
209+
* `replicas` - Allows shard rebalancing only for replica shards.
210+
* `none` - No shard rebalancing is allowed.
211+
212+
`index.gc_deletes`::
213+
214+
The length of time that a <<delete-versioning,deleted document's version number>> remains available for <<index-versioning,further versioned operations>>.
215+
Defaults to `60s`.
216+
196217
[float]
197218
=== Settings in other index modules
198219

docs/reference/search/request/scroll.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ returned with each batch of results. Each call to the `scroll` API returns the
7878
next batch of results until there are no more results left to return, ie the
7979
`hits` array is empty.
8080

81-
IMPORTANT: The initial search request and each subsequent scroll request
82-
returns a new `_scroll_id` -- only the most recent `_scroll_id` should be
83-
used.
81+
IMPORTANT: The initial search request and each subsequent scroll request each
82+
return a `_scroll_id`, which may change with each request -- only the most
83+
recent `_scroll_id` should be used.
8484

8585
NOTE: If the request specifies aggregations, only the initial search response
8686
will contain the aggregations results.

modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RenameProcessorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public void testRenameExistingFieldNullValue() throws Exception {
128128
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
129129
String fieldName = RandomDocumentPicks.randomFieldName(random());
130130
ingestDocument.setFieldValue(fieldName, null);
131-
String newFieldName = RandomDocumentPicks.randomFieldName(random());
131+
String newFieldName = randomValueOtherThanMany(ingestDocument::hasField, () -> RandomDocumentPicks.randomFieldName(random()));
132132
Processor processor = new RenameProcessor(randomAlphaOfLength(10), fieldName, newFieldName, false);
133133
processor.execute(ingestDocument);
134134
assertThat(ingestDocument.hasField(fieldName), equalTo(false));

qa/vagrant/src/test/resources/packaging/tests/20_tar_package.bats

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ setup() {
5555
}
5656

5757
@test "[TAR] archive is available" {
58-
count=$(find . -type f -name 'elasticsearch*.tar.gz' | wc -l)
58+
local version=$(cat version)
59+
count=$(find . -type f -name "${PACKAGE_NAME}-${version}.tar.gz" | wc -l)
5960
[ "$count" -eq 1 ]
6061
}
6162

qa/vagrant/src/test/resources/packaging/utils/tar.bash

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@
3535
install_archive() {
3636
export ESHOME=${1:-/tmp/elasticsearch}
3737

38+
local version=$(cat version)
39+
3840
echo "Unpacking tarball to $ESHOME"
3941
rm -rf /tmp/untar
4042
mkdir -p /tmp/untar
41-
tar -xzpf elasticsearch*.tar.gz -C /tmp/untar
43+
tar -xzpf "${PACKAGE_NAME}-${version}.tar.gz" -C /tmp/untar
4244

4345
find /tmp/untar -depth -type d -name 'elasticsearch*' -exec mv {} "$ESHOME" \; > /dev/null
4446

@@ -79,6 +81,8 @@ export_elasticsearch_paths() {
7981
export ESSCRIPTS="$ESCONFIG/scripts"
8082
export ESDATA="$ESHOME/data"
8183
export ESLOG="$ESHOME/logs"
84+
85+
export PACKAGE_NAME=${PACKAGE_NAME:-"elasticsearch-oss"}
8286
}
8387

8488
# Checks that all directories & files are correctly installed

server/src/main/java/org/elasticsearch/action/search/AbstractSearchAsyncAction.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@
3737
import org.elasticsearch.search.internal.ShardSearchTransportRequest;
3838
import org.elasticsearch.transport.Transport;
3939

40+
import java.util.Collections;
4041
import java.util.List;
4142
import java.util.Map;
43+
import java.util.Set;
4244
import java.util.concurrent.Executor;
4345
import java.util.concurrent.TimeUnit;
4446
import java.util.concurrent.atomic.AtomicInteger;
@@ -62,6 +64,7 @@ abstract class AbstractSearchAsyncAction<Result extends SearchPhaseResult> exten
6264
private final long clusterStateVersion;
6365
private final Map<String, AliasFilter> aliasFilter;
6466
private final Map<String, Float> concreteIndexBoosts;
67+
private final Map<String, Set<String>> indexRoutings;
6568
private final SetOnce<AtomicArray<ShardSearchFailure>> shardFailures = new SetOnce<>();
6669
private final Object shardFailuresMutex = new Object();
6770
private final AtomicInteger successfulOps = new AtomicInteger();
@@ -72,6 +75,7 @@ abstract class AbstractSearchAsyncAction<Result extends SearchPhaseResult> exten
7275
protected AbstractSearchAsyncAction(String name, Logger logger, SearchTransportService searchTransportService,
7376
BiFunction<String, String, Transport.Connection> nodeIdToConnection,
7477
Map<String, AliasFilter> aliasFilter, Map<String, Float> concreteIndexBoosts,
78+
Map<String, Set<String>> indexRoutings,
7579
Executor executor, SearchRequest request,
7680
ActionListener<SearchResponse> listener, GroupShardsIterator<SearchShardIterator> shardsIts,
7781
TransportSearchAction.SearchTimeProvider timeProvider, long clusterStateVersion,
@@ -89,6 +93,7 @@ protected AbstractSearchAsyncAction(String name, Logger logger, SearchTransportS
8993
this.clusterStateVersion = clusterStateVersion;
9094
this.concreteIndexBoosts = concreteIndexBoosts;
9195
this.aliasFilter = aliasFilter;
96+
this.indexRoutings = indexRoutings;
9297
this.results = resultConsumer;
9398
this.clusters = clusters;
9499
}
@@ -128,17 +133,17 @@ public final void executeNextPhase(SearchPhase currentPhase, SearchPhase nextPha
128133
onPhaseFailure(currentPhase, "all shards failed", cause);
129134
} else {
130135
Boolean allowPartialResults = request.allowPartialSearchResults();
131-
assert allowPartialResults != null : "SearchRequest missing setting for allowPartialSearchResults";
136+
assert allowPartialResults != null : "SearchRequest missing setting for allowPartialSearchResults";
132137
if (allowPartialResults == false && shardFailures.get() != null ){
133138
if (logger.isDebugEnabled()) {
134139
final ShardOperationFailedException[] shardSearchFailures = ExceptionsHelper.groupBy(buildShardFailures());
135140
Throwable cause = shardSearchFailures.length == 0 ? null :
136141
ElasticsearchException.guessRootCauses(shardSearchFailures[0].getCause())[0];
137-
logger.debug(() -> new ParameterizedMessage("{} shards failed for phase: [{}]",
142+
logger.debug(() -> new ParameterizedMessage("{} shards failed for phase: [{}]",
138143
shardSearchFailures.length, getName()), cause);
139144
}
140-
onPhaseFailure(currentPhase, "Partial shards failure", null);
141-
} else {
145+
onPhaseFailure(currentPhase, "Partial shards failure", null);
146+
} else {
142147
if (logger.isTraceEnabled()) {
143148
final String resultsFrom = results.getSuccessfulResults()
144149
.map(r -> r.getSearchShardTarget().toString()).collect(Collectors.joining(","));
@@ -271,14 +276,14 @@ public final SearchRequest getRequest() {
271276

272277
@Override
273278
public final SearchResponse buildSearchResponse(InternalSearchResponse internalSearchResponse, String scrollId) {
274-
279+
275280
ShardSearchFailure[] failures = buildShardFailures();
276281
Boolean allowPartialResults = request.allowPartialSearchResults();
277282
assert allowPartialResults != null : "SearchRequest missing setting for allowPartialSearchResults";
278283
if (allowPartialResults == false && failures.length > 0){
279-
raisePhaseFailure(new SearchPhaseExecutionException("", "Shard failures", null, failures));
280-
}
281-
284+
raisePhaseFailure(new SearchPhaseExecutionException("", "Shard failures", null, failures));
285+
}
286+
282287
return new SearchResponse(internalSearchResponse, scrollId, getNumShards(), successfulOps.get(),
283288
skippedOps.get(), buildTookInMillis(), failures, clusters);
284289
}
@@ -318,8 +323,11 @@ public final ShardSearchTransportRequest buildShardSearchRequest(SearchShardIter
318323
AliasFilter filter = aliasFilter.get(shardIt.shardId().getIndex().getUUID());
319324
assert filter != null;
320325
float indexBoost = concreteIndexBoosts.getOrDefault(shardIt.shardId().getIndex().getUUID(), DEFAULT_INDEX_BOOST);
326+
String indexName = shardIt.shardId().getIndex().getName();
327+
final String[] routings = indexRoutings.getOrDefault(indexName, Collections.emptySet())
328+
.toArray(new String[0]);
321329
return new ShardSearchTransportRequest(shardIt.getOriginalIndices(), request, shardIt.shardId(), getNumShards(),
322-
filter, indexBoost, timeProvider.getAbsoluteStartMillis(), clusterAlias);
330+
filter, indexBoost, timeProvider.getAbsoluteStartMillis(), clusterAlias, routings);
323331
}
324332

325333
/**

server/src/main/java/org/elasticsearch/action/search/CanMatchPreFilterSearchPhase.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.elasticsearch.transport.Transport;
2828

2929
import java.util.Map;
30+
import java.util.Set;
3031
import java.util.concurrent.Executor;
3132
import java.util.function.BiFunction;
3233
import java.util.function.Function;
@@ -47,6 +48,7 @@ final class CanMatchPreFilterSearchPhase extends AbstractSearchAsyncAction<Searc
4748
CanMatchPreFilterSearchPhase(Logger logger, SearchTransportService searchTransportService,
4849
BiFunction<String, String, Transport.Connection> nodeIdToConnection,
4950
Map<String, AliasFilter> aliasFilter, Map<String, Float> concreteIndexBoosts,
51+
Map<String, Set<String>> indexRoutings,
5052
Executor executor, SearchRequest request,
5153
ActionListener<SearchResponse> listener, GroupShardsIterator<SearchShardIterator> shardsIts,
5254
TransportSearchAction.SearchTimeProvider timeProvider, long clusterStateVersion,
@@ -56,9 +58,9 @@ final class CanMatchPreFilterSearchPhase extends AbstractSearchAsyncAction<Searc
5658
* We set max concurrent shard requests to the number of shards to otherwise avoid deep recursing that would occur if the local node
5759
* is the coordinating node for the query, holds all the shards for the request, and there are a lot of shards.
5860
*/
59-
super("can_match", logger, searchTransportService, nodeIdToConnection, aliasFilter, concreteIndexBoosts, executor, request,
60-
listener, shardsIts, timeProvider, clusterStateVersion, task, new BitSetSearchPhaseResults(shardsIts.size()), shardsIts.size(),
61-
clusters);
61+
super("can_match", logger, searchTransportService, nodeIdToConnection, aliasFilter, concreteIndexBoosts, indexRoutings,
62+
executor, request, listener, shardsIts, timeProvider, clusterStateVersion, task,
63+
new BitSetSearchPhaseResults(shardsIts.size()), shardsIts.size(), clusters);
6264
this.phaseFactory = phaseFactory;
6365
this.shardsIts = shardsIts;
6466
}

server/src/main/java/org/elasticsearch/action/search/InitialSearchPhase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public final void run() throws IOException {
131131
if (shardsIts.size() > 0) {
132132
int maxConcurrentShardRequests = Math.min(this.maxConcurrentShardRequests, shardsIts.size());
133133
final boolean success = shardExecutionIndex.compareAndSet(0, maxConcurrentShardRequests);
134-
assert success;
134+
assert success;
135135
assert request.allowPartialSearchResults() != null : "SearchRequest missing setting for allowPartialSearchResults";
136136
if (request.allowPartialSearchResults() == false) {
137137
final StringBuilder missingShards = new StringBuilder();
@@ -140,7 +140,7 @@ public final void run() throws IOException {
140140
final SearchShardIterator shardRoutings = shardsIts.get(index);
141141
if (shardRoutings.size() == 0) {
142142
if(missingShards.length() >0 ){
143-
missingShards.append(", ");
143+
missingShards.append(", ");
144144
}
145145
missingShards.append(shardRoutings.shardId());
146146
}

server/src/main/java/org/elasticsearch/action/search/SearchDfsQueryThenFetchAsyncAction.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.elasticsearch.transport.Transport;
2929

3030
import java.util.Map;
31+
import java.util.Set;
3132
import java.util.concurrent.Executor;
3233
import java.util.function.BiFunction;
3334

@@ -37,11 +38,13 @@ final class SearchDfsQueryThenFetchAsyncAction extends AbstractSearchAsyncAction
3738

3839
SearchDfsQueryThenFetchAsyncAction(final Logger logger, final SearchTransportService searchTransportService,
3940
final BiFunction<String, String, Transport.Connection> nodeIdToConnection, final Map<String, AliasFilter> aliasFilter,
40-
final Map<String, Float> concreteIndexBoosts, final SearchPhaseController searchPhaseController, final Executor executor,
41+
final Map<String, Float> concreteIndexBoosts, final Map<String, Set<String>> indexRoutings,
42+
final SearchPhaseController searchPhaseController, final Executor executor,
4143
final SearchRequest request, final ActionListener<SearchResponse> listener,
4244
final GroupShardsIterator<SearchShardIterator> shardsIts, final TransportSearchAction.SearchTimeProvider timeProvider,
4345
final long clusterStateVersion, final SearchTask task, SearchResponse.Clusters clusters) {
44-
super("dfs", logger, searchTransportService, nodeIdToConnection, aliasFilter, concreteIndexBoosts, executor, request, listener,
46+
super("dfs", logger, searchTransportService, nodeIdToConnection, aliasFilter, concreteIndexBoosts, indexRoutings,
47+
executor, request, listener,
4548
shardsIts, timeProvider, clusterStateVersion, task, new ArraySearchPhaseResults<>(shardsIts.size()),
4649
request.getMaxConcurrentShardRequests(), clusters);
4750
this.searchPhaseController = searchPhaseController;

0 commit comments

Comments
 (0)