Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#11437 closed defect (bug) (fixed)

Option inserts triggered from front page can cause duplicate entry errors

Reported by: ryan's profile ryan Owned by: ryan's profile ryan
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Database Keywords: has-patch
Focuses: Cc:

Description

WordPress database error Duplicate entry '_site_transient_timeout_theme_roots' for key 2 for query INSERT INTO `options` (`option_name`,`option_value`,`autoload`) VALUES ('_site_transient_timeout_theme_roots','1260638876','yes') made by require, require_once, require_once, require_once, get_template_directory, get_theme_root, get_theme_roots, get_themes, set_site_transient, add_site_option, add_option

On a busy site, this insert can be triggered multiple times. A race condition results with the losers creating a duplicate key error. One solution is to use ON DUPLICATE KEY UPDATE.

Attachments (2)

11437.diff (786 bytes) - added by ryan 15 years ago.
11437-extra.diff (764 bytes) - added by Denis-de-Bernardy 15 years ago.

Download all attachments as: .zip

Change History (5)

@ryan
15 years ago

#1 @nacin
15 years ago

  • Keywords has-patch added

#3 @automattor
15 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [12403]) Use ON DUPLICATE KEY UPDATE when inserting options to avoid duplicate entry errors. fixes #11437

Note: See TracTickets for help on using tickets.