lib/ldb: Ensure rename target does not exist before deleting old record