2

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?

Shannon A.
  • 173
  • 9

1 Answers1

1

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.

Shannon A.
  • 173
  • 9