Page MenuHomePhabricator

Database error at undelete on dewiki
Closed, ResolvedPublic

Description

Try to undelete:

http://de.wikipedia.org/wiki/Spezial:Wiederherstellen/Ansegis

Revisions to undelete:

  1. (diff) 22:17, 14 May 2008 . . S1
  2. (diff) 16:53, 13 May 2008 . . 134.109.116.3
  3. (diff) 16:49, 13 May 2008 . . 134.109.116.3
  4. (diff) 10:21, 8 May 2008 . . Moguntiner

Output:

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

(SQL query hidden)

from within function "Revision::insertOn". MySQL returned error "1062: Duplicate entry '3559238-45783912' for key 1 (10.0.0.231)".


Version: unspecified
Severity: critical

Details

Reference
bz14149

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:11 PM
bzimport set Reference to bz14149.
bzimport added a subscriber: Unknown Object (MLST).

I'm seeing ar_rev_id = 0 for all the revisions... not sure why that would be.

I'm also seeing two deleted revs for each rev (dups)

You'll have ar_rev_id = 0 for things that were deleted prior to the existence of ar_rev_id... though that shouldn't include anything from May 2008!

These do not have ar_rev_id=0, however.

They all have an actual ar_rev_id value, and there are multiples for revs 45783476 (2x) and 45783637 & 45783912 (4x).

Unique constraints aren't enforced on the archive table, and there's probably not good protection against multiple simultaneous deletions adding multiple rows before they get removed from the revision table.

It's likely there are other duplicate cases in the DB; it may be wise to add some protection, and/or to have some graceful failure for the restorations.

As a temporary workaround, try undeleting only the non-duplicate rows.

(In reply to comment #3)

You'll have ar_rev_id = 0 for things that were deleted prior to the existence
of ar_rev_id... though that shouldn't include anything from May 2008!

Those rows should be NULL, not zero, which is what threw me off.

Anyway, why was TS giving ar_rev_id = 0 ?

Unique constraints aren't enforced on the archive table, and there's probably not good protection against multiple simultaneous deletions adding multiple rows before they get removed from the revision table.

Revision ID collisions can also be caused by T135851: Preserve InnoDB table auto_increment on restart.