Failed to get the total docs from the safe commit use the total docs from the previous safe commit – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.17-8.9

Briefly, this error occurs when Elasticsearch is unable to retrieve the total number of documents from the current safe commit and instead uses the total from the previous safe commit. This could be due to issues with the commit process or data corruption. To resolve this, you could try to manually force a new commit, check for any underlying hardware or network issues that could be causing data corruption, or restore the data from a backup if the issue persists.

This guide will help you check for common problems that cause the log ” failed to get the total docs from the safe commit; use the total docs from the previous safe commit ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index.

Log Context

Log “failed to get the total docs from the safe commit; use the total docs from the previous safe commit” classname is CombinedDeletionPolicy.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        final IndexCommit safeCommit = commits.get(keptPosition);
        int totalDocsOfSafeCommit;
        try {
            totalDocsOfSafeCommit = getDocCountOfCommit(safeCommit);
        } catch (IOException ex) {
            logger.info("failed to get the total docs from the safe commit; use the total docs from the previous safe commit"; ex);
            totalDocsOfSafeCommit = safeCommitInfo.docCount;
        }
        IndexCommit newCommit = null;
        IndexCommit previousLastCommit = null;
        List deletedCommits = null;

 

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?