Make WordPress Core

Opened 3 months ago

Last modified 8 weeks ago

#60299 new defect (bug)

Default assignment of `use_ssl` user meta value causes unnecessary DB write.

Reported by: prettyboymp's profile prettyboymp Owned by:
Milestone: 6.6 Priority: normal
Severity: normal Version:
Component: Users Keywords: has-patch needs-unit-tests
Focuses: performance Cc:


When the $meta in wp_insert_user() is processed using update_metadata() it first does a comparison against the current values in the database prior to running an update query. However, because the DB returns a string value ('1' or '0') while the meta_value is set to a boolean value by default the comparison always fails causing a write when not needed.

While this is relatively minor in itself, in multi-datacenter setups using hyperdb, this can cause a bit of overhead since all future reads to the usermeta table are then sent to the master database.

Attachments (1)

60299.patch (695 bytes) - added by prettyboymp 3 months ago.
Set $meta['use_ssl'] to string value.

Download all attachments as: .zip

Change History (6)

3 months ago

Set $meta['use_ssl'] to string value.

#1 @prettyboymp
3 months ago

  • Keywords has-patch added

#2 @SergeyBiryukov
3 months ago

  • Milestone changed from Awaiting Review to 6.5

This ticket was mentioned in Slack in #core-performance by mukeshpanchal27. View the logs.

2 months ago

#4 @swissspidy
2 months ago

  • Keywords needs-unit-tests added

#5 @swissspidy
8 weeks ago

  • Milestone changed from 6.5 to 6.6
Note: See TracTickets for help on using tickets.