Fixes an issue with high id being too high after recovery

due to giving the IdGenerator the wrong highId in its constructor. It used
to give it fileSize/recordSize, but now gives it the highest inUse record id.

Also deduplicated 3 versions of rebuildIdGenerator, 2 versions of
figureOutHighestIdInUse (which was badly named btw) and some other
deduplication.
Merge pull request #3095 from tinwelint/1.9-fix-too-high-id

[1.9] Fixes an issue with high id being too high after recovery