Skip to content

Commit

Permalink
clean up logic
Browse files Browse the repository at this point in the history
  • Loading branch information
talevy committed Jun 25, 2018
1 parent 3124312 commit dbb6319
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,13 @@ void addIndex(IndexMetaData indexMetaData) {
}

public void computeAndValidateWriteIndex() {
final List<IndexMetaData> writeIndices;
if (referenceIndexMetaDatas.size() > 1) {
writeIndices = referenceIndexMetaDatas.stream()
.filter(idxMeta -> Boolean.TRUE.equals(idxMeta.getAliases().get(aliasName).writeIndex()))
.collect(Collectors.toList());
} else if(Boolean.FALSE.equals(referenceIndexMetaDatas.get(0).getAliases().get(aliasName).writeIndex()) == false) {
writeIndices = Collections.singletonList(referenceIndexMetaDatas.get(0));
} else {
writeIndices = Collections.emptyList();
List<IndexMetaData> writeIndices = referenceIndexMetaDatas.stream()
.filter(idxMeta -> Boolean.TRUE.equals(idxMeta.getAliases().get(aliasName).writeIndex()))
.collect(Collectors.toList());

if (writeIndices.isEmpty() && referenceIndexMetaDatas.size() == 1
&& referenceIndexMetaDatas.get(0).getAliases().get(aliasName).writeIndex() == null) {
writeIndices.add(referenceIndexMetaDatas.get(0));
}

if (writeIndices.size() == 1) {
Expand Down

0 comments on commit dbb6319

Please sign in to comment.