Skip to content

Don't validate DB encoding on every connection - #1646

Open
cpeel wants to merge 2 commits into
DistributedProofreaders:masterfrom
cpeel:stop-validating-encoding
Open

cpeel wants to merge 2 commits into
DistributedProofreaders:masterfrom
cpeel:stop-validating-encoding

Conversation

@cpeel

@cpeel cpeel commented Sep 19, 2026

Copy link
Copy Markdown
Member

Note: this is intended to be merged after the release.

utf8mb4 encoding has been used on initial DB creation for 6 years so we can drop the query on every DB connection to validate the encoding. Any user who is upgrading from a version older than R202009 must first upgrade to R202009 (per UPGRADE.md) which has the UTF-8 conversion in it (and the last and only use of $skip_encoding_check).

utf8mb4 encoding has been used on initial DB creation for 6 years
so we can drop the query on every DB connection to validate the
encoding.
@cpeel cpeel self-assigned this Sep 19, 2026
Comment thread pinc/DPDatabase.inc
throw new DBConnectionError("Database not configured for UTF8.");
}
//-------------------------------------------------------------------

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can drop the get_default_db_charset function and the _default_db_charset property too. This is the only place those are used. We could also restrict get_db_defaults to only SELECT DEFAULT_COLLATION_NAME.

Out of interest, how much does this query cost?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can drop the get_default_db_charset function and the _default_db_charset property too. This is the only place those are used. We could also restrict get_db_defaults to only SELECT DEFAULT_COLLATION_NAME.

Done.

Out of interest, how much does this query cost?

Probably not very much. It's actually SELECTing into a view that joins a couple of tables but it's against data structures that I assume MySQL has in-memory.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants