SOLR-11080: Unused field Row.violations

This commit is contained in:
Noble Paul 2017-07-14 17:17:08 +09:30
parent 2590a430f5
commit ee53334608
4 changed files with 3 additions and 8 deletions

View File

@ -49,7 +49,6 @@ class AddReplicaSuggester extends Suggester {
if (!row.isLive) continue;
if (!isAllowed(row.node, Hint.TARGET_NODE)) continue;
Row tmpRow = row.addReplica(coll, shard, type);
tmpRow.violations.clear();
List<Clause.Violation> errs = testChangedMatrix(strict, getModifiedMatrix(getMatrix(), tmpRow, i));
if (!containsNewErrors(errs)) {

View File

@ -51,7 +51,6 @@ public class MoveReplicaSuggester extends Suggester {
//no such replica available
continue;
}
tmpRow.violations.clear();
final int i = getMatrix().indexOf(fromRow);
for (int j = getMatrix().size() - 1; j > i; j--) {
@ -59,7 +58,6 @@ public class MoveReplicaSuggester extends Suggester {
if(!targetRow.isLive) continue;
if (!isAllowed(targetRow.node, Hint.TARGET_NODE)) continue;
targetRow = targetRow.addReplica(coll, shard, replicaInfo.type);
targetRow.violations.clear();
List<Violation> errs = testChangedMatrix(strict, getModifiedMatrix(getModifiedMatrix(getMatrix(), tmpRow, i), targetRow, j));
if (!containsNewErrors(errs) && isLessSerious(errs, leastSeriousViolation)) {
leastSeriousViolation = errs;

View File

@ -38,7 +38,6 @@ public class Row implements MapWriter {
public final String node;
final Cell[] cells;
public Map<String, Map<String, List<ReplicaInfo>>> collectionVsShardVsReplicas;
List<Clause> violations = new ArrayList<>();
boolean anyValueMissing = false;
boolean isLive = true;
@ -58,7 +57,7 @@ public class Row implements MapWriter {
}
public Row(String node, Cell[] cells, boolean anyValueMissing, Map<String,
Map<String, List<ReplicaInfo>>> collectionVsShardVsReplicas, List<Clause> violations, boolean isLive) {
Map<String, List<ReplicaInfo>>> collectionVsShardVsReplicas, boolean isLive) {
this.node = node;
this.isLive = isLive;
this.cells = new Cell[cells.length];
@ -68,7 +67,6 @@ public class Row implements MapWriter {
}
this.anyValueMissing = anyValueMissing;
this.collectionVsShardVsReplicas = collectionVsShardVsReplicas;
this.violations = violations;
}
@Override
@ -80,7 +78,7 @@ public class Row implements MapWriter {
}
Row copy() {
return new Row(node, cells, anyValueMissing, Utils.getDeepCopy(collectionVsShardVsReplicas, 3), new ArrayList<>(violations), isLive);
return new Row(node, cells, anyValueMissing, Utils.getDeepCopy(collectionVsShardVsReplicas, 3), isLive);
}
Object getVal(String name) {

View File

@ -588,7 +588,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testRow() {
Row row = new Row("nodex", new Cell[]{new Cell(0, "node", "nodex")}, false, new HashMap<>(), new ArrayList<>(), true);
Row row = new Row("nodex", new Cell[]{new Cell(0, "node", "nodex")}, false, new HashMap<>(), true);
Row r1 = row.addReplica("c1", "s1", null);
Row r2 = r1.addReplica("c1", "s1",null);
assertEquals(1, r1.collectionVsShardVsReplicas.get("c1").get("s1").size());