Search in sources :

Example 1 with NodeRecordFormat

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());
}
Also used : RelationshipRecordFormat(org.neo4j.kernel.impl.store.format.standard.RelationshipRecordFormat) NodeRecordFormat(org.neo4j.kernel.impl.store.format.standard.NodeRecordFormat) PropertyRecordFormat(org.neo4j.kernel.impl.store.format.standard.PropertyRecordFormat) Test(org.junit.Test)

Example 2 with NodeRecordFormat

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);
}
Also used : IdGeneratorImpl(org.neo4j.kernel.impl.store.id.IdGeneratorImpl) IdGenerator(org.neo4j.kernel.impl.store.id.IdGenerator) NodeRecordFormat(org.neo4j.kernel.impl.store.format.standard.NodeRecordFormat) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 NodeRecordFormat (org.neo4j.kernel.impl.store.format.standard.NodeRecordFormat)2 PropertyRecordFormat (org.neo4j.kernel.impl.store.format.standard.PropertyRecordFormat)1 RelationshipRecordFormat (org.neo4j.kernel.impl.store.format.standard.RelationshipRecordFormat)1 IdGenerator (org.neo4j.kernel.impl.store.id.IdGenerator)1 IdGeneratorImpl (org.neo4j.kernel.impl.store.id.IdGeneratorImpl)1