fix some more sneaky failures

This commit is contained in:
Simon Willnauer 2016-01-16 00:11:47 +01:00
parent a8eedd0457
commit 359475fb0d
6 changed files with 14 additions and 49 deletions

View File

@ -566,7 +566,6 @@ public final class IndexService extends AbstractIndexComponent implements IndexC
public synchronized void updateMetaData(final IndexMetaData metadata) {
if (indexSettings.updateIndexMetaData(metadata)) {
final Settings settings = indexSettings.getSettings();
for (final IndexShard shard : this.shards.values()) {
try {
shard.onSettingsChanged();

View File

@ -49,7 +49,7 @@ public class IndexStore extends AbstractIndexComponent {
* the node level one (defaults to the node level one).
*/
public StoreRateLimiting rateLimiting() {
return rateLimiting.getType() != StoreRateLimiting.Type.NONE ? indexStoreConfig.getNodeRateLimiter() : this.rateLimiting;
return rateLimiting.getType() == StoreRateLimiting.Type.NONE ? indexStoreConfig.getNodeRateLimiter() : this.rateLimiting;
}
/**

View File

@ -263,16 +263,16 @@ public class UpdateNumberOfReplicasIT extends ESIntegTestCase {
public void testUpdateWithInvalidNumberOfReplicas() {
createIndex("test");
final int value = randomIntBetween(-10, -1);
try {
client().admin().indices().prepareUpdateSettings("test")
.setSettings(Settings.settingsBuilder()
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, randomIntBetween(-10, -1))
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, value)
)
.execute().actionGet();
fail("should have thrown an exception about the replica shard count");
} catch (IllegalArgumentException e) {
assertThat("message contains error about shard count: " + e.getMessage(),
e.getMessage().contains("the value of the setting index.number_of_replicas must be a non negative integer"), equalTo(true));
assertEquals("Failed to parse value [" + value + "] for setting [index.number_of_replicas] must be >= 0", e.getMessage());
}
}
}

View File

@ -56,7 +56,7 @@ public class UpdateSettingsIT extends ESIntegTestCase {
client().admin().indices().prepareUpdateSettings("test")
.setSettings(Settings.settingsBuilder()
.put("index.refresh_interval", -1) // this one can change
.put("index.cache.filter.type", "none") // this one can't
.put("index.fielddata.cache", "none") // this one can't
)
.execute().actionGet();
fail();
@ -66,12 +66,12 @@ public class UpdateSettingsIT extends ESIntegTestCase {
IndexMetaData indexMetaData = client().admin().cluster().prepareState().execute().actionGet().getState().metaData().index("test");
assertThat(indexMetaData.getSettings().get("index.refresh_interval"), nullValue());
assertThat(indexMetaData.getSettings().get("index.cache.filter.type"), nullValue());
assertThat(indexMetaData.getSettings().get("index.fielddata.cache"), nullValue());
// Now verify via dedicated get settings api:
GetSettingsResponse getSettingsResponse = client().admin().indices().prepareGetSettings("test").get();
assertThat(getSettingsResponse.getSetting("test", "index.refresh_interval"), nullValue());
assertThat(getSettingsResponse.getSetting("test", "index.cache.filter.type"), nullValue());
assertThat(getSettingsResponse.getSetting("test", "index.fielddata.cache"), nullValue());
client().admin().indices().prepareUpdateSettings("test")
.setSettings(Settings.settingsBuilder()
@ -107,18 +107,18 @@ public class UpdateSettingsIT extends ESIntegTestCase {
client().admin().indices().prepareUpdateSettings("test")
.setSettings(Settings.settingsBuilder()
.put("index.refresh_interval", "1s") // this one can change
.put("index.cache.filter.type", "none") // this one can't
.put("index.fielddata.cache", "none") // this one can't
)
.execute().actionGet();
indexMetaData = client().admin().cluster().prepareState().execute().actionGet().getState().metaData().index("test");
assertThat(indexMetaData.getSettings().get("index.refresh_interval"), equalTo("1s"));
assertThat(indexMetaData.getSettings().get("index.cache.filter.type"), equalTo("none"));
assertThat(indexMetaData.getSettings().get("index.fielddata.cache"), equalTo("none"));
// Now verify via dedicated get settings api:
getSettingsResponse = client().admin().indices().prepareGetSettings("test").get();
assertThat(getSettingsResponse.getSetting("test", "index.refresh_interval"), equalTo("1s"));
assertThat(getSettingsResponse.getSetting("test", "index.cache.filter.type"), equalTo("none"));
assertThat(getSettingsResponse.getSetting("test", "index.fielddata.cache"), equalTo("none"));
}
public void testEngineGCDeletesSetting() throws InterruptedException {
@ -181,7 +181,7 @@ public class UpdateSettingsIT extends ESIntegTestCase {
.prepareUpdateSettings("test")
.setSettings(Settings.builder()
.put(IndexStore.INDEX_STORE_THROTTLE_TYPE_SETTING.getKey(), "merge")
.put(IndexStore.INDEX_STORE_THROTTLE_MAX_BYTES_PER_SEC_SETTING.getKey(), "1mb"))
.put(IndexStore.INDEX_STORE_THROTTLE_MAX_BYTES_PER_SEC_SETTING.getKey(), "1mb"))
.get();
// Make sure setting says it is in fact changed:
@ -279,10 +279,10 @@ public class UpdateSettingsIT extends ESIntegTestCase {
if (event.getLevel() == Level.TRACE &&
event.getLoggerName().endsWith("lucene.iw")) {
}
if (event.getLevel() == Level.INFO && message.contains("updating [index.merge.scheduler.max_thread_count] from [10000] to [1]")) {
if (event.getLevel() == Level.INFO && message.contains("update [index.merge.scheduler.max_thread_count] from [10000] to [1]")) {
sawUpdateMaxThreadCount = true;
}
if (event.getLevel() == Level.INFO && message.contains("updating [index.merge.scheduler.auto_throttle] from [true] to [false]")) {
if (event.getLevel() == Level.INFO && message.contains("update [index.merge.scheduler.auto_throttle] from [true] to [false]")) {
sawUpdateAutoThrottle = true;
}
}
@ -359,7 +359,6 @@ public class UpdateSettingsIT extends ESIntegTestCase {
));
assertFalse(mockAppender.sawUpdateMaxThreadCount);
// Now make a live change to reduce allowed merge threads:
client()
.admin()

View File

@ -202,7 +202,7 @@ public class PercolatorAggregationsIT extends ESIntegTestCase {
}
public void testSingleShardAggregations() throws Exception {
assertAcked(prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("SETTING_NUMBER_OF_SHARDS", 1))
assertAcked(prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("index.number_of_shards", 1))
.addMapping("type", "field1", "type=string", "field2", "type=string"));
ensureGreen();

View File

@ -1,33 +0,0 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.recovery;
import org.elasticsearch.common.settings.Settings;
/**
*
*/
public class SmallFileChunkSizeRecoveryIT extends SimpleRecoveryIT {
@Override
protected Settings recoverySettings() {
return Settings.settingsBuilder().put("index.shard.recovery.file_chunk_size", "3b").build();
}
}