EqualsFilePredicate: Make it work in project watches

Secondary index underwent quite some evolution, by adding new fields
or turning search predicates that (uncorrectly) used database to
produce matches to use secondary index. When new index version is
added, the previous index version must still be supported because of
online reindexing feature. On very big site, reindexing may take hours,
clearly such a long offline time is non acceptable, that why online
reindexing feature was invented. To make online reindexing work, schema
version must be fetched to route the current search predicate to use
old (legacy) or new field. For that IndexCollection is accessed and
the current schema version is read.

It seems that not the correct instance of IndexCollection is "seen"
from the HTTPD guice module. As the consequence we are getting a NPE
when file:foo predicate is used in add project watches feature. Use
the provider instead to rectify the problem.

Test Plan:

- Add "file:foo" predicate to project watches

Confirm that the new watch is created and no NPE is thrown.

Change-Id: I750be217a34cdf97b71e726bea93b3c34ca0ceb0
This commit is contained in:
David Ostrovsky
2016-02-09 08:14:45 +01:00
committed by David Pursehouse
parent f679bc8929
commit c844bc5c86

View File

@@ -55,7 +55,7 @@ class AccountServiceImpl extends BaseServiceImplementation implements
private final Provider<IdentifiedUser> currentUser;
private final ProjectControl.Factory projectControlFactory;
private final AgreementInfoFactory.Factory agreementInfoFactory;
private final ChangeQueryBuilder queryBuilder;
private final Provider<ChangeQueryBuilder> queryBuilder;
private final SetDiffPreferences setDiff;
@Inject
@@ -63,7 +63,7 @@ class AccountServiceImpl extends BaseServiceImplementation implements
final Provider<IdentifiedUser> identifiedUser,
final ProjectControl.Factory projectControlFactory,
final AgreementInfoFactory.Factory agreementInfoFactory,
final ChangeQueryBuilder queryBuilder,
final Provider<ChangeQueryBuilder> queryBuilder,
SetDiffPreferences setDiff) {
super(schema, identifiedUser);
this.currentUser = identifiedUser;
@@ -147,7 +147,7 @@ class AccountServiceImpl extends BaseServiceImplementation implements
if (filter != null) {
try {
queryBuilder.parse(filter);
queryBuilder.get().parse(filter);
} catch (QueryParseException badFilter) {
throw new InvalidQueryException(badFilter.getMessage(), filter);
}