[wp-trac] [WordPress Trac] #5809: Updating a term in one taxonomy affects the term in every taxonomy

WordPress Trac noreply at wordpress.org
Wed Nov 5 00:59:55 UTC 2014


#5809: Updating a term in one taxonomy affects the term in every taxonomy
--------------------------+---------------------------
 Reporter:  rmccue        |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  accepted
 Priority:  high          |   Milestone:  4.1
Component:  Taxonomy      |     Version:  2.3
 Severity:  major         |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------------

Comment (by boonebgorges):

 In [changeset:"30238"]:
 {{{
 #!CommitTicketReference repository="" revision="30238"
 In `wp_insert_term()`, clean up accidental duplicate terms after insert.

 In [30056], the UNIQUE index was removed from the 'slug' column of
 `wp_terms`.
 While we have numerous checks in place to avoid the creation of unwanted
 duplicate term+term_taxonomy pairs, it's possible that in certain edge
 cases -
 such as during the lag caused by database replication, or a race condition
 involving near-simultaneous creation of more than one term - we'll end up
 unwittingly inserting two identical rows.

 The current changeset minimizes this risk by introducing a failsafe
 mechanism
 into `wp_insert_term()`. After a term and term_taxonomy are INSERTed, we
 check
 to see whether the term just created is a duplicate of an existing term;
 if so,
 we delete the new one and keep the old one. This prevents problems caused
 by
 replication lag, because SELECT queries that take place after an INSERT
 will
 hit the master database; it mitigates race conditions by enforcing that
 the
 term that was created first (ie, the one with the lowest `term_id`) is
 always the "canonical" one.

 Props nacin, markjaquith.
 See #22023, #5809.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/5809#comment:59>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list