Deleting leftover shard on path with a different index UUID – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-8.9

Briefly, this error occurs when Elasticsearch detects leftover shards from a different index UUID on a data path. This could be due to a failed cleanup after deleting an index or a node recovery. To resolve this issue, you can manually delete the leftover shards if they are not needed. Alternatively, you can try restarting the Elasticsearch node to trigger an automatic cleanup. If the problem persists, consider reindexing the data and deleting the old index to ensure a clean state.

This guide will help you check for common problems that cause the log ” {} deleting leftover shard on path: [{}] with a different index UUID ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index, shard.

Log Context

Log “{} deleting leftover shard on path: [{}] with a different index UUID” classname is ShardPath.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        for (Path path : paths) {
            // EMPTY is safe here because we never call namedObject
            ShardStateMetadata load = ShardStateMetadata.FORMAT.loadLatestState(logger; NamedXContentRegistry.EMPTY; path);
            if (load != null) {
                if (load.indexUUID.equals(indexUUID) == false && IndexMetadata.INDEX_UUID_NA_VALUE.equals(load.indexUUID) == false) {
                    logger.warn("{} deleting leftover shard on path: [{}] with a different index UUID"; lock.getShardId(); path);
                    assert Files.isDirectory(path) : path + " is not a directory";
                    NodeEnvironment.acquireFSLockForPaths(indexSettings; path);
                    listener.accept(new Path[] { path });
                    IOUtils.rm(path);
                }

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?