Skip to content

Commit

Permalink
Remove NoneGateway, NoneGatewayAllocator, & NoneGatewayModule
Browse files Browse the repository at this point in the history
Always use the LocalGateway* equivalents

We already check in the LocalGateway whether a node is a client node, or
is not master-eligible, and skip writing the state there. This allows us
to remove this code that was previously used only for tribe nodes (which
are not master eligible anyway and wouldn't write state) and in
tests (which can shake more bugs out)
  • Loading branch information
dakrone committed Nov 24, 2014
1 parent dfb6d60 commit e482bdd
Show file tree
Hide file tree
Showing 31 changed files with 55 additions and 605 deletions.
6 changes: 1 addition & 5 deletions config/elasticsearch.yml
Expand Up @@ -239,13 +239,9 @@
# in the gateway, and when the cluster starts up for the first time,
# it will read its state from the gateway.

# There are several types of gateway implementations. For more information, see
# For more information, see
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-gateway.html>.

# The default gateway type is the "local" gateway (recommended):
#
#gateway.type: local

# Settings below control how and when to start the initial recovery process on
# a full cluster restart (to reuse as much local data as possible when using shared
# gateway).
Expand Down
12 changes: 6 additions & 6 deletions docs/reference/modules/gateway.asciidoc
Expand Up @@ -11,16 +11,16 @@ added or deleted), those changes will be persisted using the gateway.
When the cluster first starts up, the state will be read from the
gateway and applied.

The gateway set on the node level will automatically control the index
gateway that will be used. For example, if the `local` gateway is used,
then automatically, each index created on the node will also use its own
respective index level `local` gateway. In this case, if an index should
not persist its state, it should be explicitly set to `none` (which is
the only other value it can be set to).
The gateway set on the node level will automatically control the index gateway
that will be used. For example, if the `local` gateway is used (the default),
then each index created on the node will automatically use its own respective
index level `local` gateway.

The default gateway used is the
<<modules-gateway-local,local>> gateway.

The `none` gateway option was removed in Elasticsearch 2.0.

[float]
[[recover-after]]
=== Recovery After Nodes / Time
Expand Down
Expand Up @@ -21,7 +21,7 @@

import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.gateway.none.NoneGatewayAllocator;
import org.elasticsearch.gateway.local.LocalGatewayAllocator;

/**
*/
Expand All @@ -37,7 +37,7 @@ public class ShardsAllocatorModule extends AbstractModule {

private Class<? extends ShardsAllocator> shardsAllocator;

private Class<? extends GatewayAllocator> gatewayAllocator = NoneGatewayAllocator.class;
private Class<? extends GatewayAllocator> gatewayAllocator = LocalGatewayAllocator.class;

public ShardsAllocatorModule(Settings settings) {
this.settings = settings;
Expand Down
Expand Up @@ -21,15 +21,13 @@

import org.elasticsearch.cluster.routing.MutableShardRouting;
import org.elasticsearch.cluster.routing.RoutingNode;
import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.allocation.FailedRerouteAllocation;
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
import org.elasticsearch.cluster.routing.allocation.StartedRerouteAllocation;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.gateway.none.NoneGatewayAllocator;

/**
* The {@link ShardsAllocator} class offers methods for allocating shard within a cluster.
Expand All @@ -41,12 +39,12 @@ public class ShardsAllocators extends AbstractComponent implements ShardsAllocat
private final GatewayAllocator gatewayAllocator;
private final ShardsAllocator allocator;

public ShardsAllocators() {
this(ImmutableSettings.Builder.EMPTY_SETTINGS);
public ShardsAllocators(GatewayAllocator allocator) {
this(ImmutableSettings.Builder.EMPTY_SETTINGS, allocator);
}

public ShardsAllocators(Settings settings) {
this(settings, new NoneGatewayAllocator(), new BalancedShardsAllocator(settings));
public ShardsAllocators(Settings settings, GatewayAllocator allocator) {
this(settings, allocator, new BalancedShardsAllocator(settings));
}

@Inject
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/elasticsearch/gateway/GatewayModule.java
Expand Up @@ -32,6 +32,8 @@
*/
public class GatewayModule extends AbstractModule implements SpawnModules {

public static String GATEWAY_TYPE_SETTING = "gateway.type";

private final Settings settings;

public GatewayModule(Settings settings) {
Expand All @@ -40,7 +42,8 @@ public GatewayModule(Settings settings) {

@Override
public Iterable<? extends Module> spawnModules() {
return ImmutableList.of(Modules.createModule(settings.getAsClass("gateway.type", LocalGatewayModule.class, "org.elasticsearch.gateway.", "GatewayModule"), settings));
Class gateway = settings.getAsClass(GATEWAY_TYPE_SETTING, LocalGatewayModule.class, "org.elasticsearch.gateway.", "GatewayModule");
return ImmutableList.of(Modules.createModule(gateway, settings));
}

@Override
Expand Down
134 changes: 0 additions & 134 deletions src/main/java/org/elasticsearch/gateway/none/NoneGateway.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit e482bdd

Please sign in to comment.