gitforge/models
Gusted a85d9b2b52 feat: make delete repository transcation READ COMMITTED (#12856)
This is a monster transaction, it touches a lot of tables and happily
locks many rows which results in all other operations waiting on this
transaction to finish. In a lot of cases this operation is fast and for
many this wouldn't be a problem, however on Codeberg we've observed that
when large (many issues, comments and PRs specifically) repository is
being deleted it can result in the instance being unreachable to do any
other modification to it.

This is not fixable for SQLite (although if you get such large
repositories and has many concurrent writes, then maybe SQLite is no
longer a good choice) as transactions are always of the SERIALIZABLE
level.

PostgreSQL default isolation level is READ COMMITTED and seems to me
the observed behavior on Codeberg wouldn't happen here unless the
default isolation level is to be made REPEATABLE READ or SERIALIZABLE.

MySQL/MariaDB default isolation level is REPEATABLE READ and that gets
the behavior of rows being locked (even those that aren't being
modified). And this is where this patch is effective to make this
transaction a bit less of a monster.

There's a small risk of making this transaction READ COMMITTED, there's
a window where new records can be created for this repository which will
then not be deleted. These will eventually be solved by foreign keys,
currently most can still be removed after the fact by the
`check-db-consistency` doctor check.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12856
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-07-07 21:56:18 +02:00
..
actions fix: ensure runners either belong to owner or repo when updated (#13262) 2026-07-01 03:49:07 +02:00
activities chore(nilnil lint): resolve low-hanging fruit nilnil lint violations (#13230) 2026-07-03 23:48:03 +02:00
admin
asymkey chore: make use of go1.26 features (#12369) 2026-05-01 22:51:48 +02:00
auth feat: enable auth to git HTTP via authorized integrations (#12715) 2026-05-25 19:33:36 +02:00
avatars feat: serve downsized versions of avatars (#11242) 2026-05-16 12:04:05 +02:00
db feat: make delete repository transcation READ COMMITTED (#12856) 2026-07-07 21:56:18 +02:00
dbfs chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
fixtures fix(ui): fall back to default theme from non-existent (#13110) 2026-06-17 19:18:09 +02:00
forgefed chore(federation): re-enable nilnil lint (#11253) 2026-04-13 22:05:29 +02:00
forgejo/semver chore: move all test blank imports in a single package (#10662) 2026-01-02 05:32:32 +01:00
forgejo_migrations feat: add warnings for usage of unsupported permissions: in Actions workflows (#13164) 2026-06-23 21:30:19 +02:00
forgejo_migrations_legacy chore: upgrade to https://code.forgejo.org/xorm/xorm v1.4.0 (#12639) 2026-05-20 20:20:08 +02:00
git 2026-06-10 security patches (#13001) 2026-06-10 06:05:01 +02:00
gitea_migrations chore: bump golangci-lint version (#13211) 2026-06-27 00:35:03 +02:00
issues feat: add internal APIs for reactions notifications (#13017) 2026-06-29 03:59:39 +02:00
moderation
organization chore(nilnil lint): resolve low-hanging fruit nilnil lint violations (#13230) 2026-07-03 23:48:03 +02:00
packages fix: Update swift package registry to use the metadata schema from the official Swift docs (#12200) 2026-06-26 04:25:56 +02:00
perm chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
project feat(build): Support go "fmt" format strings as masked usage patterns (#12013) 2026-05-01 02:46:01 +02:00
pull chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
quota chore: move all test blank imports in a single package (#10662) 2026-01-02 05:32:32 +01:00
repo fix: load repo language for converting to api struct (#12737) 2026-05-28 17:00:40 +02:00
secret fix: secret name-prefix regex (#12213) 2026-04-21 19:55:16 +02:00
shared/types
system feat(build): Support go "fmt" format strings as masked usage patterns (#12013) 2026-05-01 02:46:01 +02:00
unit chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
unittest chore: bump golangci-lint version (#13211) 2026-06-27 00:35:03 +02:00
user feat: adds "actor" as a protected / forbidden username (#13077) 2026-07-04 16:01:31 +02:00
webhook chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
error.go
main_test.go chore: move all test blank imports in a single package (#10662) 2026-01-02 05:32:32 +01:00
org.go
org_team.go chore: split AddRepository and AddTeamMember to return the inserted value (#11342) 2026-03-11 03:40:32 +01:00
org_team_test.go chore: split AddRepository and AddTeamMember to return the inserted value (#11342) 2026-03-11 03:40:32 +01:00
org_test.go
repo.go fix: cleanup data before migration retry (#12370) 2026-05-05 12:41:42 +02:00
repo_test.go
repo_transfer.go chore: fix typos throughout the codebase (#10753) 2026-01-26 22:57:33 +01:00
repo_transfer_test.go chore: fix typos throughout the codebase (#10753) 2026-01-26 22:57:33 +01:00