)]}'
{
  "commit": "b06d7971bd286f68171eecd483232fb3f7938258",
  "tree": "06b3991c28be56e67d4a29ad30e9479ecba0a7a8",
  "parents": [
    "c6ceefd83a9f3e28ce3caaa34f10daa4ede08210"
  ],
  "author": {
    "name": "Shawn O. Pearce",
    "email": "sop@google.com",
    "time": "Mon May 21 17:01:50 2012 -0700"
  },
  "committer": {
    "name": "Shawn O. Pearce",
    "email": "sop@google.com",
    "time": "Mon May 21 17:10:07 2012 -0700"
  },
  "message": "Fix duplicated results on status:open project:P branch:B\n\nThe changes().byBranchClosedPrev() method does not support pagination\nwithin the database. It only loads all open changes on the supplied\nproject/branch pair. Because it does not support pagination, we cannot\naccept the sortkey_after and limit predicates as part of this rewrite.\n\nAndSource has a special case within it where Paginated sources will\nbe run again using the sort key from a prior result row whenever\nthe AndSource has not yet gathered the caller\u0027s requested limit\nworth of results. When the rewritten predicate ignores sortkey_after\nand just returns rows already seen by the AndSource, AndSource assumes\nthese are new and appends them to the results.\n\nThis re-execution of the Paginated (but not really!) ChangeSource\nis what causes duplicate results with the topic predicate. But the\ntopic predicate was just a misleading fact, it actually produces\nduplicates anytime the user can see at least one change that matches\nthe rest of their query string, they see the results repeated out\nuntil the requested pagination limit.\n\nWhenever there are no results, e.g. past the end of pagination, or\nthere are no matches at all, the server was going into an infinite\nloop within AndSource, constantly re-running the same database query\nto scan all open changes by the supplied project and branch pair.\nThis could overload a database server, or Gerrit server with a lot\nof unnecessary CPU load.\n\nThe correct solution is to declare the ChangeSource to be *not*\nPaginated by extending ChangeSource rather than PaginatedSource,\nand don\u0027t consume the sortkey_after and limit predicates from the\nquery, allowing those to be applied elsewhere in the query tree.\n\nChange-Id: I25a0171ad23d146c093be1f129fe6f0f41fe7681\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "bf2e4ccfbcaf7ed7a614a1e48f7f554a2f54f47a",
      "old_mode": 33188,
      "old_path": "gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeQueryRewriter.java",
      "new_id": "34ec2f4aafc2dbe0edc7f23a1b7c355421adc05c",
      "new_mode": 33188,
      "new_path": "gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeQueryRewriter.java"
    }
  ]
}
