Skip to content

feat(database): drop the checks that do not earn their place - #1128

Merged
kesselb merged 1 commit into
feat/database-checksfrom
fix/prune-database-rules
Sep 9, 2026
Merged

kesselb merged 1 commit into
feat/database-checksfrom
fix/prune-database-rules

Conversation

@karlitschek

Copy link
Copy Markdown
Member

Stacked on #1123. While I was preparing this, #1124 and #1125 were merged into that branch, so #1123 now carries the whole database series and targets master; this sits on top of it.

Removes 20 of the 57 ported checks, leaving 37.

What went, and why

Removed Reason
Missing indices, Missing columns, Missing primary keys Nextcloud already reports these on Settings → Overview. Repeating them here gave admins two places to read the same finding.
Transaction isolation level Same family; goes with the schema checks.
Query cache ×6 — efficiency, disabled, underutilized, fragmented, size very large, evicting under memory pressure The query cache was removed outright in MySQL 8.0. On a supported server these either skip or advise tuning something nothing uses.
Everything MyISAM ×4 — concurrent inserts, key buffer hit rate / disabled / peak usage low Nextcloud runs on InnoDB. Advice about MyISAM tuning is noise.
Short server uptime, Too few queries to analyse Not actionable: an admin cannot "fix" a server having been up for an hour.
slow_launch_time, Skip name resolve Findings with no useful action for a Nextcloud workload.
Binary log durability, Binlog cache spilled to disk Only meaningful with replication configured.

Result on a MariaDB instance: 57 checks with 12 failing → 37 with 5, and the MyISAM, QueryCache, Security and Server categories disappear entirely. The two Nextcloud rules worth keeping — utf8mb4 charset and InnoDB engine — stay.

It pays for itself twice over

The three schema-integrity rules were the only consumers of NextcloudSchema::missingSchemaCounts(), which dispatches AddMissingIndicesEvent, AddMissingColumnsEvent and AddMissingPrimaryKeyEvent to every installed app and diffs the declared expectations against the live schema through SchemaWrapper. That is easily the most expensive thing a check run did, and it no longer runs at all.

It also drops OC\DB\SchemaWrapper — one fewer private server class a bundled app depends on, which is something I flagged as a maintenance risk in the app's review. The psalm baseline shrinks from 79 entries to 68 along with it.

And it removes Concurrent_insert_off, the rule behind the MariaDB log noise fixed in #1125 — so that fix now has nothing left to suppress on MariaDB, though it remains correct for other rule/flavour mismatches.

Verification

Against a live MariaDB instance:

  • 37 rules returned; none of the 20 removed ids appear in the response
  • kept Nextcloud rules are exactly nc.innodb_engine and nc.utf8mb4_charset
  • the page renders 5 rule cards, and the Overview setup check updates itself to "5 database checks are failing"

php-cs-fixer and psalm clean; committed js/css reproduce from a fresh build.

One to confirm

You listed slow_launch_time, which I read as the rule named "slow_launch_time threshold high" (Slow_launch_time_high). There is a sibling, "Threads slow to launch" (Slow_launch_threads), which reports threads actually exceeding that threshold rather than the threshold's value. I left it, since removing more than was asked is harder to notice than removing less — say the word if it should go too.

Twenty of the fifty-seven ported checks are removed, leaving thirty-seven.

Nextcloud already reports missing indices, columns and primary keys on
Settings > Overview, so repeating them here only gave an admin two places
to read the same finding, and the transaction isolation check went with
them. The query cache and MyISAM groups describe engines and features that
a current Nextcloud does not use — the query cache was removed outright in
MySQL 8.0 — so on a supported server they either skip or advise tuning
something nothing touches. The rest are checks whose finding is not
actionable: how long the server has been up, whether it has served enough
queries to be worth analysing, slow_launch_time, skip_name_resolve, and the
two binary-log ones that only matter with replication configured.

Removing the schema-integrity rules pays for itself twice over. They were
the only consumers of the code that dispatches AddMissingIndicesEvent and
friends to every installed app and diffs the result against the live schema
through SchemaWrapper, so that work no longer runs on a page load, and the
app no longer reaches into OC\DB\SchemaWrapper -- one fewer private server
class for a bundled app to depend on. The psalm baseline shrinks with it.

It also removes the rule behind the MariaDB log noise fixed in the previous
commit, so that fix now has nothing left to suppress on MariaDB.

On a MariaDB test instance the page goes from 57 checks with 12 failing to
37 with 5, and the categories MyISAM, QueryCache, Security and Server
disappear entirely.

Signed-off-by: Frank Karlitschek <frank.karlitschek@nextcloud.com>
Assisted-by: Claude Code:claude-opus-5
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@kesselb
kesselb merged commit 98fa432 into feat/database-checks Sep 9, 2026
41 checks passed
@kesselb
kesselb deleted the fix/prune-database-rules branch September 9, 2026 17:52
@karlitschek

Copy link
Copy Markdown
Member Author

/backport to stable35

@backportbot

backportbot Bot commented Sep 9, 2026

Copy link
Copy Markdown

The backport to stable35 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable35
git pull origin stable35

# Create the new backport branch
git checkout -b backport/1128/stable35

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick f81760f9

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/1128/stable35

Error: Failed to check for changes with origin/stable35: No changes found in backport branch


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants