Remove no existing commits assertion in onInit()

This assertion does not hold if a shard is recovered from an empty store
but failed then retries. Moreover, if the openMode is CREATE_INDEX_*, we
pass CREATE mode to the IndexWriterConfig to create a new index and
overwrite the existing one.

Closes #27960
This commit is contained in:
Nhat Nguyen 2017-12-22 15:03:25 -05:00
parent 0375d887f2
commit 6435928c4f
1 changed files with 0 additions and 1 deletions

View File

@ -53,7 +53,6 @@ final class CombinedDeletionPolicy extends IndexDeletionPolicy {
public void onInit(List<? extends IndexCommit> commits) throws IOException { public void onInit(List<? extends IndexCommit> commits) throws IOException {
switch (openMode) { switch (openMode) {
case CREATE_INDEX_AND_TRANSLOG: case CREATE_INDEX_AND_TRANSLOG:
assert commits.isEmpty() : "index is created, but we have commits";
break; break;
case OPEN_INDEX_CREATE_TRANSLOG: case OPEN_INDEX_CREATE_TRANSLOG:
assert commits.isEmpty() == false : "index is opened, but we have no commits"; assert commits.isEmpty() == false : "index is opened, but we have no commits";