浏览代码

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).
Boaz Leskes 8 年之前
父节点
当前提交
c0e6dafcab
共有 1 个文件被更改,包括 0 次插入1 次删除
  1. 0 1
      core/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java

+ 0 - 1
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";