Opened 10 years ago
Closed 10 years ago
#11782 closed defect (duplicate)
Unable to sync repository, MySQL Integrity Error, Duplicate Entry
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | database backend | Version: | 1.0-stable |
Severity: | major | Keywords: | mysql primary key |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When trying to re/sync my subversion repository it would stop on revision 5827 (with no errors) although the SVN repo contains more changesets than that. Enabling debugging revealed a SQL exception that was preventing the changes from being imported. Replaced domain name with www.xxxxxxxxxxx.com, otherwise unchanged.
2014-10-15 15:39:59,671 Trac[util] DEBUG: args: (1L, '0000005828', u'sites/com.xxxxxxxxxxx.www/trunk/wp-content/cache/minify/000000/fY_RDoMwCEV_yLYx2Q8xSiquQm3xwb9fzfawLc4XAveeG2AMCCKAJFYhu6wIpjXMLczrRnX3d3ATtAknkER-YRnGv5Ez_RdfSLYWWDBvkdqRSiTUneEWUJdum6tU8v7e1WvK9HEQZWjGeGatxuWI-QL4-AJenUOtdKJfvJRUO-ATKWq8Aos2c5ErobFKuyCNZafIfXoC.js.old', 'F', 'A', None, -1) 2014-10-15 15:39:59,671 Trac[util] DEBUG: execute exception: IntegrityError(1062, "Duplicate entry '1-0000005828-sites/com.xxxxxxxxxxx.www/trunk/wp-content/cache/m' for key 'PRIMARY'") 2014-10-15 15:39:59,672 Trac[cache] WARNING: Revision 5828 already cached: IntegrityError(1062, "Duplicate entry '1-0000005828-sites/com.xxxxxxxxxxx.www/trunk/wp-content/cache/m' for key 'PRIMARY'")
Some research showed that this error can be caused by the wrong type of database collation, however I am using UTF8/utf8_bin as recommended. After looking at the database structure, it seems that this is a "legitimate" error based on the key length of the PRIMARY key in node_change
. While my path is unfortunately long (and this changeset was actually not even valid as it was dynamically generated cache data) the issue seems to stem from multiple files in the commit using the same very long path.
As the max length of a Mysql index subpart is 767 bytes (255 UTF8 characters) the only work around I could come up with was to remove the PRIMARY
key, complete the import with trac-admin . repository sync "*"
, update the offending path
values in the database, and recreate the PRIMARY
index.
Ideally this issue could be resolved more gracefully, but it would also be ideal to see this raised to the UI in some fashion - as is the sync reports success even though it has encountered an error.
- Trac 1.0
- CentOS 5.11
- Python 2.7.5
- MariaDB 10.0.14
- Subversion 1.7.9 + python swig bindings
Attachments (0)
Change History (1)
comment:1 by , 10 years ago
Keywords: | primary key added; database IntegrityError subversion resync removed |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
This issue has been reported in #3676.