Skip to content

Commit fadf53a

Browse files
authored
More descriptive exception in OldLuceneVersions (elastic#92986)
If we encounter an index that cannot be read by the archive indices feature then today it's reported as a corrupt index, which typically sends users down the wrong troubleshooting path. Although this shouldn't happen, in practice it does sometimes, so this commit adds a descriptive message to the exception with a link to some docs.
1 parent 4af9792 commit fadf53a

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

server/src/main/java/org/elasticsearch/common/ReferenceDocs.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public enum ReferenceDocs {
3434
UNSTABLE_CLUSTER_TROUBLESHOOTING,
3535
LAGGING_NODE_TROUBLESHOOTING,
3636
CONCURRENT_REPOSITORY_WRITERS,
37+
ARCHIVE_INDICES,
3738
// this comment keeps the ';' on the next line so every entry above has a trailing ',' which makes the diff for adding new links cleaner
3839
;
3940

server/src/main/resources/org/elasticsearch/common/reference-docs-links.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"DISCOVERY_TROUBLESHOOTING": "discovery-troubleshooting.html",
44
"UNSTABLE_CLUSTER_TROUBLESHOOTING": "cluster-fault-detection.html#cluster-fault-detection-troubleshooting",
55
"LAGGING_NODE_TROUBLESHOOTING": "cluster-fault-detection.html#_diagnosing_lagging_nodes",
6-
"CONCURRENT_REPOSITORY_WRITERS": "add-repository.html"
6+
"CONCURRENT_REPOSITORY_WRITERS": "add-repository.html",
7+
"ARCHIVE_INDICES": "archive-indices.html"
78
}

x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/OldLuceneVersions.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import org.elasticsearch.cluster.routing.allocation.AllocationService;
2222
import org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider;
2323
import org.elasticsearch.cluster.service.ClusterService;
24+
import org.elasticsearch.common.ReferenceDocs;
25+
import org.elasticsearch.common.Strings;
2426
import org.elasticsearch.common.UUIDs;
2527
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
2628
import org.elasticsearch.common.lucene.Lucene;
@@ -191,7 +193,17 @@ private static void convertToNewFormat(IndexShard indexShard) {
191193
// clean older segments file
192194
Lucene.pruneUnreferencedFiles(segmentInfos.getSegmentsFileName(), indexShard.store().directory());
193195
} catch (IOException e) {
194-
throw new UncheckedIOException(e);
196+
throw new UncheckedIOException(
197+
Strings.format(
198+
"""
199+
Elasticsearch version [{}] has limited support for indices created in version [{}] but this index could not be \
200+
read. It may be using an unsupported feature, or it may be damaged or corrupt. See {} for further information.""",
201+
Version.CURRENT,
202+
IndexMetadata.SETTING_INDEX_VERSION_CREATED.get(indexShard.indexSettings().getSettings()),
203+
ReferenceDocs.ARCHIVE_INDICES
204+
),
205+
e
206+
);
195207
} finally {
196208
indexShard.store().decRef();
197209
}

0 commit comments

Comments
 (0)