Skip to content

Commit

Permalink
use elasticsearch 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
grmblfrz committed Jun 4, 2014
1 parent 2bb019e commit 915c949
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</parent>

<properties>
<elasticsearch.version>1.1.0-SNAPSHOT</elasticsearch.version>
<elasticsearch.version>1.1.2</elasticsearch.version>
<zookeeper.version>3.4.6</zookeeper.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.sonian.elasticsearch.zookeeper.client.*;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlocks;
import org.elasticsearch.cluster.metadata.MetaData;
Expand Down Expand Up @@ -62,15 +63,18 @@ public class ZooKeeperClusterState extends AbstractLifecycleComponent<ZooKeeperC

private final DiscoveryNodesProvider nodesProvider;

private final ClusterName clusterName;

private final String clusterStateVersion = Version.CURRENT.number();

private volatile boolean watching = true;

public ZooKeeperClusterState(Settings settings, ZooKeeperEnvironment environment, ZooKeeperClient zooKeeperClient, DiscoveryNodesProvider nodesProvider) {
public ZooKeeperClusterState(Settings settings, ZooKeeperEnvironment environment, ZooKeeperClient zooKeeperClient, DiscoveryNodesProvider nodesProvider, ClusterName clusterName) {
super(settings);
this.zooKeeperClient = zooKeeperClient;
this.environment = environment;
this.nodesProvider = nodesProvider;
this.clusterName = clusterName;
initClusterStatePersistence();
}

Expand Down Expand Up @@ -167,7 +171,7 @@ public void onNodeDataChanged(String id) {
throw new ZooKeeperIncompatibleStateVersionException("Expected: " + clusterStateVersion() + ", actual: " + clusterStateVersion);
}

ClusterState.Builder builder = ClusterState.builder().version(buf.readLong());
ClusterState.Builder builder = ClusterState.builder(clusterName).version(buf.readLong());
for (ClusterStatePart<?> part : this.parts) {
builder = part.set(builder, buf.readString());
if (builder == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ private class ZooKeeperStatePublisher implements StatePublisher {
private final ZooKeeperClusterState zooKeeperClusterState;

public ZooKeeperStatePublisher(Settings settings, ZooKeeperEnvironment environment, ZooKeeperClient zooKeeperClient, DiscoveryNodesProvider nodesProvider) {
zooKeeperClusterState = new ZooKeeperClusterState(settings, environment, zooKeeperClient, nodesProvider);
zooKeeperClusterState = new ZooKeeperClusterState(settings, environment, zooKeeperClient, nodesProvider, clusterName);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private boolean deleteDirectory(File path) {


protected ClusterState testClusterState(RoutingTable routingTable, DiscoveryNodes nodes) {
return ClusterState.builder()
return ClusterState.builder(ClusterName.clusterNameFromSettings(defaultSettings))
.version(1234L)
.routingTable(routingTable)
.nodes(nodes)
Expand Down Expand Up @@ -232,7 +232,8 @@ public NodeService nodeService() {
return new ZooKeeperClusterState(defaultSettings(),
zooKeeperEnvironment(),
zk,
provider
provider,
ClusterName.clusterNameFromSettings(defaultSettings)
);
}
}
Expand All @@ -244,7 +245,7 @@ private class ZooKeeperClusterStateVersionOverride extends ZooKeeperClusterState
public ZooKeeperClusterStateVersionOverride(String clusterStateVersion, Settings settings,
ZooKeeperEnvironment environment, ZooKeeperClient zooKeeperClient,
DiscoveryNodesProvider nodesProvider) {
super(settings, environment, zooKeeperClient, nodesProvider);
super(settings, environment, zooKeeperClient, nodesProvider, ClusterName.clusterNameFromSettings(defaultSettings));
this.clusterStateVersion = clusterStateVersion;
}

Expand Down

0 comments on commit 915c949

Please sign in to comment.