use of org.neo4j.kernel.impl.store.format.standard.NodeRecordFormat in project neo4j by neo4j.
the class IdGeneratorTest method makeSureMagicMinusOneIsNotReturnedFromNodeIdGenerator.
@Test
public void makeSureMagicMinusOneIsNotReturnedFromNodeIdGenerator() throws Exception {
makeSureMagicMinusOneIsSkipped(new NodeRecordFormat());
makeSureMagicMinusOneIsSkipped(new RelationshipRecordFormat());
makeSureMagicMinusOneIsSkipped(new PropertyRecordFormat());
}
use of org.neo4j.kernel.impl.store.format.standard.NodeRecordFormat in project neo4j by neo4j.
the class IdGeneratorTest method makeSureMagicMinusOneCannotBeReturnedEvenIfFreed.
@Test
public void makeSureMagicMinusOneCannotBeReturnedEvenIfFreed() throws Exception {
IdGeneratorImpl.createGenerator(fs, idGeneratorFile(), 0, false);
IdGenerator idGenerator = new IdGeneratorImpl(fs, idGeneratorFile(), 1, new NodeRecordFormat().getMaxId(), false, 0);
long magicMinusOne = (long) Math.pow(2, 32) - 1;
idGenerator.setHighId(magicMinusOne);
assertEquals(magicMinusOne + 1, idGenerator.nextId());
idGenerator.freeId(magicMinusOne - 1);
idGenerator.freeId(magicMinusOne);
closeIdGenerator(idGenerator);
idGenerator = new IdGeneratorImpl(fs, idGeneratorFile(), 1, new NodeRecordFormat().getMaxId(), false, 0);
assertEquals(magicMinusOne - 1, idGenerator.nextId());
assertEquals(magicMinusOne + 2, idGenerator.nextId());
closeIdGenerator(idGenerator);
}
Aggregations