diff options
author | Diego Zambelli Sessona <diego.sessona@gmail.com> | 2024-04-04 09:11:31 +0200 |
---|---|---|
committer | Diego Zambelli Sessona <diego.sessona@gmail.com> | 2024-04-04 09:19:28 +0200 |
commit | 65da242079ead7ee68bd7ee4241838bd466b93f2 (patch) | |
tree | 8d634f04e089d6961afa72fc5741682c987ddace | |
parent | 1fbd90da749cc80c115f745e458cea31d0bb5dec (diff) |
Reset pageResultSize when PaginationType NONE back-fill resultsupstream/stable-3.4
This is a follow up of change 413358.
In particular, if some results are skipped because of
of the visibility constraints, more changes need to
be asked from the index, and pageResultSize needs to
be reset to know how many results are returned from each
query.
Without this change querying for more changes could end
up in an infinite loop as exposed in a test in 3.6 [1]
[1]: https://gerrit.googlesource.com/gerrit/+/refs/heads/stable-3.6/javatests/com/google/gerrit/server/query/change/FakeQueryChangesTest.java#126
Release-Notes: skip
Change-Id: I566010c6f5bfcb4fbc003bc6693aa25d4dd44a81
-rw-r--r-- | java/com/google/gerrit/index/query/PaginatingSource.java | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/java/com/google/gerrit/index/query/PaginatingSource.java b/java/com/google/gerrit/index/query/PaginatingSource.java index d89fe66c14..8390cbb329 100644 --- a/java/com/google/gerrit/index/query/PaginatingSource.java +++ b/java/com/google/gerrit/index/query/PaginatingSource.java @@ -100,6 +100,7 @@ public class PaginatingSource<T> implements DataSource<T> { int nextStart = pageResultSize; while (pageResultSize == limit && r.size() < limit) { ResultSet<T> next = p.restart(nextStart); + pageResultSize = 0; for (T data : buffer(next)) { if (match(data)) { r.add(data); |