mirror of
https://codeberg.org/forgejo/forgejo
synced 2025-10-19 21:30:41 +02:00
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/9657 Fixes #9644. Rewrites `db.Iterate` so that it performs DB queries in this format: - First: `SELECT ...columns... FROM table ORDER BY id LIMIT ...buffer-size...` - Subsequent buffer fills: adding a `WHERE id > ...last-id-from-previous...` This approach: - Prevents records from being missed or returned twice - Returns records in a predictable order - Should be faster, by virtue of using database indexes on the primary key to perform the query - Doesn't rely on any unpredictable database behaviour when using `LIMIT` and `OFFSET` without an `ORDER BY` - (Downside: does require reflection to read field values off Go structures for the primary key value) Expands the automated tests to include the predicted failure case identified in #9644, which verified the previous broken behaviour, as well as verifying that the `cond` parameter is applied which was previously not covered by test automation. Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9723 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> |
||
---|---|---|
.. | ||
actions | ||
activities | ||
admin | ||
asymkey | ||
auth | ||
avatars | ||
db | ||
dbfs | ||
fixtures | ||
forgefed | ||
forgejo/semver | ||
forgejo_migrations | ||
git | ||
issues | ||
migrations | ||
moderation | ||
organization | ||
packages | ||
perm | ||
project | ||
pull | ||
quota | ||
repo | ||
secret | ||
shared/types | ||
system | ||
unit | ||
unittest | ||
user | ||
webhook | ||
error.go | ||
main_test.go | ||
org.go | ||
org_team.go | ||
org_team_test.go | ||
org_test.go | ||
repo.go | ||
repo_test.go | ||
repo_transfer.go | ||
repo_transfer_test.go |