Use NoteDb for ref filtering when asking only for a single change ref

SearchingChangeCacheImpl only returns a fraction of all changes. This
fraction covers most recently modified changes. This is problematic when
users want to fetch a change that is older than what this set covers.

There are Gerrit instances with millions of changes and the concept of
index-backed evaluation doesn't scale to this size. Other concepts
failed and had to be reverted (I447eaeb).

If refs-in-wants on Protocol V2 is used, we can fix the shortcomming by
investigating only a single ref backed by NoteDb.

Change-Id: Ib01492ac58eda4a37086aa3e106be857cfb566e1
This commit is contained in:
Patrick Hiesel
2019-01-16 13:34:52 +01:00
parent 3953f4654c
commit e52b9b5f74
4 changed files with 71 additions and 2 deletions

View File

@@ -45,6 +45,13 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
/**
* Cache based on an index query of the most recent changes. The number of cached items depends on
* the index implementation and configuration.
*
* <p>This cache is intended to be used when filtering references. By design it returns only a
* fraction of all changes. These are the changes that were modified last.
*/
@Singleton
public class SearchingChangeCacheImpl implements GitReferenceUpdatedListener {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();