You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/models
Earl Warren b748d62b46
Add slow SQL query warning (#27545)
- Databases are one of the most important parts of Forgejo, every
interaction uses the database in one way or another. Therefore, it is
important to maintain the database and recognize when the server is not
doing well with the database. There already is the option to log *every*
SQL query along with its execution time, but monitoring becomes
impractical for larger instances and takes up unnecessary storage in the
logs.
- Add a QoL enhancement that allows instance administrators to specify a
threshold value beyond which query execution time is logged as a warning
in the xorm logger. The default value is a conservative five seconds to
avoid this becoming a source of spam in the logs.
- The use case for this patch is that with an instance the size of
Codeberg, monitoring SQL logs is not very fruitful and most of them are
uninteresting. Recently, in the context of persistent deadlock issues
(https://codeberg.org/forgejo/forgejo/issues/220), I have noticed that
certain queries hold locks on tables like comment and issue for several
seconds. This patch helps to identify which queries these are and when
they happen.
- Added unit test.

(cherry picked from commit 9cf501f1af4cd870221cef6af489618785b71186)

---------

Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: 6543 <6543@obermui.de>
12 months ago
..
actions Artifact deletion in actions ui (#27172) 12 months ago
activities Revert "Speed up loading the dashboard on mysql/mariadb (#28546)" (#29006) 1 year ago
admin Next round of `db.DefaultContext` refactor (#27089) 1 year ago
asymkey Update tool dependencies (#29030) 1 year ago
auth Support SAML authentication (#25165) 12 months ago
avatars Refactor some legacy code and remove unused code (#28622) 1 year ago
db Add slow SQL query warning (#27545) 12 months ago
dbfs make writing main test easier (#27270) 1 year ago
fixtures Unify user update methods (#28733) 1 year ago
git Refactor locale&string&template related code (#29165) 12 months ago
issues Workaround to clean up old reviews on creating a new one (#28554) 12 months ago
migrations Add support for sha256 repositories (#23894) 1 year ago
organization Remove unused `KeyID`. (#29167) 12 months ago
packages Fix some RPM registry flaws (#28782) 1 year ago
perm Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220) 1 year ago
project Fix comment permissions (#28213) 1 year ago
pull Add support for sha256 repositories (#23894) 1 year ago
repo Add merge style `fast-forward-only` (#28954) 1 year ago
secret Use db.Find instead of writing methods for every object (#28084) 1 year ago
shared/types Refactor locale&string&template related code (#29165) 12 months ago
system Refactor deletion (#28610) 1 year ago
unit Make actions default enabled for newly created repository if global configuraion enabled (#27482) 1 year ago
unittest Workaround to clean up old reviews on creating a new one (#28554) 12 months ago
user Remove unused `KeyID`. (#29167) 12 months ago
webhook Refactor deletion (#28610) 1 year ago
error.go Add merge style `fast-forward-only` (#28954) 1 year ago
fixture_generation.go Replace more db.DefaultContext (#27628) 1 year ago
fixture_test.go Replace more db.DefaultContext (#27628) 1 year ago
main_test.go make writing main test easier (#27270) 1 year ago
org.go Refactor deletion (#28610) 1 year ago
org_team.go Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220) 1 year ago
org_team_test.go Reduce usage of `db.DefaultContext` (#27073) 1 year ago
org_test.go Replace more db.DefaultContext (#27628) 1 year ago
repo.go Refactor deletion (#28610) 1 year ago
repo_test.go Penultimate round of `db.DefaultContext` refactor (#27414) 1 year ago
repo_transfer.go Move some repository transfer functions to service layer (#28855) 1 year ago