Use PATCH_SET to build PATCH_LIST in rules engine

Loading the PATCH_LIST only requires the ObjectId of the revision.
Creating PATCH_SET_INFO requires parsing the commit object out of
Git to convert from RevCommit to PatchSetInfo, which is unnecessary
overkill for just to get the SHA-1.

This should fix a major performance problem with change search
results and user dashboards on gerrit-review. Each change was
querying the Git repository sequentially, which is not a free
operation in gerrit-review's replicated environment.

Change-Id: Ife16247ed8b5e08ebe204b31b4a8bed64467feb8
This commit is contained in:
Shawn Pearce
2014-12-22 20:59:56 -08:00
parent 4f0decec7b
commit 0baec8b9d8

View File

@@ -88,12 +88,12 @@ public final class StoredValues {
@Override
public PatchList createValue(Prolog engine) {
PrologEnvironment env = (PrologEnvironment) engine.control;
PatchSetInfo psInfo = StoredValues.PATCH_SET_INFO.get(engine);
PatchSet ps = StoredValues.PATCH_SET.get(engine);
PatchListCache plCache = env.getArgs().getPatchListCache();
Change change = getChange(engine);
Project.NameKey projectKey = change.getProject();
ObjectId a = null;
ObjectId b = ObjectId.fromString(psInfo.getRevId());
ObjectId b = ObjectId.fromString(ps.getRevision().get());
Whitespace ws = Whitespace.IGNORE_NONE;
PatchListKey plKey = new PatchListKey(projectKey, a, b, ws);
PatchList patchList;