Retry on index-related IntegrityErrors

closes #1629