Search in sources :

Example 6 with DynamicRecord

use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.

the class StorePropertyCursorTest method markDynamicRecordsNotInUse.

private static void markDynamicRecordsNotInUse(int keyId, PropertyRecord record, PropertyStore store, int... dynamicRecordIndexes) {
    PropertyBlock propertyBlock = record.getPropertyBlock(keyId);
    store.ensureHeavy(propertyBlock);
    List<DynamicRecord> valueRecords = propertyBlock.getValueRecords();
    for (int index : dynamicRecordIndexes) {
        DynamicRecord dynamicRecord = valueRecords.get(index);
        dynamicRecord.setInUse(false);
    }
    updateRecord(store, record);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) PropertyBlock(org.neo4j.kernel.impl.store.record.PropertyBlock)

Example 7 with DynamicRecord

use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.

the class StorePropertyCursorTest method newStorePropertyCursor.

private static StorePropertyCursor newStorePropertyCursor(PropertyStore propertyStore, Consumer<StorePropertyCursor> cache) {
    RecordCursor<PropertyRecord> propertyRecordCursor = propertyStore.newRecordCursor(propertyStore.newRecord());
    propertyRecordCursor.acquire(0, NORMAL);
    DynamicStringStore stringStore = propertyStore.getStringStore();
    RecordCursor<DynamicRecord> dynamicStringCursor = stringStore.newRecordCursor(stringStore.nextRecord());
    dynamicStringCursor.acquire(0, NORMAL);
    DynamicArrayStore arrayStore = propertyStore.getArrayStore();
    RecordCursor<DynamicRecord> dynamicArrayCursor = arrayStore.newRecordCursor(arrayStore.nextRecord());
    dynamicArrayCursor.acquire(0, NORMAL);
    RecordCursors cursors = mock(RecordCursors.class);
    when(cursors.property()).thenReturn(propertyRecordCursor);
    when(cursors.propertyString()).thenReturn(dynamicStringCursor);
    when(cursors.propertyArray()).thenReturn(dynamicArrayCursor);
    return new StorePropertyCursor(cursors, cache);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) DynamicStringStore(org.neo4j.kernel.impl.store.DynamicStringStore) RecordCursors(org.neo4j.kernel.impl.store.RecordCursors) DynamicArrayStore(org.neo4j.kernel.impl.store.DynamicArrayStore)

Example 8 with DynamicRecord

use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.

the class ManyPropertyKeysIT method databaseWithManyPropertyKeys.

private GraphDatabaseAPI databaseWithManyPropertyKeys(int propertyKeyCount) throws IOException {
    PageCache pageCache = pageCacheRule.getPageCache(fileSystemRule.get());
    StoreFactory storeFactory = new StoreFactory(storeDir, pageCache, fileSystemRule.get(), NullLogProvider.getInstance());
    NeoStores neoStores = storeFactory.openAllNeoStores(true);
    PropertyKeyTokenStore store = neoStores.getPropertyKeyTokenStore();
    for (int i = 0; i < propertyKeyCount; i++) {
        PropertyKeyTokenRecord record = new PropertyKeyTokenRecord((int) store.nextId());
        record.setInUse(true);
        Collection<DynamicRecord> nameRecords = store.allocateNameRecords(PropertyStore.encodeString(key(i)));
        record.addNameRecords(nameRecords);
        record.setNameId((int) Iterables.first(nameRecords).getId());
        store.updateRecord(record);
    }
    neoStores.close();
    return database();
}
Also used : PropertyKeyTokenStore(org.neo4j.kernel.impl.store.PropertyKeyTokenStore) DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) NeoStores(org.neo4j.kernel.impl.store.NeoStores) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) PageCache(org.neo4j.io.pagecache.PageCache) PropertyKeyTokenRecord(org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)

Example 9 with DynamicRecord

use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.

the class TransactionRecordStateTest method assertDynamicLabelRecordInUse.

private void assertDynamicLabelRecordInUse(NeoStores store, long id, boolean inUse) {
    DynamicArrayStore dynamicLabelStore = store.getNodeStore().getDynamicLabelStore();
    DynamicRecord record = dynamicLabelStore.getRecord(id, dynamicLabelStore.nextRecord(), FORCE);
    assertTrue(inUse == record.inUse());
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) DynamicArrayStore(org.neo4j.kernel.impl.store.DynamicArrayStore)

Example 10 with DynamicRecord

use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.

the class LogTruncationTest method createRelationshipTypeTokenRecord.

private RelationshipTypeTokenRecord createRelationshipTypeTokenRecord(int id) {
    RelationshipTypeTokenRecord relationshipTypeTokenRecord = new RelationshipTypeTokenRecord(id);
    relationshipTypeTokenRecord.setInUse(true);
    relationshipTypeTokenRecord.setNameId(333);
    relationshipTypeTokenRecord.addNameRecord(new DynamicRecord(43));
    return relationshipTypeTokenRecord;
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)

Aggregations

DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)225 Test (org.junit.Test)117 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)51 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)38 ArrayList (java.util.ArrayList)32 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)28 LabelTokenRecord (org.neo4j.kernel.impl.store.record.LabelTokenRecord)23 IndexRule (org.neo4j.kernel.impl.store.record.IndexRule)21 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)21 IOException (java.io.IOException)20 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)16 ReusableRecordsAllocator (org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator)16 ConstraintRule (org.neo4j.kernel.impl.store.record.ConstraintRule)16 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)16 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)15 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)15 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)15 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)15 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)14 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)14