redirect table key violation
Closed, ResolvedPublic

Description

Author: aaron

Description:
r33133 certainly fixed the previous redirect problem but it appears to have enabled this error to occur:

internal_api_error_DBQueryError, Exception Caught: A database error has occurred
Query: INSERT INTO redirect (rd_from,rd_namespace,rd_title) VALUES ('57666','0','Vientiane')
Function: Database::insert
Error: 1062 Duplicate entry '57666' for key 1 (10.0.0.235)
, for "Vientiane, Laos"!


Version: unspecified
Severity: normal

bzimport added a project: MediaWiki-API.Via ConduitNov 21 2014, 10:06 PM
bzimport set Reference to bz13745.
bzimport created this task.Via LegacyApr 15 2008, 2:35 AM
Catrope added a comment.Via ConduitApr 15 2008, 1:49 PM

Is that error reproducible? I strongly suspect that's a race condition. I, for one, can't reproduce this at http://en.wikipedia.org/w/api.php?action=query&titles=Vientiane,_Laos&redirects Marking as WONTFIX, please REOPEN if you get this error message more frequently.

What probably happened here is that two people ran the above query more or less simultaneously, and that query 1 inserted a row into the redirect table *after* query 2 had discovered the row wasn't there. When query 2 (you) tries to add a row that's already there, it dies. This condition is very rare, however (two people querying an ancient redirect that hasn't been queried before at the same time), so I'll just mark this as WONTFIX. The odds of this error occurring again after today (r33133 went live today) are astronomical, since it can only occur once for every ancient redirect, and only if the first query run on it since today is run by two people at the same time.

brion added a comment.Via ConduitApr 15 2008, 5:38 PM

That's the sort of thing that INSERT IGNORE is for.

bzimport added a comment.Via ConduitApr 15 2008, 6:03 PM

aaron wrote:

I did also get this error on "Antananarivo, Madagascar" (funny that it'd be limited happening on capitals of poor-ass countries), but I haven't seen it since yesterday. Thanks guys.

bzimport added a comment.Via ConduitApr 15 2008, 6:07 PM

ayg wrote:

(In reply to comment #2)

That's the sort of thing that INSERT IGNORE is for.

REPLACE is probably better in this case.

Catrope added a comment.Via ConduitApr 15 2008, 6:15 PM

(In reply to comment #4)

(In reply to comment #2)
> That's the sort of thing that INSERT IGNORE is for.

REPLACE is probably better in this case.

It doesn't really matter, because they're supposed to add the exact same row. I'll use REPLACE just be sure, though.

Catrope added a comment.Via ConduitApr 15 2008, 6:46 PM

Fixed in r33383

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.