Skip to content

Commit

Permalink
Merge remote-tracking branch 'elastic/master' into cache-deadlock
Browse files Browse the repository at this point in the history
* elastic/master:
  Mute ML upgrade test (elastic#30458)
  Stop forking javac (elastic#30462)
  Client: Deprecate many argument performRequest (elastic#30315)
  Docs: Use task_id in examples of tasks (elastic#30436)
  Security: Rename IndexLifecycleManager to SecurityIndexManager (elastic#30442)
  • Loading branch information
jasontedor committed May 9, 2018
2 parents 9344ce7 + 4b36ea7 commit a3e152f
Show file tree
Hide file tree
Showing 35 changed files with 218 additions and 219 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,15 @@ class BuildPlugin implements Plugin<Project> {
project.afterEvaluate {
project.tasks.withType(JavaCompile) {
final JavaVersion targetCompatibilityVersion = JavaVersion.toVersion(it.targetCompatibility)
// we fork because compiling lots of different classes in a shared jvm can eventually trigger GC overhead limitations
options.fork = true
options.forkOptions.javaHome = new File(project.compilerJavaHome)
options.forkOptions.memoryMaximumSize = "512m"
final compilerJavaHomeFile = new File(project.compilerJavaHome)
// we only fork if the Gradle JDK is not the same as the compiler JDK
if (compilerJavaHomeFile.canonicalPath == Jvm.current().javaHome.canonicalPath) {
options.fork = false
} else {
options.fork = true
options.forkOptions.javaHome = compilerJavaHomeFile
options.forkOptions.memoryMaximumSize = "512m"
}
if (targetCompatibilityVersion == JavaVersion.VERSION_1_8) {
// compile with compact 3 profile by default
// NOTE: this is just a compile time check: does not replace testing with a compact3 JRE
Expand Down
16 changes: 16 additions & 0 deletions client/rest/src/main/java/org/elasticsearch/client/RestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ public void performRequestAsync(Request request, ResponseListener responseListen
* @throws IOException in case of a problem or the connection was aborted
* @throws ClientProtocolException in case of an http protocol error
* @throws ResponseException in case Elasticsearch responded with a status code that indicated an error
* @deprecated prefer {@link #performRequest(Request)}
*/
@Deprecated
public Response performRequest(String method, String endpoint, Header... headers) throws IOException {
Request request = new Request(method, endpoint);
request.setHeaders(headers);
Expand All @@ -229,7 +231,9 @@ public Response performRequest(String method, String endpoint, Header... headers
* @throws IOException in case of a problem or the connection was aborted
* @throws ClientProtocolException in case of an http protocol error
* @throws ResponseException in case Elasticsearch responded with a status code that indicated an error
* @deprecated prefer {@link #performRequest(Request)}
*/
@Deprecated
public Response performRequest(String method, String endpoint, Map<String, String> params, Header... headers) throws IOException {
Request request = new Request(method, endpoint);
addParameters(request, params);
Expand All @@ -252,7 +256,9 @@ public Response performRequest(String method, String endpoint, Map<String, Strin
* @throws IOException in case of a problem or the connection was aborted
* @throws ClientProtocolException in case of an http protocol error
* @throws ResponseException in case Elasticsearch responded with a status code that indicated an error
* @deprecated prefer {@link #performRequest(Request)}
*/
@Deprecated
public Response performRequest(String method, String endpoint, Map<String, String> params,
HttpEntity entity, Header... headers) throws IOException {
Request request = new Request(method, endpoint);
Expand Down Expand Up @@ -289,7 +295,9 @@ public Response performRequest(String method, String endpoint, Map<String, Strin
* @throws IOException in case of a problem or the connection was aborted
* @throws ClientProtocolException in case of an http protocol error
* @throws ResponseException in case Elasticsearch responded with a status code that indicated an error
* @deprecated prefer {@link #performRequest(Request)}
*/
@Deprecated
public Response performRequest(String method, String endpoint, Map<String, String> params,
HttpEntity entity, HttpAsyncResponseConsumerFactory httpAsyncResponseConsumerFactory,
Header... headers) throws IOException {
Expand All @@ -310,7 +318,9 @@ public Response performRequest(String method, String endpoint, Map<String, Strin
* @param endpoint the path of the request (without host and port)
* @param responseListener the {@link ResponseListener} to notify when the request is completed or fails
* @param headers the optional request headers
* @deprecated prefer {@link #performRequestAsync(Request, ResponseListener)}
*/
@Deprecated
public void performRequestAsync(String method, String endpoint, ResponseListener responseListener, Header... headers) {
Request request;
try {
Expand All @@ -333,7 +343,9 @@ public void performRequestAsync(String method, String endpoint, ResponseListener
* @param params the query_string parameters
* @param responseListener the {@link ResponseListener} to notify when the request is completed or fails
* @param headers the optional request headers
* @deprecated prefer {@link #performRequestAsync(Request, ResponseListener)}
*/
@Deprecated
public void performRequestAsync(String method, String endpoint, Map<String, String> params,
ResponseListener responseListener, Header... headers) {
Request request;
Expand Down Expand Up @@ -361,7 +373,9 @@ public void performRequestAsync(String method, String endpoint, Map<String, Stri
* @param entity the body of the request, null if not applicable
* @param responseListener the {@link ResponseListener} to notify when the request is completed or fails
* @param headers the optional request headers
* @deprecated prefer {@link #performRequestAsync(Request, ResponseListener)}
*/
@Deprecated
public void performRequestAsync(String method, String endpoint, Map<String, String> params,
HttpEntity entity, ResponseListener responseListener, Header... headers) {
Request request;
Expand Down Expand Up @@ -394,7 +408,9 @@ public void performRequestAsync(String method, String endpoint, Map<String, Stri
* connection on the client side.
* @param responseListener the {@link ResponseListener} to notify when the request is completed or fails
* @param headers the optional request headers
* @deprecated prefer {@link #performRequestAsync(Request, ResponseListener)}
*/
@Deprecated
public void performRequestAsync(String method, String endpoint, Map<String, String> params,
HttpEntity entity, HttpAsyncResponseConsumerFactory httpAsyncResponseConsumerFactory,
ResponseListener responseListener, Header... headers) {
Expand Down
13 changes: 8 additions & 5 deletions docs/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[partintro]
--
// To add a release, copy and paste the template text
// To add a release, copy and paste the template text
// and add a link to the new section. Note that release subheads must
// be floated and sections cannot be empty.

Expand Down Expand Up @@ -139,8 +139,11 @@ coming[6.4.0]
//[float]
//=== Breaking Java Changes

//[float]
//=== Deprecations
[float]
=== Deprecations

Deprecated multi-argument versions of the request methods in the RestClient.
Prefer the "Request" object flavored methods. ({pull}30315[#30315])

[float]
=== New Features
Expand All @@ -157,8 +160,8 @@ analysis module. ({pull}30397[#30397])

{ref-64}/breaking_64_api_changes.html#copy-source-settings-on-resize[Allow copying source settings on index resize operations] ({pull}30255[#30255])

Added new "Request" object flavored request methods. Prefer these instead of the
multi-argument versions. ({pull}29623[#29623])
Added new "Request" object flavored request methods in the RestClient. Prefer
these instead of the multi-argument versions. ({pull}29623[#29623])

The cluster state listener to decide if watcher should be
stopped/started/paused now runs far less code in an executor but is more
Expand Down
6 changes: 4 additions & 2 deletions docs/reference/cluster/tasks.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ It is also possible to retrieve information for a particular task:

[source,js]
--------------------------------------------------
GET _tasks/task_id:1 <1>
GET _tasks/task_id <1>
--------------------------------------------------
// CONSOLE
// TEST[s/task_id/node_id:1/]
// TEST[catch:missing]

<1> This will return a 404 if the task isn't found.
Expand All @@ -75,9 +76,10 @@ Or to retrieve all children of a particular task:

[source,js]
--------------------------------------------------
GET _tasks?parent_task_id=parentTaskId:1 <1>
GET _tasks?parent_task_id=parent_task_id <1>
--------------------------------------------------
// CONSOLE
// TEST[s/=parent_task_id/=node_id:1/]

<1> This won't return a 404 if the parent isn't found.

Expand Down
9 changes: 6 additions & 3 deletions docs/reference/docs/delete-by-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,10 @@ With the task id you can look up the task directly:

[source,js]
--------------------------------------------------
GET /_tasks/taskId:1
GET /_tasks/task_id
--------------------------------------------------
// CONSOLE
// TEST[s/task_id/node_id:1/]
// TEST[catch:missing]

The advantage of this API is that it integrates with `wait_for_completion=false`
Expand All @@ -378,8 +379,9 @@ Any Delete By Query can be canceled using the <<tasks,Task Cancel API>>:

[source,js]
--------------------------------------------------
POST _tasks/task_id:1/_cancel
POST _tasks/task_id/_cancel
--------------------------------------------------
// TEST[s/task_id/node_id:1/]
// CONSOLE

The `task_id` can be found using the tasks API above.
Expand All @@ -397,8 +399,9 @@ using the `_rethrottle` API:

[source,js]
--------------------------------------------------
POST _delete_by_query/task_id:1/_rethrottle?requests_per_second=-1
POST _delete_by_query/task_id/_rethrottle?requests_per_second=-1
--------------------------------------------------
// TEST[s/task_id/node_id:1/]
// CONSOLE

The `task_id` can be found using the tasks API above.
Expand Down
9 changes: 6 additions & 3 deletions docs/reference/docs/reindex.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -740,9 +740,10 @@ With the task id you can look up the task directly:

[source,js]
--------------------------------------------------
GET /_tasks/taskId:1
GET /_tasks/task_id
--------------------------------------------------
// CONSOLE
// TEST[s/task_id/node_id:1/]
// TEST[catch:missing]

The advantage of this API is that it integrates with `wait_for_completion=false`
Expand All @@ -761,9 +762,10 @@ Any Reindex can be canceled using the <<tasks,Task Cancel API>>:

[source,js]
--------------------------------------------------
POST _tasks/task_id:1/_cancel
POST _tasks/task_id/_cancel
--------------------------------------------------
// CONSOLE
// TEST[s/task_id/node_id:1/]

The `task_id` can be found using the Tasks API.

Expand All @@ -780,9 +782,10 @@ the `_rethrottle` API:

[source,js]
--------------------------------------------------
POST _reindex/task_id:1/_rethrottle?requests_per_second=-1
POST _reindex/task_id/_rethrottle?requests_per_second=-1
--------------------------------------------------
// CONSOLE
// TEST[s/task_id/node_id:1/]

The `task_id` can be found using the Tasks API above.

Expand Down
9 changes: 6 additions & 3 deletions docs/reference/docs/update-by-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,10 @@ With the task id you can look up the task directly:

[source,js]
--------------------------------------------------
GET /_tasks/taskId:1
GET /_tasks/task_id
--------------------------------------------------
// CONSOLE
// TEST[s/task_id/node_id:1/]
// TEST[catch:missing]

The advantage of this API is that it integrates with `wait_for_completion=false`
Expand All @@ -436,9 +437,10 @@ Any Update By Query can be canceled using the <<tasks,Task Cancel API>>:

[source,js]
--------------------------------------------------
POST _tasks/task_id:1/_cancel
POST _tasks/task_id/_cancel
--------------------------------------------------
// CONSOLE
// TEST[s/task_id/node_id:1/]

The `task_id` can be found using the tasks API above.

Expand All @@ -455,9 +457,10 @@ using the `_rethrottle` API:

[source,js]
--------------------------------------------------
POST _update_by_query/task_id:1/_rethrottle?requests_per_second=-1
POST _update_by_query/task_id/_rethrottle?requests_per_second=-1
--------------------------------------------------
// CONSOLE
// TEST[s/task_id/node_id:1/]

The `task_id` can be found using the tasks API above.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
import org.elasticsearch.xpack.security.rest.action.user.RestHasPrivilegesAction;
import org.elasticsearch.xpack.security.rest.action.user.RestPutUserAction;
import org.elasticsearch.xpack.security.rest.action.user.RestSetEnabledAction;
import org.elasticsearch.xpack.security.support.IndexLifecycleManager;
import org.elasticsearch.xpack.security.support.SecurityIndexManager;
import org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor;
import org.elasticsearch.xpack.security.transport.filter.IPFilter;
import org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4HttpServerTransport;
Expand Down Expand Up @@ -233,7 +233,7 @@
import static org.elasticsearch.xpack.core.XPackSettings.HTTP_SSL_ENABLED;
import static org.elasticsearch.xpack.core.security.SecurityLifecycleServiceField.SECURITY_TEMPLATE_NAME;
import static org.elasticsearch.xpack.security.SecurityLifecycleService.SECURITY_INDEX_NAME;
import static org.elasticsearch.xpack.security.support.IndexLifecycleManager.INTERNAL_INDEX_FORMAT;
import static org.elasticsearch.xpack.security.support.SecurityIndexManager.INTERNAL_INDEX_FORMAT;

public class Security extends Plugin implements ActionPlugin, IngestPlugin, NetworkPlugin, ClusterPlugin,
DiscoveryPlugin, MapperPlugin, ExtensiblePlugin {
Expand Down Expand Up @@ -424,8 +424,8 @@ Collection<Object> createComponents(Client client, ThreadPool threadPool, Cluste
components.add(realms);
components.add(reservedRealm);

securityLifecycleService.addSecurityIndexHealthChangeListener(nativeRoleMappingStore::onSecurityIndexHealthChange);
securityLifecycleService.addSecurityIndexOutOfDateListener(nativeRoleMappingStore::onSecurityIndexOutOfDateChange);
securityLifecycleService.securityIndex().addIndexHealthChangeListener(nativeRoleMappingStore::onSecurityIndexHealthChange);
securityLifecycleService.securityIndex().addIndexOutOfDateListener(nativeRoleMappingStore::onSecurityIndexOutOfDateChange);

AuthenticationFailureHandler failureHandler = null;
String extensionName = null;
Expand Down Expand Up @@ -458,8 +458,8 @@ Collection<Object> createComponents(Client client, ThreadPool threadPool, Cluste
}
final CompositeRolesStore allRolesStore = new CompositeRolesStore(settings, fileRolesStore, nativeRolesStore,
reservedRolesStore, rolesProviders, threadPool.getThreadContext(), getLicenseState());
securityLifecycleService.addSecurityIndexHealthChangeListener(allRolesStore::onSecurityIndexHealthChange);
securityLifecycleService.addSecurityIndexOutOfDateListener(allRolesStore::onSecurityIndexOutOfDateChange);
securityLifecycleService.securityIndex().addIndexHealthChangeListener(allRolesStore::onSecurityIndexHealthChange);
securityLifecycleService.securityIndex().addIndexOutOfDateListener(allRolesStore::onSecurityIndexOutOfDateChange);
// to keep things simple, just invalidate all cached entries on license change. this happens so rarely that the impact should be
// minimal
getLicenseState().addListener(allRolesStore::invalidateAll);
Expand Down Expand Up @@ -886,7 +886,7 @@ public UnaryOperator<Map<String, IndexTemplateMetaData>> getIndexTemplateMetaDat
templates.remove(SECURITY_TEMPLATE_NAME);
final XContent xContent = XContentFactory.xContent(XContentType.JSON);
final byte[] auditTemplate = TemplateUtils.loadTemplate("/" + IndexAuditTrail.INDEX_TEMPLATE_NAME + ".json",
Version.CURRENT.toString(), IndexLifecycleManager.TEMPLATE_VERSION_PATTERN).getBytes(StandardCharsets.UTF_8);
Version.CURRENT.toString(), SecurityIndexManager.TEMPLATE_VERSION_PATTERN).getBytes(StandardCharsets.UTF_8);

try (XContentParser parser = xContent
.createParser(NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, auditTemplate)) {
Expand Down
Loading

0 comments on commit a3e152f

Please sign in to comment.