use of org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse in project crate by crate.
the class ESClusterUpdateSettingsTask method execute.
@Override
public void execute(BatchConsumer consumer, Row parameters) {
ClusterUpdateSettingsRequest request = buildESUpdateClusterSettingRequest(buildSettingsFrom(plan.persistentSettings(), parameters), buildSettingsFrom(plan.transientSettings(), parameters));
OneRowActionListener<ClusterUpdateSettingsResponse> actionListener = new OneRowActionListener<>(consumer, TO_ONE_ROW);
transport.execute(request, actionListener);
}
use of org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse in project crate by crate.
the class DecommissioningService method clusterSetDecommissionNodeSetting.
private CompletableFuture<ClusterUpdateSettingsResponse> clusterSetDecommissionNodeSetting() {
if (dataAvailability == DataAvailability.NONE) {
return CompletableFuture.completedFuture(null);
}
/*
* setting this setting will cause the {@link DecommissionAllocationDecider} to prevent allocations onto this node
*
* nodeIds are part of the key to prevent conflicts if other nodes are being decommissioned in parallel
*/
Settings settings = Settings.builder().put(DECOMMISSION_PREFIX + clusterService.localNode().getId(), true).build();
FutureActionListener<ClusterUpdateSettingsResponse, ClusterUpdateSettingsResponse> settingsResponseFutureListener = FutureActionListener.newInstance();
updateSettingsAction.execute(new ClusterUpdateSettingsRequest().transientSettings(settings), settingsResponseFutureListener);
return settingsResponseFutureListener;
}
use of org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse in project crate by crate.
the class ResetSettingsPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate(plannerContext.transactionContext(), plannerContext.nodeContext(), x, params, subQueryResults);
Settings settings = buildSettingsFrom(resetAnalyzedStatement.settingsToRemove(), eval);
ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings(settings).transientSettings(settings);
OneRowActionListener<ClusterUpdateSettingsResponse> actionListener = new OneRowActionListener<>(consumer, r -> r.isAcknowledged() ? new Row1(1L) : new Row1(0L));
dependencies.transportActionProvider().transportClusterUpdateSettingsAction().execute(request, actionListener);
}
use of org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse in project crate by crate.
the class CreateAnalyzerTask method execute.
@Override
public void execute(BatchConsumer consumer, Row parameters) {
ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
request.persistentSettings(plan.createAnalyzerSettings());
OneRowActionListener<ClusterUpdateSettingsResponse> actionListener = new OneRowActionListener<>(consumer, TO_ONE_ROW);
transport.execute(request, actionListener);
}
use of org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse in project elasticsearch by elastic.
the class RestClusterUpdateSettingsAction method prepareRequest.
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
final ClusterUpdateSettingsRequest clusterUpdateSettingsRequest = Requests.clusterUpdateSettingsRequest();
clusterUpdateSettingsRequest.timeout(request.paramAsTime("timeout", clusterUpdateSettingsRequest.timeout()));
clusterUpdateSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterUpdateSettingsRequest.masterNodeTimeout()));
Map<String, Object> source;
try (XContentParser parser = request.contentParser()) {
source = parser.map();
}
if (source.containsKey("transient")) {
clusterUpdateSettingsRequest.transientSettings((Map) source.get("transient"));
}
if (source.containsKey("persistent")) {
clusterUpdateSettingsRequest.persistentSettings((Map) source.get("persistent"));
}
return channel -> client.admin().cluster().updateSettings(clusterUpdateSettingsRequest, new AcknowledgedRestListener<ClusterUpdateSettingsResponse>(channel) {
@Override
protected void addCustomFields(XContentBuilder builder, ClusterUpdateSettingsResponse response) throws IOException {
builder.startObject("persistent");
response.getPersistentSettings().toXContent(builder, request);
builder.endObject();
builder.startObject("transient");
response.getTransientSettings().toXContent(builder, request);
builder.endObject();
}
});
}
Aggregations