summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/index/shard/ShardPath.java
diff options
context:
space:
mode:
authorBoaz Leskes <b.leskes@gmail.com>2016-01-24 22:47:38 +0100
committerBoaz Leskes <b.leskes@gmail.com>2016-01-28 08:40:10 +0100
commit2a137b554825a5f848cfaff6311d7c298fd76fe7 (patch)
treefb78f310d01f855d9ae4fb4951c21332882f6d25 /core/src/main/java/org/elasticsearch/index/shard/ShardPath.java
parent8c5171fac85b940948cc543c3a4686ef1f173cd3 (diff)
Make index uuid available in Index, ShardRouting & ShardId
In the early days Elasticsearch used to use the index name as the index identity. Around 1.0.0 we introduced a unique index uuid which is stored in the index setting. Since then we used that uuid in a few places but it is by far not the main identifier when working with indices, partially because it's not always readily available in all places. This PR start to make a move in the direction of using uuids instead of name by making sure that the uuid is available on the Index class (currently just a wrapper around the name) and as such also available via ShardRouting and ShardId. Note that this is by no means an attempt to do the right thing with the uuid in all places. In almost all places it falls back to the name based comparison that was done before. It is meant as a first step towards slowly improving the situation. Closes #16217
Diffstat (limited to 'core/src/main/java/org/elasticsearch/index/shard/ShardPath.java')
-rw-r--r--core/src/main/java/org/elasticsearch/index/shard/ShardPath.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/src/main/java/org/elasticsearch/index/shard/ShardPath.java b/core/src/main/java/org/elasticsearch/index/shard/ShardPath.java
index d940d1a93c..e870057a14 100644
--- a/core/src/main/java/org/elasticsearch/index/shard/ShardPath.java
+++ b/core/src/main/java/org/elasticsearch/index/shard/ShardPath.java
@@ -45,8 +45,8 @@ public final class ShardPath {
public ShardPath(boolean isCustomDataPath, Path dataPath, Path shardStatePath, String indexUUID, ShardId shardId) {
assert dataPath.getFileName().toString().equals(Integer.toString(shardId.id())) : "dataPath must end with the shard ID but didn't: " + dataPath.toString();
assert shardStatePath.getFileName().toString().equals(Integer.toString(shardId.id())) : "shardStatePath must end with the shard ID but didn't: " + dataPath.toString();
- assert dataPath.getParent().getFileName().toString().equals(shardId.getIndex()) : "dataPath must end with index/shardID but didn't: " + dataPath.toString();
- assert shardStatePath.getParent().getFileName().toString().equals(shardId.getIndex()) : "shardStatePath must end with index/shardID but didn't: " + dataPath.toString();
+ assert dataPath.getParent().getFileName().toString().equals(shardId.getIndexName()) : "dataPath must end with index/shardID but didn't: " + dataPath.toString();
+ assert shardStatePath.getParent().getFileName().toString().equals(shardId.getIndexName()) : "shardStatePath must end with index/shardID but didn't: " + dataPath.toString();
if (isCustomDataPath && dataPath.equals(shardStatePath)) {
throw new IllegalArgumentException("shard state path must be different to the data path when using custom data paths");
}