SyncFlush is only allowed if the engine is not recovery – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.4

Briefly, this error occurs when an attempt is made to perform a syncFlush operation while the Elasticsearch engine is in recovery mode. SyncFlush is a process that helps to reduce recovery time when a shard goes inactive. However, it cannot be performed during recovery. To resolve this issue, you can either wait for the recovery process to complete before initiating syncFlush, or you can manually stop the recovery process, perform the syncFlush, and then resume recovery. However, the latter option should be used with caution as it may lead to data loss.

This guide will help you check for common problems that cause the log ” syncFlush is only allowed if the engine is not recovery ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index, shard, flush, recovery.

Log Context

Log “syncFlush is only allowed if the engine is not recovery” class name is IndexShard.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 public Engine.SyncedFlushResult syncFlush(String syncId; Engine.CommitId expectedCommitId) {
 verifyNotClosed();
 logger.trace("trying to sync flush. sync id [{}]. expected commit id [{}]]"; syncId; expectedCommitId);
 Engine engine = getEngine();
 if (engine.isRecovering()) {
 throw new IllegalIndexShardStateException(shardId(); state; "syncFlush is only allowed if the engine is not recovery" +
 " from translog");
 }
 return engine.syncFlush(syncId; expectedCommitId);
 }

 

 [ratemypost]