Opened 7 years ago
Last modified 7 years ago
#42422 new defect (bug)
'unique' index not removed from the 'slug' column of the 'wp_terms' table
Reported by: | joellisenby | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.8.3 |
Component: | Taxonomy | Keywords: | |
Focuses: | Cc: |
Description
This is a follow-up to #22023.
It appears that on one of my older installations of wordpress the unique index was never removed from the 'slug' column of the 'wp_terms' table. The latest update 4.8.3 must have stirred something up with wp cron, conflicting with the unique status of the column. This has caused thousands of the following errors to be logged which in turn caused our server to 503 due to hitting the PHP FcgidMaxProcessesPerClass limit.
Note: this installation has had regular updates since being installed years ago.
stderr: WordPress database error Duplicate entry 'category-slug' for key 'slug' for query INSERT INTO `wp_terms` (`name`, `slug`, `term_group`) VALUES ('Category Name', 'category-slug', 0) made by do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, _wp_batch_split_terms, _split_shared_term
Change History (6)
#2
@
7 years ago
Is it single-site or Multisite?
Single-site
What's the db_version string in wp_options?
38590
Have other, more recent database schema changes successfully taken place? For example: what's the size of your wp_posts.post_password column? [38590]? Or, do you have a wp_termmeta table?
wp_posts.post_password size is 20. Now that you mention it, I had to manually create the wp_termmeta table as well.
How large is the wp_terms table?
746 rows (after manually removing the unique constraint)
I'm wondering if perhaps the ALTER TABLE command issued by dbDelta() was somehow interrupted - maybe due to slowness in rebuilding a large index - and never corrected itself. What happens if you manually run the ALTER TABLE query to remove the UNIQUE constraint?
I was able to manually remove the UNIQUE constraint via phpmyadmin and I manually created the wp_termmeta table via phpmyadmin.
#3
follow-up:
↓ 5
@
7 years ago
Another related question - Does WordPress and PHPMyAdmin use the same MySQL user? If not, does the WordPress MySQL user have the rights to ALTER tables?
#5
in reply to:
↑ 3
@
7 years ago
Replying to dd32:
Another related question - Does WordPress and PHPMyAdmin use the same MySQL user? If not, does the WordPress MySQL user have the rights to ALTER tables?
Yes, I am logging into phpmyadmin with the same user and pass as is used in wp-config.php so the permissions should be the same.
#6
@
7 years ago
Hi, 12 days ago I logged the same issue as this one I believe.
https://core.trac.wordpress.org/ticket/42381
*update* I have updated https://core.trac.wordpress.org/ticket/42381 since replying to this trac.
Unique constraint on slug in wp_terms table
I have removed the constraint manually but am now unsure if there are other as yet undiscovered updates which have been skipped.
Here are my results for the questions posed above:
Is it single-site or Multisite?
Single site
What's the db_version string in wp_options?
38590
Have other, more recent database schema changes successfully taken place? For example: what's the size of your wp_posts.post_password column? [38590]? Or, do you have a wp_termmeta table?
size wp_posts.post_password column varchar(20)
wp_termmeta exists, I have not had to create it unlike the author of this ticket
How large is the wp_terms table?
1618 rows
Is there an easy way to compare table structure to 'ideal' table structure to help identify
Hi @joellisenby - Thanks for the ticket, and welcome to WordPress Trac.
A couple questions about this installation:
wp_posts.post_password
column? [38590]? Or, do you have awp_termmeta
table?wp_terms
table?I'm wondering if perhaps the
ALTER TABLE
command issued bydbDelta()
was somehow interrupted - maybe due to slowness in rebuilding a large index - and never corrected itself. What happens if you manually run theALTER TABLE
query to remove theUNIQUE
constraint?