Merged in v1.62-side changes to get the efficient db sync