There are two changes here, submitted together because they both involve sdsqlutils.py.
Upon a retry, the failed_url table should be cleared for the retried files. Otherwise they can't be properly retried.
On rare occasions I have seen Synda crash due to duplicate database entries for the same file or similar problems which aren't supposed to happen. This change deals with them by logging an error message, changing a filename, and assigning a special status. Clearing up the problem has to be done manually, but with this change it is not urgent.
There are two changes here, submitted together because they both involve sdsqlutils.py.