Hi,
This is a fun one!
While migrating data with version 4.2.11 from a complex to a simple resource hierarchy, iphymv for some data objects results in a SYS_LIBRARY_ERROR. In the rodsLog on the server, it shows a bit more detail:
ERROR: duplicate key value violates unique constraint "idx_data_main2" Key (coll_id, data_name, data_repl_num, data_version)=(...) already exists.;
Looking at the "ils -L" output for these, all data objects have two of the replicas in the same resource hierarchy. The data_paths of these fall into three categories: the both have the exact same data_path, they have the same data_path with the exception of an added numeric extension, or they have the the same data_path with an added "replica" component before the "home" component. It looks like some combination of these:
/path/to/unixfilesystem/home/collection/file.ext
/path/to/unixfilesystem/home/collection/file.ext.0123456789
/path/to/unixfilesystem/replica/home/collection/file.ext
/path/to/unixfilesystem/replica/home/collection/file.ext.0123456789
The "fix" to this seems to be to "iunreg" one of the two if they are identical, or if not, "itrim" one once they are confirmed to be the same on disk. I have not tried either of these approaches yet, but I suspect they might also give trouble. If that is the case, I can always manually delete a row from the ICAT and delete the corresponding file on disk as a last resort.
For a few of them, this approach is feasible. As the number of these instances increases, however, there comes a point where it is infeasible to to do it manually. I am far, far beyond that point, unfortunately.
Might there be some "magic bullet" for these, or is my only option to brute force it?
Cheers,
--John