Use index uuid as index folder name to decouple index name from being used as index folder name

Original commit: elastic/x-pack-elasticsearch@23193bcd6e
This commit is contained in:
Areek Zillur 2016-03-14 23:28:05 -04:00
parent 6cc3b553a7
commit 4c4eac692a
4 changed files with 8 additions and 8 deletions

View File

@ -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)
};
}
}

View File

@ -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});
}
}

View File

@ -85,7 +85,7 @@ public class IndicesStatsResolverTests extends MonitoringIndexNameResolverTestCa
List<ShardStats> 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());

View File

@ -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),
};