Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

All of my Bacula backups started failing over the weekend with the following MySQL error:

Fatal error: sql_create.c:XXX Fill File table Query failed: INSERT INTO File (FileIndex, JobId, PathId, FilenameId, LStat, MD5)SELECT batch.FileIndex, batch.JobId, Path.PathId, Filename.FilenameId,batch.LStat, batch.MD5 FROM batch JOIN Path ON (batch.Path = Path.Path) JOIN Filename ON (batch.Name = Filename.Name): ERR=Duplicate entry '375086058' for key 'PRIMARY'

It was fairly sudden: it seems to have happened between 3.05am and 3.11am this morning with no other hints as to what happen.

A quick look at the database agrees that 375086058 is the highest numbered FileId field (which is the Primary Index for the File Table), but I don't know what to do to fix it without corrupting my Bacula database.

Any ideas?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I looked at the status of the table and verified that the Fileid field was an autoincrement and that it was stuck at 375086058, which is the number that it now says is duplicate. I got this info with the following two commands:

mysql> describe File;
mysql> show table status where name='File';

To resolve this problem, I updated the auto_increment to the *next( number:

mysql> ALTER TABLE File AUTO_INCREMENT=375086059;

This took about 10 minutes due to the size of the table. It seems to have fixed the problem.

share|improve this answer
    
Backups look to be working fine now. –  Shannon A. Feb 6 '14 at 0:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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