Skip to content

Commit

Permalink
Fix build failure after main merge
Browse files Browse the repository at this point in the history
Signed-off-by: Shivansh Arora <[email protected]>
  • Loading branch information
shiv0408 committed Jan 8, 2024
1 parent 93a548b commit 89c1143
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.opensearch.core.index.shard.ShardId;
import org.opensearch.env.NodeEnvironment;
import org.opensearch.index.shard.ShardPath;
import org.opensearch.indices.store.ShardAttributes;
import org.opensearch.test.OpenSearchIntegTestCase;

import java.io.IOException;
Expand All @@ -39,14 +40,14 @@ public class TransportNodesListGatewayStartedBatchShardsIT extends OpenSearchInt

public void testSingleShardFetch() throws Exception {
String indexName = "test";
Map<ShardId, String> shardIdCustomDataPathMap = prepareRequestMap(new String[] { indexName }, 1);
Map<ShardId, ShardAttributes> shardIdShardAttributesMap = prepareRequestMap(new String[] { indexName }, 1);

ClusterSearchShardsResponse searchShardsResponse = client().admin().cluster().prepareSearchShards(indexName).get();

TransportNodesListGatewayStartedBatchShards.NodesGatewayStartedShardsBatch response;
response = ActionTestUtils.executeBlocking(
internalCluster().getInstance(TransportNodesListGatewayStartedBatchShards.class),
new TransportNodesListGatewayStartedBatchShards.Request(searchShardsResponse.getNodes(), shardIdCustomDataPathMap)
new TransportNodesListGatewayStartedBatchShards.Request(searchShardsResponse.getNodes(), shardIdShardAttributesMap)
);
final Index index = resolveIndex(indexName);
final ShardId shardId = new ShardId(index, 0);
Expand All @@ -63,7 +64,7 @@ public void testShardFetchMultiNodeMultiIndexes() throws Exception {
String indexName1 = "test1";
String indexName2 = "test2";
// assign one primary shard each to the data nodes
Map<ShardId, String> shardIdCustomDataPathMap = prepareRequestMap(
Map<ShardId, ShardAttributes> shardIdShardAttributesMap = prepareRequestMap(
new String[] { indexName1, indexName2 },
internalCluster().numDataNodes()
);
Expand All @@ -72,7 +73,7 @@ public void testShardFetchMultiNodeMultiIndexes() throws Exception {
TransportNodesListGatewayStartedBatchShards.NodesGatewayStartedShardsBatch response;
response = ActionTestUtils.executeBlocking(
internalCluster().getInstance(TransportNodesListGatewayStartedBatchShards.class),
new TransportNodesListGatewayStartedBatchShards.Request(searchShardsResponse.getNodes(), shardIdCustomDataPathMap)
new TransportNodesListGatewayStartedBatchShards.Request(searchShardsResponse.getNodes(), shardIdShardAttributesMap)
);
for (ClusterSearchShardsGroup clusterSearchShardsGroup : searchShardsResponse.getGroups()) {
ShardId shardId = clusterSearchShardsGroup.getShardId();
Expand All @@ -88,7 +89,7 @@ public void testShardFetchMultiNodeMultiIndexes() throws Exception {

public void testShardFetchCorruptedShards() throws Exception {
String indexName = "test";
Map<ShardId, String> shardIdCustomDataPathMap = prepareRequestMap(new String[] { indexName }, 1);
Map<ShardId, ShardAttributes> shardIdShardAttributesMap = prepareRequestMap(new String[] { indexName }, 1);
ClusterSearchShardsResponse searchShardsResponse = client().admin().cluster().prepareSearchShards(indexName).get();
final Index index = resolveIndex(indexName);
final ShardId shardId = new ShardId(index, 0);
Expand All @@ -97,7 +98,7 @@ public void testShardFetchCorruptedShards() throws Exception {
internalCluster().restartNode(searchShardsResponse.getNodes()[0].getName());
response = ActionTestUtils.executeBlocking(
internalCluster().getInstance(TransportNodesListGatewayStartedBatchShards.class),
new TransportNodesListGatewayStartedBatchShards.Request(getDiscoveryNodes(), shardIdCustomDataPathMap)
new TransportNodesListGatewayStartedBatchShards.Request(getDiscoveryNodes(), shardIdShardAttributesMap)
);
DiscoveryNode[] discoveryNodes = getDiscoveryNodes();
TransportNodesListGatewayStartedBatchShards.NodeGatewayStartedShard nodeGatewayStartedShards = response.getNodesMap()
Expand Down Expand Up @@ -137,8 +138,8 @@ private void prepareIndex(String indexName, int numberOfPrimaryShards) {
flush(indexName);
}

private Map<ShardId, String> prepareRequestMap(String[] indices, int primaryShardCount) {
Map<ShardId, String> shardIdCustomDataPathMap = new HashMap<>();
private Map<ShardId, ShardAttributes> prepareRequestMap(String[] indices, int primaryShardCount) {
Map<ShardId, ShardAttributes> shardIdShardAttributesMap = new HashMap<>();
for (String indexName : indices) {
prepareIndex(indexName, primaryShardCount);
final Index index = resolveIndex(indexName);
Expand All @@ -147,10 +148,10 @@ private Map<ShardId, String> prepareRequestMap(String[] indices, int primaryShar
);
for (int shardIdNum = 0; shardIdNum < primaryShardCount; shardIdNum++) {
final ShardId shardId = new ShardId(index, shardIdNum);
shardIdCustomDataPathMap.put(shardId, customDataPath);
shardIdShardAttributesMap.put(shardId, new ShardAttributes(shardId, customDataPath));
}
}
return shardIdCustomDataPathMap;
return shardIdShardAttributesMap;
}

private void corruptShard(String nodeName, ShardId shardId) throws IOException, InterruptedException {
Expand Down

0 comments on commit 89c1143

Please sign in to comment.