From c0e6dafcab53e88f0aff032bd93e8f45e5a82455 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Tue, 18 Jul 2017 17:22:38 +0200 Subject: [PATCH] CombinedDeletionPolicy can't assert it has no commits when creating an index This is an appealing assertion, but there scenarios where it can happen under normal operations. For example, when an index is created it may run into an exception when the lucene files have already been created. The master will try to assign the shard to another node (it's empty, so no need to look for data) but if there is no other node, it will reassign it to the same node. At that point the deletion will get a list of existing commits (which it will typically delete). --- .../org/elasticsearch/index/engine/CombinedDeletionPolicy.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java b/core/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java index 69173cc4216..add4a443903 100644 --- a/core/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java +++ b/core/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java @@ -51,7 +51,6 @@ class CombinedDeletionPolicy extends IndexDeletionPolicy { indexDeletionPolicy.onInit(commits); switch (openMode) { case CREATE_INDEX_AND_TRANSLOG: - assert commits.isEmpty() : "index is being created but we already have commits"; break; case OPEN_INDEX_CREATE_TRANSLOG: assert commits.isEmpty() == false : "index is opened, but we have no commits";