Omit corrupt changes from search results

A single corrupt change, e.g. with a missing current patch set, can
potentially prevent a search results page from loading by causing the
whole query to return a 500.

Instead of hosing search results, omit corrupt changes from the
results with a warning in the logs.

The downside of this approach is that in the presence of corrupt
changes, it is no longer guaranteed that _more_changes will be set on
the last result only if there were N results. On balance I think this
is a fair price to keep the web UI usable for users in this rare error
case.

Change-Id: I1a2a24877156c55243513b03207137d412bc8bfd
This commit is contained in:
Dave Borowitz 2014-05-12 11:54:35 -07:00
parent 7725916c7e
commit b7fd8de1cf

View File

@ -278,7 +278,12 @@ public class ChangeJson {
for (ChangeData cd : changes) {
ChangeInfo i = out.get(cd.getId());
if (i == null) {
i = toChangeInfo(cd, Optional.<PatchSet.Id> absent());
try {
i = toChangeInfo(cd, Optional.<PatchSet.Id> absent());
} catch (OrmException e) {
log.warn(
"Omitting corrupt change " + cd.getId() + " from results", e);
}
out.put(cd.getId(), i);
}
info.add(i);