Bring in commit 45edb70 from 2.8.x to make batch import transactional and
faster