mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-27 10:28:28 +00:00
fix spelling and remove wildcard imports
This commit is contained in:
parent
c3f901400c
commit
87494dd7db
@ -1018,7 +1018,7 @@ public abstract class TransportReplicationAction<Request extends ReplicationRequ
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (indexShard.getTranslogDurability() == Translog.Durabilty.REQUEST && location != null) {
|
||||
if (indexShard.getTranslogDurability() == Translog.Durability.REQUEST && location != null) {
|
||||
indexShard.sync(location);
|
||||
}
|
||||
indexShard.maybeFlush();
|
||||
|
@ -574,7 +574,7 @@ public final class IndexService extends AbstractIndexComponent implements IndexC
|
||||
} // pkg private for testing
|
||||
|
||||
private void maybeFSyncTranslogs() {
|
||||
if (indexSettings.getTranslogDurability() == Translog.Durabilty.ASYNC) {
|
||||
if (indexSettings.getTranslogDurability() == Translog.Durability.ASYNC) {
|
||||
for (IndexShard shard : this.shards.values()) {
|
||||
try {
|
||||
Translog translog = shard.getTranslog();
|
||||
|
@ -29,7 +29,12 @@ import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.index.mapper.internal.AllFieldMapper;
|
||||
import org.elasticsearch.index.translog.Translog;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@ -69,7 +74,7 @@ public final class IndexSettings {
|
||||
private final boolean queryStringAllowLeadingWildcard;
|
||||
private final boolean defaultAllowUnmappedFields;
|
||||
private final Predicate<String> indexNameMatcher;
|
||||
private volatile Translog.Durabilty durabilty;
|
||||
private volatile Translog.Durability durability;
|
||||
private final TimeValue syncInterval;
|
||||
|
||||
/**
|
||||
@ -148,8 +153,8 @@ public final class IndexSettings {
|
||||
this.parseFieldMatcher = new ParseFieldMatcher(settings);
|
||||
this.defaultAllowUnmappedFields = settings.getAsBoolean(ALLOW_UNMAPPED, true);
|
||||
this.indexNameMatcher = indexNameMatcher;
|
||||
final String value = settings.get(INDEX_TRANSLOG_DURABILITY, Translog.Durabilty.REQUEST.name());
|
||||
this.durabilty = getFromSettings(settings, Translog.Durabilty.REQUEST);
|
||||
final String value = settings.get(INDEX_TRANSLOG_DURABILITY, Translog.Durability.REQUEST.name());
|
||||
this.durability = getFromSettings(settings, Translog.Durability.REQUEST);
|
||||
syncInterval = settings.getAsTime(INDEX_TRANSLOG_SYNC_INTERVAL, TimeValue.timeValueSeconds(5));
|
||||
|
||||
assert indexNameMatcher.test(indexMetaData.getIndex());
|
||||
@ -321,25 +326,25 @@ public final class IndexSettings {
|
||||
/**
|
||||
* Returns the translog durability for this index.
|
||||
*/
|
||||
public Translog.Durabilty getTranslogDurability() {
|
||||
return durabilty;
|
||||
public Translog.Durability getTranslogDurability() {
|
||||
return durability;
|
||||
}
|
||||
|
||||
public Translog.Durabilty getFromSettings(Settings settings, Translog.Durabilty defaultValue) {
|
||||
public Translog.Durability getFromSettings(Settings settings, Translog.Durability defaultValue) {
|
||||
final String value = settings.get(INDEX_TRANSLOG_DURABILITY, defaultValue.name());
|
||||
try {
|
||||
return Translog.Durabilty.valueOf(value.toUpperCase(Locale.ROOT));
|
||||
return Translog.Durability.valueOf(value.toUpperCase(Locale.ROOT));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
logger.warn("Can't apply {} illegal value: {} using {} instead, use one of: {}", INDEX_TRANSLOG_DURABILITY, value, defaultValue, Arrays.toString(Translog.Durabilty.values()));
|
||||
logger.warn("Can't apply {} illegal value: {} using {} instead, use one of: {}", INDEX_TRANSLOG_DURABILITY, value, defaultValue, Arrays.toString(Translog.Durability.values()));
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSettings(Settings settings) {
|
||||
final Translog.Durabilty durabilty = getFromSettings(settings, this.durabilty);
|
||||
if (durabilty != this.durabilty) {
|
||||
logger.info("updating durability from [{}] to [{}]", this.durabilty, durabilty);
|
||||
this.durabilty = durabilty;
|
||||
final Translog.Durability durability = getFromSettings(settings, this.durability);
|
||||
if (durability != this.durability) {
|
||||
logger.info("updating durability from [{}] to [{}]", this.durability, durability);
|
||||
this.durability = durability;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,6 @@ import org.elasticsearch.index.termvectors.TermVectorsService;
|
||||
import org.elasticsearch.index.translog.Translog;
|
||||
import org.elasticsearch.index.translog.TranslogConfig;
|
||||
import org.elasticsearch.index.translog.TranslogStats;
|
||||
import org.elasticsearch.index.translog.TranslogWriter;
|
||||
import org.elasticsearch.index.warmer.ShardIndexWarmerService;
|
||||
import org.elasticsearch.index.warmer.WarmerStats;
|
||||
import org.elasticsearch.indices.IndicesWarmer;
|
||||
@ -126,10 +125,8 @@ import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.nio.channels.ClosedByInterruptException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
@ -1534,7 +1531,7 @@ public class IndexShard extends AbstractIndexShardComponent {
|
||||
/**
|
||||
* Returns the current translog durability mode
|
||||
*/
|
||||
public Translog.Durabilty getTranslogDurability() {
|
||||
public Translog.Durability getTranslogDurability() {
|
||||
return indexSettings.getTranslogDurability();
|
||||
}
|
||||
|
||||
|
@ -1156,7 +1156,7 @@ public class Translog extends AbstractIndexShardComponent implements IndexShardC
|
||||
}
|
||||
|
||||
|
||||
public enum Durabilty {
|
||||
public enum Durability {
|
||||
/**
|
||||
* Async durability - translogs are synced based on a time interval.
|
||||
*/
|
||||
|
@ -165,15 +165,15 @@ public class IndexSettingsTests extends ESTestCase {
|
||||
.put(IndexSettings.INDEX_TRANSLOG_DURABILITY, "async")
|
||||
.build());
|
||||
IndexSettings settings = new IndexSettings(metaData, Settings.EMPTY, Collections.emptyList());
|
||||
assertEquals(Translog.Durabilty.ASYNC, settings.getTranslogDurability());
|
||||
assertEquals(Translog.Durability.ASYNC, settings.getTranslogDurability());
|
||||
settings.updateIndexMetaData(newIndexMeta("index", Settings.builder().put(IndexSettings.INDEX_TRANSLOG_DURABILITY, "request").build()));
|
||||
assertEquals(Translog.Durabilty.REQUEST, settings.getTranslogDurability());
|
||||
assertEquals(Translog.Durability.REQUEST, settings.getTranslogDurability());
|
||||
|
||||
metaData = newIndexMeta("index", Settings.settingsBuilder()
|
||||
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
|
||||
.build());
|
||||
settings = new IndexSettings(metaData, Settings.EMPTY, Collections.emptyList());
|
||||
assertEquals(Translog.Durabilty.REQUEST, settings.getTranslogDurability()); // test default
|
||||
assertEquals(Translog.Durability.REQUEST, settings.getTranslogDurability()); // test default
|
||||
}
|
||||
|
||||
|
||||
|
@ -391,35 +391,35 @@ public class IndexShardTests extends ESSingleNodeTestCase {
|
||||
IndicesService indicesService = getInstanceFromNode(IndicesService.class);
|
||||
IndexService test = indicesService.indexService("test");
|
||||
IndexShard shard = test.getShardOrNull(0);
|
||||
setDurability(shard, Translog.Durabilty.REQUEST);
|
||||
setDurability(shard, Translog.Durability.REQUEST);
|
||||
assertFalse(shard.getEngine().getTranslog().syncNeeded());
|
||||
setDurability(shard, Translog.Durabilty.ASYNC);
|
||||
setDurability(shard, Translog.Durability.ASYNC);
|
||||
client().prepareIndex("test", "bar", "2").setSource("{}").get();
|
||||
assertTrue(shard.getEngine().getTranslog().syncNeeded());
|
||||
setDurability(shard, Translog.Durabilty.REQUEST);
|
||||
setDurability(shard, Translog.Durability.REQUEST);
|
||||
client().prepareDelete("test", "bar", "1").get();
|
||||
assertFalse(shard.getEngine().getTranslog().syncNeeded());
|
||||
|
||||
setDurability(shard, Translog.Durabilty.ASYNC);
|
||||
setDurability(shard, Translog.Durability.ASYNC);
|
||||
client().prepareDelete("test", "bar", "2").get();
|
||||
assertTrue(shard.getEngine().getTranslog().syncNeeded());
|
||||
setDurability(shard, Translog.Durabilty.REQUEST);
|
||||
setDurability(shard, Translog.Durability.REQUEST);
|
||||
assertNoFailures(client().prepareBulk()
|
||||
.add(client().prepareIndex("test", "bar", "3").setSource("{}"))
|
||||
.add(client().prepareDelete("test", "bar", "1")).get());
|
||||
assertFalse(shard.getEngine().getTranslog().syncNeeded());
|
||||
|
||||
setDurability(shard, Translog.Durabilty.ASYNC);
|
||||
setDurability(shard, Translog.Durability.ASYNC);
|
||||
assertNoFailures(client().prepareBulk()
|
||||
.add(client().prepareIndex("test", "bar", "4").setSource("{}"))
|
||||
.add(client().prepareDelete("test", "bar", "3")).get());
|
||||
setDurability(shard, Translog.Durabilty.REQUEST);
|
||||
setDurability(shard, Translog.Durability.REQUEST);
|
||||
assertTrue(shard.getEngine().getTranslog().syncNeeded());
|
||||
}
|
||||
|
||||
private void setDurability(IndexShard shard, Translog.Durabilty durabilty) {
|
||||
client().admin().indices().prepareUpdateSettings(shard.shardId.getIndex()).setSettings(settingsBuilder().put(IndexSettings.INDEX_TRANSLOG_DURABILITY, durabilty.name()).build()).get();
|
||||
assertEquals(durabilty, shard.getTranslogDurability());
|
||||
private void setDurability(IndexShard shard, Translog.Durability durability) {
|
||||
client().admin().indices().prepareUpdateSettings(shard.shardId.getIndex()).setSettings(settingsBuilder().put(IndexSettings.INDEX_TRANSLOG_DURABILITY, durability.name()).build()).get();
|
||||
assertEquals(durability, shard.getTranslogDurability());
|
||||
}
|
||||
|
||||
public void testMinimumCompatVersion() {
|
||||
@ -691,7 +691,7 @@ public class IndexShardTests extends ESSingleNodeTestCase {
|
||||
}
|
||||
|
||||
public void testMaybeFlush() throws Exception {
|
||||
createIndex("test", settingsBuilder().put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durabilty.REQUEST).build());
|
||||
createIndex("test", settingsBuilder().put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durability.REQUEST).build());
|
||||
ensureGreen();
|
||||
IndicesService indicesService = getInstanceFromNode(IndicesService.class);
|
||||
IndexService test = indicesService.indexService("test");
|
||||
|
@ -48,7 +48,6 @@ import org.elasticsearch.index.shard.MergePolicyConfig;
|
||||
import org.elasticsearch.index.shard.MergeSchedulerConfig;
|
||||
import org.elasticsearch.index.store.IndexStore;
|
||||
import org.elasticsearch.index.translog.Translog;
|
||||
import org.elasticsearch.index.translog.TranslogConfig;
|
||||
import org.elasticsearch.indices.cache.request.IndicesRequestCache;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
@ -318,7 +317,7 @@ public class IndexStatsIT extends ESIntegTestCase {
|
||||
.put(MergeSchedulerConfig.MAX_THREAD_COUNT, "1")
|
||||
.put(MergeSchedulerConfig.MAX_MERGE_COUNT, "1")
|
||||
.put("index.merge.policy.type", "tiered")
|
||||
.put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durabilty.ASYNC.name())
|
||||
.put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durability.ASYNC.name())
|
||||
));
|
||||
ensureGreen();
|
||||
long termUpto = 0;
|
||||
|
@ -55,7 +55,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase {
|
||||
public void testRecoverWhileUnderLoadAllocateReplicasTest() throws Exception {
|
||||
logger.info("--> creating test index ...");
|
||||
int numberOfShards = numberOfShards();
|
||||
assertAcked(prepareCreate("test", 1, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durabilty.ASYNC)));
|
||||
assertAcked(prepareCreate("test", 1, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durability.ASYNC)));
|
||||
|
||||
final int totalNumDocs = scaledRandomIntBetween(200, 10000);
|
||||
int waitFor = totalNumDocs / 10;
|
||||
@ -108,7 +108,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase {
|
||||
public void testRecoverWhileUnderLoadAllocateReplicasRelocatePrimariesTest() throws Exception {
|
||||
logger.info("--> creating test index ...");
|
||||
int numberOfShards = numberOfShards();
|
||||
assertAcked(prepareCreate("test", 1, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durabilty.ASYNC)));
|
||||
assertAcked(prepareCreate("test", 1, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durability.ASYNC)));
|
||||
|
||||
final int totalNumDocs = scaledRandomIntBetween(200, 10000);
|
||||
int waitFor = totalNumDocs / 10;
|
||||
@ -159,7 +159,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase {
|
||||
public void testRecoverWhileUnderLoadWithReducedAllowedNodes() throws Exception {
|
||||
logger.info("--> creating test index ...");
|
||||
int numberOfShards = numberOfShards();
|
||||
assertAcked(prepareCreate("test", 2, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durabilty.ASYNC)));
|
||||
assertAcked(prepareCreate("test", 2, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durability.ASYNC)));
|
||||
|
||||
final int totalNumDocs = scaledRandomIntBetween(200, 10000);
|
||||
int waitFor = totalNumDocs / 10;
|
||||
@ -230,7 +230,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase {
|
||||
final int numReplicas = 0;
|
||||
logger.info("--> creating test index ...");
|
||||
int allowNodes = 2;
|
||||
assertAcked(prepareCreate("test", 3, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numShards).put(SETTING_NUMBER_OF_REPLICAS, numReplicas).put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durabilty.ASYNC)));
|
||||
assertAcked(prepareCreate("test", 3, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numShards).put(SETTING_NUMBER_OF_REPLICAS, numReplicas).put(IndexSettings.INDEX_TRANSLOG_DURABILITY, Translog.Durability.ASYNC)));
|
||||
|
||||
final int numDocs = scaledRandomIntBetween(200, 9999);
|
||||
|
||||
|
@ -517,7 +517,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
||||
builder.put(IndexShard.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE, new ByteSizeValue(1, ByteSizeUnit.PB)); // just don't flush
|
||||
}
|
||||
if (random.nextBoolean()) {
|
||||
builder.put(IndexSettings.INDEX_TRANSLOG_DURABILITY, RandomPicks.randomFrom(random, Translog.Durabilty.values()));
|
||||
builder.put(IndexSettings.INDEX_TRANSLOG_DURABILITY, RandomPicks.randomFrom(random, Translog.Durability.values()));
|
||||
}
|
||||
|
||||
if (random.nextBoolean()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user