Skip to content

Commit 518f12e

Browse files
committed
Merge branch 'master' into translog-generation
* master: Fix typo in allocation explain API docs Add unit tests for ReverseNestedAggregator (elastic#23651) Revert "Revert "Build: Upgrade min gradle to 3.3 (elastic#23544)"" Revert "Build: Upgrade min gradle to 3.3 (elastic#23544)" Build: Upgrade min gradle to 3.3 (elastic#23544) Fix took assertion in response filter test Search took time should use a relative clock Adds toString() to snapshot operations in progress Docs: fix a typo in transport client's put-mapping.asciidoc (elastic#23607) Use include-tagged macro for high level client docs (elastic#23438) Update fill-column in .dir-locals.el to 100 characters Setup keystore during integration tests (elastic#22966) Fix typo 'Elastisearch' -> 'Elasticsearch' (elastic#23633) Comment and blank line cleanups (elastic#23647) docs: guidelines for students and teachers (elastic#23648) Fix MapperService StackOverflowError (elastic#23605)
2 parents 32afd9e + 09753d6 commit 518f12e

File tree

34 files changed

+692
-102
lines changed

34 files changed

+692
-102
lines changed

.dir-locals.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@
8383
))
8484
(c-basic-offset . 4)
8585
(c-comment-only-line-offset . (0 . 0))
86-
(fill-column . 140)
87-
(fci-rule-column . 140)
86+
(fill-column . 100)
87+
(fci-rule-column . 100)
8888
(compile-command . "gradle compileTestJava"))))

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ attention.
1111
- If submitting code, have you built your formula locally prior to submission with `gradle check`?
1212
- If submitting code, is your pull request against master? Unless there is a good reason otherwise, we prefer pull requests against master and will backport as needed.
1313
- If submitting code, have you checked that your submission is for an [OS that we support](https://www.elastic.co/support/matrix#show_os)?
14+
- If you are submitting this code for a class then read our [policy](https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md#contributing-as-part-of-a-class) for that.

CONTRIBUTING.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ Contributing to the Elasticsearch codebase
8888
**Repository:** [https://github.com/elastic/elasticsearch](https://github.com/elastic/elasticsearch)
8989

9090
Make sure you have [Gradle](http://gradle.org) installed, as
91-
Elasticsearch uses it as its build system. Gradle must be version 2.13 _exactly_ in
92-
order to build successfully.
91+
Elasticsearch uses it as its build system. Gradle must be at least
92+
version 3.3 in order to build successfully.
9393

9494
Eclipse users can automatically configure their IDE: `gradle eclipse`
9595
then `File: Import: Existing Projects into Workspace`. Select the
@@ -139,3 +139,32 @@ Before submitting your changes, run the test suite to make sure that nothing is
139139
```sh
140140
gradle check
141141
```
142+
143+
Contributing as part of a class
144+
-------------------------------
145+
In general Elasticsearch is happy to accept contributions that were created as
146+
part of a class but strongly advise against making the contribution as part of
147+
the class. So if you have code you wrote for a class feel free to submit it.
148+
149+
Please, please, please do not assign contributing to Elasticsearch as part of a
150+
class. If you really want to assign writing code for Elasticsearch as an
151+
assignment then the code contributions should be made to your private clone and
152+
opening PRs against the primary Elasticsearch clone must be optional, fully
153+
voluntary, not for a grade, and without any deadlines.
154+
155+
Because:
156+
157+
* While the code review process is likely very educational, it can take wildly
158+
varying amounts of time depending on who is available, where the change is, and
159+
how deep the change is. There is no way to predict how long it will take unless
160+
we rush.
161+
* We do not rush reviews without a very, very good reason. Class deadlines
162+
aren't a good enough reason for us to rush reviews.
163+
* We deeply discourage opening a PR you don't intend to work through the entire
164+
code review process because it wastes our time.
165+
* We don't have the capacity to absorb an entire class full of new contributors,
166+
especially when they are unlikely to become long time contributors.
167+
168+
Finally, we require that you run `gradle check` before submitting a
169+
non-documentation contribution. This is mentioned above, but it is worth
170+
repeating in this section because it has come up in this context.

README.textile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ We have just covered a very small portion of what Elasticsearch is all about. Fo
200200

201201
h3. Building from Source
202202

203-
Elasticsearch uses "Gradle":https://gradle.org for its build system. You'll need to have version 2.13 of Gradle installed.
203+
Elasticsearch uses "Gradle":https://gradle.org for its build system. You'll need to have at least version 3.3 of Gradle installed.
204204

205205
In order to create a distribution, simply run the @gradle assemble@ command in the cloned directory.
206206

buildSrc/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ apply plugin: 'groovy'
2323

2424
group = 'org.elasticsearch.gradle'
2525

26-
if (GradleVersion.current() < GradleVersion.version('2.13')) {
27-
throw new GradleException('Gradle 2.13+ is required to build elasticsearch')
26+
if (GradleVersion.current() < GradleVersion.version('3.3')) {
27+
throw new GradleException('Gradle 3.3+ is required to build elasticsearch')
2828
}
2929

3030
if (JavaVersion.current() < JavaVersion.VERSION_1_8) {

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

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

124124
// enforce gradle version
125-
GradleVersion minGradle = GradleVersion.version('2.13')
125+
GradleVersion minGradle = GradleVersion.version('3.3')
126126
if (GradleVersion.current() < minGradle) {
127127
throw new GradleException("${minGradle} or above is required to build elasticsearch")
128128
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ class ClusterConfiguration {
125125

126126
Map<String, Object> settings = new HashMap<>()
127127

128+
Map<String, String> keystoreSettings = new HashMap<>()
129+
128130
// map from destination path, to source file
129131
Map<String, Object> extraConfigFiles = new HashMap<>()
130132

@@ -144,6 +146,11 @@ class ClusterConfiguration {
144146
settings.put(name, value)
145147
}
146148

149+
@Input
150+
void keystoreSetting(String name, String value) {
151+
keystoreSettings.put(name, value)
152+
}
153+
147154
@Input
148155
void plugin(String path) {
149156
Project pluginProject = project.project(path)

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import org.gradle.api.tasks.Copy
3838
import org.gradle.api.tasks.Delete
3939
import org.gradle.api.tasks.Exec
4040

41+
import java.nio.charset.StandardCharsets
4142
import java.nio.file.Paths
4243
import java.util.concurrent.TimeUnit
4344

@@ -157,10 +158,14 @@ class ClusterFormationTasks {
157158
node.cwd.mkdirs()
158159
}
159160
}
161+
160162
setup = configureCheckPreviousTask(taskName(prefix, node, 'checkPrevious'), project, setup, node)
161163
setup = configureStopTask(taskName(prefix, node, 'stopPrevious'), project, setup, node)
162164
setup = configureExtractTask(taskName(prefix, node, 'extract'), project, setup, node, configuration)
163165
setup = configureWriteConfigTask(taskName(prefix, node, 'configure'), project, setup, node, seedNode)
166+
setup = configureCreateKeystoreTask(taskName(prefix, node, 'createKeystore'), project, setup, node)
167+
setup = configureAddKeystoreSettingTasks(prefix, project, setup, node)
168+
164169
if (node.config.plugins.isEmpty() == false) {
165170
if (node.nodeVersion == VersionProperties.elasticsearch) {
166171
setup = configureCopyPluginsTask(taskName(prefix, node, 'copyPlugins'), project, setup, node)
@@ -303,6 +308,33 @@ class ClusterFormationTasks {
303308
}
304309
}
305310

311+
/** Adds a task to create keystore */
312+
static Task configureCreateKeystoreTask(String name, Project project, Task setup, NodeInfo node) {
313+
if (node.config.keystoreSettings.isEmpty()) {
314+
return setup
315+
} else {
316+
File esKeystoreUtil = Paths.get(node.homeDir.toString(), "bin/" + "elasticsearch-keystore").toFile()
317+
return configureExecTask(name, project, setup, node, esKeystoreUtil, 'create')
318+
}
319+
}
320+
321+
/** Adds tasks to add settings to the keystore */
322+
static Task configureAddKeystoreSettingTasks(String parent, Project project, Task setup, NodeInfo node) {
323+
Map kvs = node.config.keystoreSettings
324+
File esKeystoreUtil = Paths.get(node.homeDir.toString(), "bin/" + "elasticsearch-keystore").toFile()
325+
Task parentTask = setup
326+
for (Map.Entry<String, String> entry in kvs) {
327+
String key = entry.getKey()
328+
String name = taskName(parent, node, 'addToKeystore#' + key)
329+
Task t = configureExecTask(name, project, parentTask, node, esKeystoreUtil, 'add', key, '-x')
330+
t.doFirst {
331+
standardInput = new ByteArrayInputStream(entry.getValue().getBytes(StandardCharsets.UTF_8))
332+
}
333+
parentTask = t
334+
}
335+
return parentTask
336+
}
337+
306338
static Task configureExtraConfigFilesTask(String name, Project project, Task setup, NodeInfo node) {
307339
if (node.config.extraConfigFiles.isEmpty()) {
308340
return setup

buildSrc/src/main/resources/checkstyle_suppressions.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,10 @@
491491
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]ReduceSearchPhaseException.java" checks="LineLength" />
492492
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]RemoteClusterConnection.java" checks="LineLength" />
493493
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]RemoteClusterService.java" checks="LineLength" />
494-
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchDfsQueryThenFetchAsyncAction.java" checks="LineLength" />
495494
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchPhase.java" checks="LineLength" />
496495
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchPhaseContext.java" checks="LineLength" />
497496
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchPhaseController.java" checks="LineLength" />
498497
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchPhaseExecutionException.java" checks="LineLength" />
499-
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchQueryThenFetchAsyncAction.java" checks="LineLength" />
500498
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchRequest.java" checks="LineLength" />
501499
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchRequestBuilder.java" checks="LineLength" />
502500
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchResponse.java" checks="LineLength" />

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/DeleteDocumentationIT.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,35 +56,35 @@ public class DeleteDocumentationIT extends ESRestHighLevelClientTestCase {
5656
public void testDelete() throws IOException {
5757
RestHighLevelClient client = highLevelClient();
5858

59-
// tag::delete-request[]
59+
// tag::delete-request
6060
DeleteRequest request = new DeleteRequest(
6161
"index", // <1>
6262
"type", // <2>
6363
"id"); // <3>
64-
// end::delete-request[]
64+
// end::delete-request
6565

66-
// tag::delete-request-props[]
66+
// tag::delete-request-props
6767
request.timeout(TimeValue.timeValueSeconds(1)); // <1>
6868
request.timeout("1s"); // <2>
6969
request.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL); // <3>
7070
request.setRefreshPolicy("wait_for"); // <4>
7171
request.version(2); // <5>
7272
request.versionType(VersionType.EXTERNAL); // <6>
73-
// end::delete-request-props[]
73+
// end::delete-request-props
7474

75-
// tag::delete-execute[]
75+
// tag::delete-execute
7676
DeleteResponse response = client.delete(request);
77-
// end::delete-execute[]
77+
// end::delete-execute
7878

7979
try {
80-
// tag::delete-notfound[]
80+
// tag::delete-notfound
8181
if (response.getResult().equals(DocWriteResponse.Result.NOT_FOUND)) {
8282
throw new Exception("Can't find document to be removed"); // <1>
8383
}
84-
// end::delete-notfound[]
84+
// end::delete-notfound
8585
} catch (Exception ignored) { }
8686

87-
// tag::delete-execute-async[]
87+
// tag::delete-execute-async
8888
client.deleteAsync(request, new ActionListener<DeleteResponse>() {
8989
@Override
9090
public void onResponse(DeleteResponse deleteResponse) {
@@ -96,17 +96,17 @@ public void onFailure(Exception e) {
9696
// <2>
9797
}
9898
});
99-
// end::delete-execute-async[]
99+
// end::delete-execute-async
100100

101-
// tag::delete-conflict[]
101+
// tag::delete-conflict
102102
try {
103103
client.delete(request);
104104
} catch (ElasticsearchException exception) {
105105
if (exception.status().equals(RestStatus.CONFLICT)) {
106106
// <1>
107107
}
108108
}
109-
// end::delete-conflict[]
109+
// end::delete-conflict
110110

111111
}
112112
}

0 commit comments

Comments
 (0)