From 4c4eac692a902064701d6961c84262a658509d36 Mon Sep 17 00:00:00 2001 From: Areek Zillur Date: Mon, 14 Mar 2016 23:28:05 -0400 Subject: [PATCH] fix for elasticsearchelastic/elasticsearch#16442 Use index uuid as index folder name to decouple index name from being used as index folder name Original commit: elastic/x-pack-elasticsearch@23193bcd6e9ddce24f8ead80d9245627c23706a6 --- .../agent/resolver/cluster/ClusterStatsResolverTests.java | 4 ++-- .../agent/resolver/indices/IndexStatsResolverTests.java | 4 ++-- .../agent/resolver/indices/IndicesStatsResolverTests.java | 4 ++-- .../marvel/agent/resolver/node/NodeStatsResolverTests.java | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/cluster/ClusterStatsResolverTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/cluster/ClusterStatsResolverTests.java index 44ee1ffa3d8..4948b53ee8d 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/cluster/ClusterStatsResolverTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/cluster/ClusterStatsResolverTests.java @@ -132,14 +132,14 @@ public class ClusterStatsResolverTests extends MonitoringIndexNameResolverTestCa */ private ShardStats[] randomShardStats() { Index index = new Index("test", UUID.randomUUID().toString()); - Path shardPath = createTempDir().resolve("indices").resolve("test").resolve("0"); + Path shardPath = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("0"); ShardRouting shardRouting = ShardRouting.newUnassigned(index, 0, null, false, new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "foo")); CommonStats shardCommonStats = new CommonStats(); shardCommonStats.fieldData = new FieldDataStats(); shardCommonStats.queryCache = new QueryCacheStats(); return new ShardStats[]{ - new ShardStats(shardRouting, new ShardPath(false, shardPath, shardPath, "", new ShardId(index, 0)), shardCommonStats, null) + new ShardStats(shardRouting, new ShardPath(false, shardPath, shardPath, new ShardId(index, 0)), shardCommonStats, null) }; } } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndexStatsResolverTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndexStatsResolverTests.java index 5a6542c6a0d..01acb74f3d2 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndexStatsResolverTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndexStatsResolverTests.java @@ -77,7 +77,7 @@ public class IndexStatsResolverTests extends MonitoringIndexNameResolverTestCase private IndexStats randomIndexStats() { Index index = new Index("test-" + randomIntBetween(0, 5), UUID.randomUUID().toString()); ShardId shardId = new ShardId(index, 0); - Path path = createTempDir().resolve("indices").resolve(index.getName()).resolve("0"); + Path path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("0"); ShardRouting shardRouting = ShardRouting.newUnassigned(index, 0, null, true, new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null)); ShardRoutingTestUtils.initialize(shardRouting, "node-0"); @@ -92,7 +92,7 @@ public class IndexStatsResolverTests extends MonitoringIndexNameResolverTestCase stats.segments = new SegmentsStats(); stats.merge = new MergeStats(); stats.refresh = new RefreshStats(); - ShardStats shardStats = new ShardStats(shardRouting, new ShardPath(false, path, path, null, shardId), stats, null); + ShardStats shardStats = new ShardStats(shardRouting, new ShardPath(false, path, path, shardId), stats, null); return new IndexStats(index.getName(), new ShardStats[]{shardStats}); } } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndicesStatsResolverTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndicesStatsResolverTests.java index d94307c59b2..a702eab9410 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndicesStatsResolverTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndicesStatsResolverTests.java @@ -85,7 +85,7 @@ public class IndicesStatsResolverTests extends MonitoringIndexNameResolverTestCa List shardStats = new ArrayList<>(); for (int i=0; i < randomIntBetween(2, 5); i++) { ShardId shardId = new ShardId(index, i); - Path path = createTempDir().resolve("indices").resolve(index.getName()).resolve(String.valueOf(i)); + Path path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve(String.valueOf(i)); ShardRouting shardRouting = ShardRouting.newUnassigned(index, i, null, true, new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null)); ShardRoutingTestUtils.initialize(shardRouting, "node-0"); @@ -100,7 +100,7 @@ public class IndicesStatsResolverTests extends MonitoringIndexNameResolverTestCa stats.segments = new SegmentsStats(); stats.merge = new MergeStats(); stats.refresh = new RefreshStats(); - shardStats.add(new ShardStats(shardRouting, new ShardPath(false, path, path, null, shardId), stats, null)); + shardStats.add(new ShardStats(shardRouting, new ShardPath(false, path, path, shardId), stats, null)); } return IndicesStatsResponseTestUtils.newIndicesStatsResponse(shardStats.toArray(new ShardStats[shardStats.size()]), shardStats.size(), shardStats.size(), 0, emptyList()); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/node/NodeStatsResolverTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/node/NodeStatsResolverTests.java index bac23b49897..4fe42eec663 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/node/NodeStatsResolverTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/node/NodeStatsResolverTests.java @@ -103,7 +103,7 @@ public class NodeStatsResolverTests extends MonitoringIndexNameResolverTestCase< private NodeStats randomNodeStats() { Index index = new Index("test-" + randomIntBetween(0, 5), UUID.randomUUID().toString()); ShardId shardId = new ShardId(index, 0); - Path path = createTempDir().resolve("indices").resolve(index.getName()).resolve("0"); + Path path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("0"); ShardRouting shardRouting = ShardRouting.newUnassigned(index, 0, null, true, new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null)); ShardRoutingTestUtils.initialize(shardRouting, "node-0"); @@ -116,7 +116,7 @@ public class NodeStatsResolverTests extends MonitoringIndexNameResolverTestCase< stats.indexing = new IndexingStats(); stats.search = new SearchStats(); stats.segments = new SegmentsStats(); - ShardStats shardStats = new ShardStats(shardRouting, new ShardPath(false, path, path, null, shardId), stats, null); + ShardStats shardStats = new ShardStats(shardRouting, new ShardPath(false, path, path, shardId), stats, null); FsInfo.Path[] pathInfo = new FsInfo.Path[]{ new FsInfo.Path("/test", "/dev/sda", 10, -8, 0), };