neo4j/neo4j — pull request #2835 by tinwelint (2014-08-12 11:07:41+00:00)
Title: Sets correct highId when applying recovered transactions

When applying recovered transactions to the store the id generators needs
to be notified while applying. That was done, but there was an off-by-one
error where the id generator would be told that the new high id was id of
the created entity, even though "high id" means "the id of the next
created record, given there are no more free ids". So the correct thing to
do is to set high id to the created entity + 1.

Problem became visible when a transaction that create a new record that
got the highest id to date was recovered and applied, followed by another
recovered transaction that deleted that record. The id generator would say
that the id was invalid.

This commit fixes that and introduces a
CommonAbstractStore#setHighestPossibleIdInUse(long) method for that to alleviate
callers to do the +1 on their own everywhere.