From 65da242079ead7ee68bd7ee4241838bd466b93f2 Mon Sep 17 00:00:00 2001 From: Diego Zambelli Sessona Date: Thu, 4 Apr 2024 09:11:31 +0200 Subject: Reset pageResultSize when PaginationType NONE back-fill results 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 --- java/com/google/gerrit/index/query/PaginatingSource.java | 1 + 1 file changed, 1 insertion(+) 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 implements DataSource { int nextStart = pageResultSize; while (pageResultSize == limit && r.size() < limit) { ResultSet next = p.restart(nextStart); + pageResultSize = 0; for (T data : buffer(next)) { if (match(data)) { r.add(data); -- cgit v1.2.3