Skip to content

Commit afe02a3

Browse files
committed
Merge branch 'master' into ccr
* master: Move default location of dependencies report (#31228) Remove dependencies report task dependencies (#31227) Add recognition of MPL 2.0 (#31226) Fix unknown licenses (#31223) Remove version from license file name for GCS SDK (#31221) Fully encapsulate LocalCheckpointTracker inside of the engine (#31213) [DOCS] Added 'fail_on_unsupported_field' param to MLT. Closes #28008 (#31160) Add licenses for transport-nio (#31218) Remove DocumentFieldMappers#simpleMatchToFullName. (#31041) Allow to trim all ops above a certain seq# with a term lower than X, post backport fix (#31211) Compliant SAML Response destination check (#31175) Remove DocumentFieldMappers#smartNameFieldMapper, as it is no longer needed. (#31018) Remove extraneous references to 'tokenized' in the mapper code. (#31010) Allow to trim all ops above a certain seq# with a term lower than X (#30176) SQL: Make a single JDBC driver jar (#31012) Enhance license detection for various licenses (#31198) [DOCS] Add note about long-lived idle connections (#30990) Move number of language analyzers to analysis-common module (#31143) Default max concurrent search req. numNodes * 5 (#31171) flush job to ensure all results have been written (#31187)
2 parents 64b4cde + aa8aa0d commit afe02a3

File tree

116 files changed

+2355
-694
lines changed

Some content is hidden

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

116 files changed

+2355
-694
lines changed

build.gradle

+6-1
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ subprojects { project ->
543543
}
544544
}
545545

546-
/* Remove assemble on all qa projects because we don't need to publish
546+
/* Remove assemble/dependenciesInfo on all qa projects because we don't need to publish
547547
* artifacts for them. */
548548
gradle.projectsEvaluated {
549549
subprojects {
@@ -553,6 +553,11 @@ gradle.projectsEvaluated {
553553
project.tasks.remove(assemble)
554554
project.build.dependsOn.remove('assemble')
555555
}
556+
Task dependenciesInfo = project.tasks.findByName('dependenciesInfo')
557+
if (dependenciesInfo) {
558+
project.tasks.remove(dependenciesInfo)
559+
project.precommit.dependsOn.remove('dependenciesInfo')
560+
}
556561
}
557562
}
558563
}

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,10 @@ class BuildPlugin implements Plugin<Project> {
762762

763763
private static configureDependenciesInfo(Project project) {
764764
Task deps = project.tasks.create("dependenciesInfo", DependenciesInfoTask.class)
765-
deps.dependencies = project.configurations.compile.allDependencies
765+
deps.runtimeConfiguration = project.configurations.runtime
766+
deps.compileOnlyConfiguration = project.configurations.compileOnly
767+
project.afterEvaluate {
768+
deps.mappings = project.dependencyLicenses.mappings
769+
}
766770
}
767771
}

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

+122-11
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,19 @@
1919

2020
package org.elasticsearch.gradle
2121

22+
import org.elasticsearch.gradle.precommit.DependencyLicensesTask
2223
import org.gradle.api.DefaultTask
24+
import org.gradle.api.artifacts.Configuration
2325
import org.gradle.api.artifacts.Dependency
26+
import org.gradle.api.artifacts.DependencyResolutionListener
2427
import org.gradle.api.artifacts.DependencySet
2528
import org.gradle.api.tasks.Input
2629
import org.gradle.api.tasks.InputDirectory
2730
import org.gradle.api.tasks.OutputFile
2831
import org.gradle.api.tasks.TaskAction
2932

33+
import java.util.regex.Matcher
34+
import java.util.regex.Pattern
3035

3136
/**
3237
* A task to gather information about the dependencies and export them into a csv file.
@@ -44,7 +49,14 @@ public class DependenciesInfoTask extends DefaultTask {
4449

4550
/** Dependencies to gather information from. */
4651
@Input
47-
public DependencySet dependencies
52+
public Configuration runtimeConfiguration
53+
54+
/** We subtract compile-only dependencies. */
55+
@Input
56+
public Configuration compileOnlyConfiguration
57+
58+
@Input
59+
public LinkedHashMap<String, String> mappings
4860

4961
/** Directory to read license files */
5062
@InputDirectory
@@ -59,15 +71,34 @@ public class DependenciesInfoTask extends DefaultTask {
5971

6072
@TaskAction
6173
public void generateDependenciesInfo() {
74+
75+
final DependencySet runtimeDependencies = runtimeConfiguration.getAllDependencies()
76+
// we have to resolve the transitive dependencies and create a group:artifactId:version map
77+
final Set<String> compileOnlyArtifacts =
78+
compileOnlyConfiguration
79+
.getResolvedConfiguration()
80+
.resolvedArtifacts
81+
.collect { it -> "${it.moduleVersion.id.group}:${it.moduleVersion.id.name}:${it.moduleVersion.id.version}" }
82+
6283
final StringBuilder output = new StringBuilder()
6384

64-
for (Dependency dependency : dependencies) {
65-
// Only external dependencies are checked
66-
if (dependency.group != null && dependency.group.contains("elasticsearch") == false) {
67-
final String url = createURL(dependency.group, dependency.name, dependency.version)
68-
final String licenseType = getLicenseType(dependency.group, dependency.name)
69-
output.append("${dependency.group}:${dependency.name},${dependency.version},${url},${licenseType}\n")
85+
for (final Dependency dependency : runtimeDependencies) {
86+
// we do not need compile-only dependencies here
87+
if (compileOnlyArtifacts.contains("${dependency.group}:${dependency.name}:${dependency.version}")) {
88+
continue
7089
}
90+
// only external dependencies are checked
91+
if (dependency.group != null && dependency.group.contains("org.elasticsearch")) {
92+
continue
93+
}
94+
95+
final String url = createURL(dependency.group, dependency.name, dependency.version)
96+
final String dependencyName = DependencyLicensesTask.getDependencyName(mappings, dependency.name)
97+
logger.info("mapped dependency ${dependency.group}:${dependency.name} to ${dependencyName} for license info")
98+
99+
final String licenseType = getLicenseType(dependency.group, dependencyName)
100+
output.append("${dependency.group}:${dependency.name},${dependency.version},${url},${licenseType}\n")
101+
71102
}
72103
outputFile.setText(output.toString(), 'UTF-8')
73104
}
@@ -109,7 +140,8 @@ public class DependenciesInfoTask extends DefaultTask {
109140
}
110141

111142
if (license) {
112-
final String content = license.readLines("UTF-8").toString()
143+
// replace * because they are sometimes used at the beginning lines as if the license was a multi-line comment
144+
final String content = new String(license.readBytes(), "UTF-8").replaceAll("\\s+", " ").replaceAll("\\*", " ")
113145
final String spdx = checkSPDXLicense(content)
114146
if (spdx == null) {
115147
// License has not be identified as SPDX.
@@ -133,15 +165,88 @@ public class DependenciesInfoTask extends DefaultTask {
133165
private String checkSPDXLicense(final String licenseText) {
134166
String spdx = null
135167

136-
final String APACHE_2_0 = "Apache.*License.*(v|V)ersion 2.0"
137-
final String BSD_2 = "BSD 2-clause.*License"
168+
final String APACHE_2_0 = "Apache.*License.*(v|V)ersion.*2\\.0"
169+
170+
final String BSD_2 = """
171+
Redistribution and use in source and binary forms, with or without
172+
modification, are permitted provided that the following conditions
173+
are met:
174+
175+
1\\. Redistributions of source code must retain the above copyright
176+
notice, this list of conditions and the following disclaimer\\.
177+
2\\. Redistributions in binary form must reproduce the above copyright
178+
notice, this list of conditions and the following disclaimer in the
179+
documentation and/or other materials provided with the distribution\\.
180+
181+
THIS SOFTWARE IS PROVIDED BY .+ (``|''|")AS IS(''|") AND ANY EXPRESS OR
182+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
183+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED\\.
184+
IN NO EVENT SHALL .+ BE LIABLE FOR ANY DIRECT, INDIRECT,
185+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \\(INCLUDING, BUT
186+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
187+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION\\) HOWEVER CAUSED AND ON ANY
188+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
189+
\\(INCLUDING NEGLIGENCE OR OTHERWISE\\) ARISING IN ANY WAY OUT OF THE USE OF
190+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\\.
191+
""".replaceAll("\\s+", "\\\\s*")
192+
193+
final String BSD_3 = """
194+
Redistribution and use in source and binary forms, with or without
195+
modification, are permitted provided that the following conditions
196+
are met:
197+
198+
(1\\.)? Redistributions of source code must retain the above copyright
199+
notice, this list of conditions and the following disclaimer\\.
200+
(2\\.)? Redistributions in binary form must reproduce the above copyright
201+
notice, this list of conditions and the following disclaimer in the
202+
documentation and/or other materials provided with the distribution\\.
203+
((3\\.)? The name of .+ may not be used to endorse or promote products
204+
derived from this software without specific prior written permission\\.|
205+
(3\\.)? Neither the name of .+ nor the names of its
206+
contributors may be used to endorse or promote products derived from
207+
this software without specific prior written permission\\.)
208+
209+
THIS SOFTWARE IS PROVIDED BY .+ (``|''|")AS IS(''|") AND ANY EXPRESS OR
210+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
211+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED\\.
212+
IN NO EVENT SHALL .+ BE LIABLE FOR ANY DIRECT, INDIRECT,
213+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \\(INCLUDING, BUT
214+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
215+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION\\) HOWEVER CAUSED AND ON ANY
216+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
217+
\\(INCLUDING NEGLIGENCE OR OTHERWISE\\) ARISING IN ANY WAY OUT OF THE USE OF
218+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\\.
219+
""".replaceAll("\\s+", "\\\\s*")
220+
138221
final String CDDL_1_0 = "COMMON DEVELOPMENT AND DISTRIBUTION LICENSE.*Version 1.0"
139222
final String CDDL_1_1 = "COMMON DEVELOPMENT AND DISTRIBUTION LICENSE.*Version 1.1"
140223
final String ICU = "ICU License - ICU 1.8.1 and later"
141224
final String LGPL_3 = "GNU LESSER GENERAL PUBLIC LICENSE.*Version 3"
142-
final String MIT = "MIT License"
225+
226+
final String MIT = """
227+
Permission is hereby granted, free of charge, to any person obtaining a copy of
228+
this software and associated documentation files \\(the "Software"\\), to deal in
229+
the Software without restriction, including without limitation the rights to
230+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
231+
of the Software, and to permit persons to whom the Software is furnished to do
232+
so, subject to the following conditions:
233+
234+
The above copyright notice and this permission notice shall be included in all
235+
copies or substantial portions of the Software\\.
236+
237+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
238+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
239+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\\. IN NO EVENT SHALL THE
240+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
241+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
242+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
243+
SOFTWARE\\.
244+
""".replaceAll("\\s+", "\\\\s*")
245+
143246
final String MOZILLA_1_1 = "Mozilla Public License.*Version 1.1"
144247

248+
final String MOZILLA_2_0 = "Mozilla\\s*Public\\s*License\\s*Version\\s*2\\.0"
249+
145250
switch (licenseText) {
146251
case ~/.*${APACHE_2_0}.*/:
147252
spdx = 'Apache-2.0'
@@ -152,6 +257,9 @@ public class DependenciesInfoTask extends DefaultTask {
152257
case ~/.*${BSD_2}.*/:
153258
spdx = 'BSD-2-Clause'
154259
break
260+
case ~/.*${BSD_3}.*/:
261+
spdx = 'BSD-3-Clause'
262+
break
155263
case ~/.*${LGPL_3}.*/:
156264
spdx = 'LGPL-3.0'
157265
break
@@ -167,6 +275,9 @@ public class DependenciesInfoTask extends DefaultTask {
167275
case ~/.*${MOZILLA_1_1}.*/:
168276
spdx = 'MPL-1.1'
169277
break
278+
case ~/.*${MOZILLA_2_0}.*/:
279+
spdx = 'MPL-2.0'
280+
break
170281
default:
171282
break
172283
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/DependencyLicensesTask.groovy

+22-15
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ public class DependencyLicensesTask extends DefaultTask {
109109
mappings.put(from, to)
110110
}
111111

112+
public LinkedHashMap<String, String> getMappings() {
113+
return new LinkedHashMap<>(mappings)
114+
}
115+
112116
/**
113117
* Add a rule which will skip SHA checking for the given dependency name. This should be used for
114118
* locally build dependencies, which cause the sha to change constantly.
@@ -129,10 +133,6 @@ public class DependencyLicensesTask extends DefaultTask {
129133
throw new GradleException("Licences dir ${licensesDir} does not exist, but there are dependencies")
130134
}
131135

132-
133-
// order is the same for keys and values iteration since we use a linked hashmap
134-
List<String> mapped = new ArrayList<>(mappings.values())
135-
Pattern mappingsPattern = Pattern.compile('(' + mappings.keySet().join(')|(') + ')')
136136
Map<String, Integer> licenses = new HashMap<>()
137137
Map<String, Integer> notices = new HashMap<>()
138138
Set<File> shaFiles = new HashSet<File>()
@@ -151,7 +151,7 @@ public class DependencyLicensesTask extends DefaultTask {
151151

152152
for (File dependency : dependencies) {
153153
String jarName = dependency.getName()
154-
String depName = jarName - ~/\-\d+.*/
154+
String depName = jarName - ~/\-v?\d+.*/
155155
if (ignoreShas.contains(depName)) {
156156
// local deps should not have sha files!
157157
if (getShaFile(jarName).exists()) {
@@ -162,16 +162,10 @@ public class DependencyLicensesTask extends DefaultTask {
162162
checkSha(dependency, jarName, shaFiles)
163163
}
164164

165-
logger.info("Checking license/notice for " + depName)
166-
Matcher match = mappingsPattern.matcher(depName)
167-
if (match.matches()) {
168-
int i = 0
169-
while (i < match.groupCount() && match.group(i + 1) == null) ++i;
170-
logger.info("Mapped dependency name ${depName} to ${mapped.get(i)} for license check")
171-
depName = mapped.get(i)
172-
}
173-
checkFile(depName, jarName, licenses, 'LICENSE')
174-
checkFile(depName, jarName, notices, 'NOTICE')
165+
final String dependencyName = getDependencyName(mappings, depName)
166+
logger.info("mapped dependency name ${depName} to ${dependencyName} for license/notice check")
167+
checkFile(dependencyName, jarName, licenses, 'LICENSE')
168+
checkFile(dependencyName, jarName, notices, 'NOTICE')
175169
}
176170

177171
licenses.each { license, count ->
@@ -189,6 +183,19 @@ public class DependencyLicensesTask extends DefaultTask {
189183
}
190184
}
191185

186+
public static String getDependencyName(final LinkedHashMap<String, String> mappings, final String dependencyName) {
187+
// order is the same for keys and values iteration since we use a linked hashmap
188+
List<String> mapped = new ArrayList<>(mappings.values())
189+
Pattern mappingsPattern = Pattern.compile('(' + mappings.keySet().join(')|(') + ')')
190+
Matcher match = mappingsPattern.matcher(dependencyName)
191+
if (match.matches()) {
192+
int i = 0
193+
while (i < match.groupCount() && match.group(i + 1) == null) ++i;
194+
return mapped.get(i)
195+
}
196+
return dependencyName
197+
}
198+
192199
private File getShaFile(String jarName) {
193200
return new File(licensesDir, jarName + SHA_EXTENSION)
194201
}

client/client-benchmark-noop-api-plugin/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ esplugin {
3131
tasks.remove(assemble)
3232
build.dependsOn.remove('assemble')
3333

34+
dependencyLicenses.enabled = false
35+
dependenciesInfo.enabled = false
36+
3437
compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
3538

3639
// no unit tests

distribution/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Collection distributions = project('archives').subprojects + project('packages')
3434
task generateDependenciesReport(type: ConcatFilesTask) {
3535
files = fileTree(dir: project.rootDir, include: '**/dependencies.csv' )
3636
headerLine = "name,version,url,license"
37-
target = new File(System.getProperty('csv')?: "${project.buildDir}/dependencies/es-dependencies.csv")
37+
target = new File(System.getProperty('csv')?: "${project.buildDir}/reports/dependencies/es-dependencies.csv")
3838
}
3939

4040
/*****************************************************************************

docs/reference/modules/transport.asciidoc

+20-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ time setting format). Defaults to `30s`.
4444
|`transport.tcp.compress` |Set to `true` to enable compression (`DEFLATE`)
4545
between all nodes. Defaults to `false`.
4646

47-
|`transport.ping_schedule` | Schedule a regular ping message to ensure that connections are kept alive. Defaults to `5s` in the transport client and `-1` (disabled) elsewhere.
47+
|`transport.ping_schedule` | Schedule a regular application-level ping message
48+
to ensure that transport connections between nodes are kept alive. Defaults to
49+
`5s` in the transport client and `-1` (disabled) elsewhere. It is preferable to
50+
correctly configure TCP keep-alives instead of using this feature, because TCP
51+
keep-alives apply to all kinds of long-lived connection and not just to
52+
transport connections.
4853

4954
|=======================================================================
5055

@@ -80,6 +85,20 @@ The following parameters can be configured like that
8085
* `tcp_send_buffer_size`: Configures the send buffer size of the socket
8186
* `tcp_receive_buffer_size`: Configures the receive buffer size of the socket
8287

88+
[float]
89+
==== Long-lived idle connections
90+
91+
Elasticsearch opens a number of long-lived TCP connections between each pair of
92+
nodes in the cluster, and some of these connections may be idle for an extended
93+
period of time. Nonetheless, Elasticsearch requires these connections to remain
94+
open, and it can disrupt the operation of the cluster if any inter-node
95+
connections are closed by an external influence such as a firewall. It is
96+
important to configure your network to preserve long-lived idle connections
97+
between Elasticsearch nodes, for instance by leaving `tcp_keep_alive` enabled
98+
and ensuring that the keepalive interval is shorter than any timeout that might
99+
cause idle connections to be closed, or by setting `transport.ping_schedule` if
100+
keepalives cannot be configured.
101+
83102
[float]
84103
=== Transport Tracer
85104

docs/reference/query-dsl/mlt-query.asciidoc

+7
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,13 @@ number of terms that must match.
241241
The syntax is the same as the <<query-dsl-minimum-should-match,minimum should match>>.
242242
(Defaults to `"30%"`).
243243

244+
`fail_on_unsupported_field`::
245+
Controls whether the query should fail (throw an exception) if any of the
246+
specified fields are not of the supported types
247+
(`text` or `keyword'). Set this to `false` to ignore the field and continue
248+
processing. Defaults to
249+
`true`.
250+
244251
`boost_terms`::
245252
Each term in the formed query could be further boosted by their tf-idf score.
246253
This sets the boost factor to use when using this feature. Defaults to

server/src/main/java/org/elasticsearch/index/analysis/ArabicAnalyzerProvider.java renamed to modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/ArabicAnalyzerProvider.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@
1717
* under the License.
1818
*/
1919

20-
package org.elasticsearch.index.analysis;
20+
package org.elasticsearch.analysis.common;
2121

2222
import org.apache.lucene.analysis.CharArraySet;
2323
import org.apache.lucene.analysis.ar.ArabicAnalyzer;
2424
import org.elasticsearch.common.settings.Settings;
2525
import org.elasticsearch.env.Environment;
2626
import org.elasticsearch.index.IndexSettings;
27+
import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider;
28+
import org.elasticsearch.index.analysis.Analysis;
2729

2830
public class ArabicAnalyzerProvider extends AbstractIndexAnalyzerProvider<ArabicAnalyzer> {
2931

3032
private final ArabicAnalyzer arabicAnalyzer;
3133

32-
public ArabicAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) {
34+
ArabicAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) {
3335
super(indexSettings, name, settings);
3436
arabicAnalyzer = new ArabicAnalyzer(
3537
Analysis.parseStopWords(env, settings, ArabicAnalyzer.getDefaultStopSet()),

0 commit comments

Comments
 (0)