From 97d9e1cb8dad12d751ca1c37813c0b3e0af5b4b6 Mon Sep 17 00:00:00 2001 From: Nitish Goyal Date: Wed, 2 Feb 2022 09:26:41 +0530 Subject: [PATCH] Revert "Commented cluster re route job" This reverts commit b686f1b2e5f3e0042e85f7114236fc3241791a89. --- config/local.yml | 9 +++++---- .../core/reroute/ClusterRerouteManager.java | 10 +++------- .../server/resources/ESClusterResource.java | 5 ++++- .../response/FoxtrotIndicesStatsResponse.java | 20 +++++++++++++++++++ 4 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 foxtrot-server/src/main/java/com/flipkart/foxtrot/server/utils/response/FoxtrotIndicesStatsResponse.java diff --git a/config/local.yml b/config/local.yml index 20283fd7d..46df5b1a1 100755 --- a/config/local.yml +++ b/config/local.yml @@ -8,8 +8,8 @@ server: elasticsearch: hosts: - - stg-es201.phonepe.nb6 - cluster: stg-es67xx + - localhost + cluster: foxtrot tableNamePrefix: foxtrot getQueryTimeout: 10000 connectionType: HTTP @@ -18,10 +18,10 @@ elasticsearch: hbase: secure : false tableName: foxtrot - hbaseZookeeperQuorum: stg-hdp201.phonepe.nb6:2181 + hbaseZookeeperQuorum: localhost:2181 hbaseZookeeperClientPort: 2181 seggregatedTablePrefix: foxtrot- - hbaseZookeeperZnodeParent: /hbase-unsecure + hbaseZookeeperZnodeParent: /hbase-test cluster: name: foxtrot @@ -48,6 +48,7 @@ cardinality: elasticsearchTuningConfig: precisionThreshold: 500 aggregationSize: 10000 + scrollSize: 100 scrollTimeInSeconds: 120 documentsLimitAllowed: 10000 diff --git a/foxtrot-core/src/main/java/com/flipkart/foxtrot/core/reroute/ClusterRerouteManager.java b/foxtrot-core/src/main/java/com/flipkart/foxtrot/core/reroute/ClusterRerouteManager.java index 2506918ab..cdb6b9dbb 100644 --- a/foxtrot-core/src/main/java/com/flipkart/foxtrot/core/reroute/ClusterRerouteManager.java +++ b/foxtrot-core/src/main/java/com/flipkart/foxtrot/core/reroute/ClusterRerouteManager.java @@ -17,7 +17,6 @@ import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteResponse; import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; import org.elasticsearch.client.Request; -import org.elasticsearch.client.Response; import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand; import org.elasticsearch.index.shard.ShardId; import org.joda.time.DateTime; @@ -49,9 +48,7 @@ public ClusterRerouteManager( this.mapper = mapper; } - //TODO This needs fixing to correspond to changed response from java high level client - - /*public void reallocate() { + public void reallocate() { Map nodeIdVsNodeInfoMap = new HashMap<>(); BiMap nodeNameVsNodeId = HashBiMap.create(); this.createNodeInfoMap(nodeIdVsNodeInfoMap); @@ -109,10 +106,9 @@ private boolean reallocateShard(ShardId shardId, String fromNode, String toNode) private void createNodeInfoMap(Map nodeIdVsNodeInfoMap) { nodeIdVsNodeInfoMap.clear(); val request = new Request("GET", "/_stats"); - Response response = connection.getClient() + val response = connection.getClient() .getLowLevelClient() .performRequest(request); - val indicesStatsResponse = mapper.readValue(EntityUtils.toString(response.getEntity()), IndicesStatsResponse.class); Arrays.stream(indicesStatsResponse.getShards()) @@ -183,6 +179,6 @@ private Deque getVacantNodeId( } } return vacantNodeIds; - }*/ + } } diff --git a/foxtrot-server/src/main/java/com/flipkart/foxtrot/server/resources/ESClusterResource.java b/foxtrot-server/src/main/java/com/flipkart/foxtrot/server/resources/ESClusterResource.java index 2a0423af7..935bdbb73 100644 --- a/foxtrot-server/src/main/java/com/flipkart/foxtrot/server/resources/ESClusterResource.java +++ b/foxtrot-server/src/main/java/com/flipkart/foxtrot/server/resources/ESClusterResource.java @@ -2,13 +2,16 @@ import com.flipkart.foxtrot.core.reroute.ClusterRerouteManager; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import ru.vyarus.dropwizard.guice.module.installer.order.Order; + import javax.inject.Inject; import javax.inject.Singleton; import javax.ws.rs.Consumes; +import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; -import ru.vyarus.dropwizard.guice.module.installer.order.Order; /*** Created by mudit.g on Sep, 2019 diff --git a/foxtrot-server/src/main/java/com/flipkart/foxtrot/server/utils/response/FoxtrotIndicesStatsResponse.java b/foxtrot-server/src/main/java/com/flipkart/foxtrot/server/utils/response/FoxtrotIndicesStatsResponse.java new file mode 100644 index 000000000..78a0468d7 --- /dev/null +++ b/foxtrot-server/src/main/java/com/flipkart/foxtrot/server/utils/response/FoxtrotIndicesStatsResponse.java @@ -0,0 +1,20 @@ +package com.flipkart.foxtrot.server.utils.response; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; + +import java.util.Map; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class FoxtrotIndicesStatsResponse { + + private IndicesStatsResponse indicesStatsResponse; + private Map tableColumnCount; + +}