tdb2: copy tdb1's changed expansion logic.