use of io.crate.planner.node.ddl.UpdateSettingsPlan in project crate by crate.
the class DependencyCarrierDDLTest method testClusterUpdateSettingsTask.
@Test
public void testClusterUpdateSettingsTask() throws Exception {
final String persistentSetting = "stats.enabled";
final String transientSetting = "bulk.request_timeout";
// Update persistent only
List<Assignment<Symbol>> persistentSettings = List.of(new Assignment<>(Literal.of(persistentSetting), List.of(Literal.of(false))));
UpdateSettingsPlan node = new UpdateSettingsPlan(persistentSettings, true);
PlannerContext plannerContext = mock(PlannerContext.class);
Bucket objects = executePlan(node, plannerContext);
assertThat(objects, contains(isRow(1L)));
assertEquals("false", client().admin().cluster().prepareState().execute().actionGet().getState().metadata().persistentSettings().get(persistentSetting));
// Update transient only
List<Assignment<Symbol>> transientSettings = List.of(new Assignment<>(Literal.of(transientSetting), List.of(Literal.of("123s"))));
node = new UpdateSettingsPlan(transientSettings, false);
objects = executePlan(node, plannerContext);
assertThat(objects, contains(isRow(1L)));
assertEquals("123s", client().admin().cluster().prepareState().execute().actionGet().getState().metadata().transientSettings().get(transientSetting));
}
use of io.crate.planner.node.ddl.UpdateSettingsPlan in project crate by crate.
the class PlannerTest method testSetPlan.
@Test
public void testSetPlan() throws Exception {
UpdateSettingsPlan plan = e.plan("set GLOBAL PERSISTENT stats.jobs_log_size=1024");
assertThat(plan.settings(), contains(new Assignment<>(Literal.of("stats.jobs_log_size"), List.of(Literal.of(1024)))));
assertThat(plan.isPersistent(), is(true));
plan = e.plan("set GLOBAL TRANSIENT stats.enabled=false,stats.jobs_log_size=0");
assertThat(plan.settings().size(), is(2));
assertThat(plan.isPersistent(), is(false));
}
Aggregations