0

I was trying to upgrade FogBugz, and during the database migration I got the following MySQL exception:

MySql.Data.MySqlClient.MySqlException: Duplicate entry '12345' for key 1 
w 
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs 
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) w 
System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs 
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) w 
System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, 
DataTableMapping tableMapping) w 
System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows) w 
Wasabi.Runtime.ADO.KeySetCursor.Update() w 
c:\src\Wasabi\Wasabi.Runtime\ADO\Cursor.cs:wiersz 440 w 
Wasabi.Runtime.ADO.RecordSet.Update() w 
c:\src\Wasabi\Wasabi.Runtime\ADO\RecordSet.cs:wiersz 160 w 
FogCreek.FogBugz.__Global.UpdateRS(RecordSet rs, Nullable1 
nCacheClearLevel) w 
c:\src\FogBugz\distribution\src-Website\util.was:wiersz 3585 w 
FogCreek.FogBugz.CRevision.Commit(CacheClear nCacheClearLevel) w 
c:\src\FogBugz\distribution\src-Website\_Generated.was:wiersz 38640 w 
FogCreek.FogBugz.CRevision.Commit() w 
c:\src\FogBugz\distribution\src-Website\_Generated.was:wiersz 38604 w 
FogCreek.FogBugz.CRevision.Save(IDiffable oDiffable, Boolean fWikiPage, 
String sCommentInit) w 
c:\src\FogBugz\distribution\src-Website\CRevision.was:wiersz 152 w 
FogCreek.FogBugz.CTemplate.ActiveRecord_BeforeCommit() w 
c:\src\FogBugz\distribution\src-Website\CTemplate.was:wiersz 777 w 
FogCreek.FogBugz.CTemplate.Commit(CacheClear nCacheClearLevel) w 
c:\src\FogBugz\distribution\src-Website\_Generated.was:wiersz 44209 w 
FogCreek.FogBugz.CTemplate.Commit() w 
c:\src\FogBugz\distribution\src-Website\_Generated.was:wiersz 44196 w 
FogCreek.FogBugz.CSchema.UpdateDefaultTemplate() w 
c:\src\FogBugz\distribution\src-Website\CSchema.was:wiersz 2611 w 
FogCreek.FogBugz.CSchema.FinalUpdates(Int32 oldVersion) w 
c:\src\FogBugz\distribution\src-Website\CSchema.was:wiersz 2465 w 
FogCreek.FogBugz.CSchema.UpdateDB(Int32 OldVersion, Boolean bForce) w 
c:\src\FogBugz\distribution\src-Website\CSchema.was:wiersz 137 w 
FogCreek.FogBugz.__Global.UpgradeDatabaseVersion(Boolean fForce) w 
c:\src\FogBugz\distribution\src-Website\dbUpgrade.was:wiersz 287 w 
FogCreek.FogBugz.__Global.UpgradeWithRollback(Boolean fForce) w 
c:\src\FogBugz\distribution\src-Website\dbUpgrade.was:wiersz 240
flag

1 Answer

0

This is a problem at the MySQL database level. The table that FogBugz was trying to write to is likely crashed or corrupted.

Look in the error message for the affected table (in this case, it's the Revision table). Then run the following command against the FogBugz database:

CHECK TABLE Revision;

And if it comes back with an error:

REPAIR TABLE Revision;

If the table is large, the repair could take a while.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.