Check consistency with a ListChangesOption

This allows for bulk consistency checking using the normal change
query interface. We already know how to detect and omit corrupt
changes; when consistency checking is enabled, we can do something
more useful.

One subtlety is that depending on the call path, we might fail to even
resolve a Change.Id to a Change. Teach ConsistencyChecker how to
handle this case by returning a single problem for this error, and
encapsulating the problem list in a Result containing the change as
well. We need to return the change in this way because the failure to
look up the change might have been transient; it would be confusing to
return "Error looking up change" and also return the change info
because the second lookup to populate the ChangeInfo succeeded.

Check can now be a thin wrapper around GetChange, at least for the GET
path.

Change-Id: I2b2e2b64d6c4e294e28640df271a9bd64a2f0b5f
This commit is contained in:
Dave Borowitz
2014-12-03 16:46:45 -08:00
parent 5c894d4afb
commit 4c46c24349
9 changed files with 135 additions and 71 deletions

View File

@@ -241,7 +241,7 @@ public class ConsistencyCheckerTest {
}
private void assertProblems(Change c, String... expected) {
assertThat(Lists.transform(checker.check(c),
assertThat(Lists.transform(checker.check(c).problems(),
new Function<ProblemInfo, String>() {
@Override
public String apply(ProblemInfo in) {