Make the odb race-free This change adds all the necessary locking to the odb to avoid races in the backends. Part of: #5592