autorid: make the whole initialization atomic with one transaction.