Jeff McCune wrote:
I ran the following:
use bacula; alter table File drop index FilenameID; alter table Path drop index Path;
Error messages gone.
IT ISN'T THE INDEX!
When you ran the statement: alter table File drop index FilenameID; I think you REMOVED THE PRIMARY KEY from the File table.
According to the description of Path, the primary key on PathId still exists.
mysql> describe Path; +--------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+------------------+------+-----+---------+----------------+ | PathId | int(10) unsigned | | PRI | NULL | auto_increment | | Path | blob | | | | | +--------+------------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec)
On the aforementioned manual inserts, I was using a PathID which did NOT exist. I was also using Path values which did not exists, yet I was receiving the error anyways.mysql> insert into Path(PathId,Path) values (47947,'C:/$VAULT$.AVG/'); ERROR 1062: Duplicate entry '47947' for key 1 mysql> insert into Path(PathId,Path) values (47948,'Z:/$VAULT$.AVG/'); ERROR 1062: Duplicate entry '47948' for key 1 mysql> insert into Path(Path) values (' '); ERROR 1062: Duplicate entry '47946' for key 1 mysql> replace into Path(PathId,Path) values (47947,'C:/$VAULT$.AVG/'); ERROR 1062: Duplicate entry '47947' for key 1 mysql> update Path set Path='BOGUS PATH' where PathID=47947; Query OK, 0 rows affected (0.00 sec) Rows matched: 0 Changed: 0 Warnings: 0 mysql>
MySQL is telling you that there's a duplicate entry for the PRIMARY KEY which uniquely identifies each record in the Path table. If we look at the Path creation SQL in /etc/bacula/make_mysql_tables, we can see what the structure is:
CREATE TABLE Path ( PathId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, Path BLOB NOT NULL, PRIMARY KEY(PathId), INDEX (Path(50)) );
Since the PRIMARY KEY is solely on an AUTO_INCREMENT field, I don't see how the INDEX on Path has anything to do with anything, and I don't see how you could ever have a duplicate entry in that field, unless your table is fscked.I ran repair tables, etc. FYI, this is happening on two seperate installations of Bacula at two seperate job sites.
The index on Path should have no bearing whatsoever on the PRIMARY KEY, and hence the uniqueness of each row.
One would think.
In fact, the index on the Path and Name fields has no behavioral bearing on anything if I understand MySQL correctly... It only serves to speed up queries and doesn't functionally change anything.
Correct.
I think Kern is right in that your database is fscked.
I don't understand how INDEX (Path(50)) has any bearing on PRIMARY KEY(PathId), as we have 2 discrete indexes on the Path table, one for the PathId field which is necessary for the PRIMARY KEY, and another on Path... They're not really related at all, and the index on Path has no uniqueness constraints.
As is also my understanding.
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users