Don't rewrite queries when filtering project watches
In the context of ProjectWatch, ChangeQueryRewriter may be bound to an index-based rewriter. The current implementation of the index rewriter may call getSource() during the course of rewriting, possibly kicking off an async query. However, for the purpose of watches, we only ever call match() on the predicate; we never need to actually enumerate the results. Don't bother rewriting the predicates; the rewriter is about querying the database more efficiently, but all we're doing is evaluating the predicate on a change. It is likely that the cost of applying the rewrite algorithm outweighs any benefit of using a simplified predicate tree. Change-Id: I3a6e867305b0e1e4956ccdee8113827b04e63580
This commit is contained in:
@@ -30,7 +30,6 @@ import com.google.gerrit.server.patch.PatchListCache;
|
||||
import com.google.gerrit.server.patch.PatchSetInfoFactory;
|
||||
import com.google.gerrit.server.project.ProjectCache;
|
||||
import com.google.gerrit.server.query.change.ChangeQueryBuilder;
|
||||
import com.google.gerrit.server.query.change.ChangeQueryRewriter;
|
||||
import com.google.gerrit.server.ssh.SshAdvertisedAddresses;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
@@ -60,7 +59,6 @@ class EmailArguments {
|
||||
final List<String> sshAddresses;
|
||||
|
||||
final ChangeQueryBuilder.Factory queryBuilder;
|
||||
final Provider<ChangeQueryRewriter> queryRewriter;
|
||||
final Provider<ReviewDb> db;
|
||||
final RuntimeInstance velocityRuntime;
|
||||
final EmailSettings settings;
|
||||
@@ -78,7 +76,7 @@ class EmailArguments {
|
||||
@CanonicalWebUrl @Nullable Provider<String> urlProvider,
|
||||
AllProjectsName allProjectsName,
|
||||
ChangeQueryBuilder.Factory queryBuilder,
|
||||
Provider<ChangeQueryRewriter> queryRewriter, Provider<ReviewDb> db,
|
||||
Provider<ReviewDb> db,
|
||||
RuntimeInstance velocityRuntime,
|
||||
EmailSettings settings,
|
||||
@SshAdvertisedAddresses List<String> sshAddresses) {
|
||||
@@ -98,7 +96,6 @@ class EmailArguments {
|
||||
this.urlProvider = urlProvider;
|
||||
this.allProjectsName = allProjectsName;
|
||||
this.queryBuilder = queryBuilder;
|
||||
this.queryRewriter = queryRewriter;
|
||||
this.db = db;
|
||||
this.velocityRuntime = velocityRuntime;
|
||||
this.settings = settings;
|
||||
|
@@ -209,7 +209,6 @@ public class ProjectWatch {
|
||||
} else {
|
||||
p = Predicate.and(filterPredicate, p);
|
||||
}
|
||||
p = args.queryRewriter.get().rewrite(p);
|
||||
}
|
||||
return p == null ? true : p.match(changeData);
|
||||
}
|
||||
|
Reference in New Issue
Block a user