When you look at this again please consider replacing the BerkeleyDB storage backend with a different database so that we can get rid of BerkeleyDB. See #1119186.