SOLR-10278: special case of global tags were not taken care of

This commit is contained in:
Noble Paul 2017-05-02 18:26:31 +09:30
parent 83f8ed8634
commit 2818ee91dd
1 changed files with 26 additions and 14 deletions

View File

@ -96,9 +96,17 @@ public class Clause implements MapWriter, Comparable<Clause> {
@Override @Override
public int compareTo(Clause that) { public int compareTo(Clause that) {
try {
int v = Integer.compare(this.tag.op.priority, that.tag.op.priority); int v = Integer.compare(this.tag.op.priority, that.tag.op.priority);
if (v != 0) return v; if (v != 0) return v;
return Integer.compare(this.replica.op.priority, that.replica.op.priority); return this.isPerCollectiontag() && that.isPerCollectiontag() ?
Integer.compare(this.replica.op.priority, that.replica.op.priority) :
0;
} catch (NullPointerException e) {
System.out.println("this: " + Utils.toJSONString(this));
System.out.println("thAt: " + Utils.toJSONString(that));
throw e;
}
} }
static class Condition { static class Condition {
@ -164,6 +172,7 @@ public class Clause implements MapWriter, Comparable<Clause> {
TestStatus test(Row row) { TestStatus test(Row row) {
AtomicReference<TestStatus> result = new AtomicReference<>(NOT_APPLICABLE); AtomicReference<TestStatus> result = new AtomicReference<>(NOT_APPLICABLE);
if (isPerCollectiontag()) {
for (Map.Entry<String, Map<String, List<ReplicaInfo>>> colls : row.replicaInfo.entrySet()) { for (Map.Entry<String, Map<String, List<ReplicaInfo>>> colls : row.replicaInfo.entrySet()) {
if (result.get() == FAIL) break; if (result.get() == FAIL) break;
@ -177,6 +186,9 @@ public class Clause implements MapWriter, Comparable<Clause> {
} }
if (shard.val.equals(ANY)) testReplicaCount(row, result, count); if (shard.val.equals(ANY)) testReplicaCount(row, result, count);
} }
} else {
if (!tag.isPass(row)) result.set(TestStatus.FAIL);
}
if (result.get() == FAIL) row.violations.add(this); if (result.get() == FAIL) row.violations.add(this);
return result.get(); return result.get();