Skip to content

Commit

Permalink
Strips a bunch of logic from store classes
Browse files Browse the repository at this point in the history
Which is a beginning towards having "naked" stores, ideally only a single store
class accepting a record format and all logic living outside. We're not there
yet, but:
- Moved a bunch of things from NodeStore --> DynamicNodeLabels
- Removes some stuff from RelationshipGroupStore, it's now naked
- Attempt to refer to RecordStore directly instead of RelationshipGroupStore
- Removes physical --> logical converter from PropertyStore
  • Loading branch information
tinwelint committed Feb 1, 2016
1 parent 4d7803a commit 23db4b0
Show file tree
Hide file tree
Showing 35 changed files with 222 additions and 159 deletions.
Expand Up @@ -33,6 +33,7 @@
import org.neo4j.kernel.impl.store.InvalidRecordException; import org.neo4j.kernel.impl.store.InvalidRecordException;
import org.neo4j.kernel.impl.store.NeoStores; import org.neo4j.kernel.impl.store.NeoStores;
import org.neo4j.kernel.impl.store.NodeStore; import org.neo4j.kernel.impl.store.NodeStore;
import org.neo4j.kernel.impl.store.RecordStore;
import org.neo4j.kernel.impl.store.RelationshipGroupStore; import org.neo4j.kernel.impl.store.RelationshipGroupStore;
import org.neo4j.kernel.impl.store.RelationshipStore; import org.neo4j.kernel.impl.store.RelationshipStore;
import org.neo4j.kernel.impl.store.record.NodeRecord; import org.neo4j.kernel.impl.store.record.NodeRecord;
Expand All @@ -59,7 +60,7 @@ public abstract class StoreAbstractNodeCursor extends NodeItemHelper implements
{ {
protected final NodeRecord nodeRecord; protected final NodeRecord nodeRecord;
protected NodeStore nodeStore; protected NodeStore nodeStore;
protected RelationshipGroupStore relationshipGroupStore; protected RecordStore<RelationshipGroupRecord> relationshipGroupStore;
protected RelationshipStore relationshipStore; protected RelationshipStore relationshipStore;
protected final LockService lockService; protected final LockService lockService;
protected StoreStatement storeStatement; protected StoreStatement storeStatement;
Expand Down
Expand Up @@ -24,9 +24,10 @@
import org.neo4j.kernel.impl.locking.Lock; import org.neo4j.kernel.impl.locking.Lock;
import org.neo4j.kernel.impl.locking.LockService; import org.neo4j.kernel.impl.locking.LockService;
import org.neo4j.kernel.impl.store.NeoStores; import org.neo4j.kernel.impl.store.NeoStores;
import org.neo4j.kernel.impl.store.RelationshipGroupStore; import org.neo4j.kernel.impl.store.RecordStore;
import org.neo4j.kernel.impl.store.RelationshipStore; import org.neo4j.kernel.impl.store.RelationshipStore;
import org.neo4j.kernel.impl.store.record.Record; import org.neo4j.kernel.impl.store.record.Record;
import org.neo4j.kernel.impl.store.record.RelationshipGroupRecord;
import org.neo4j.kernel.impl.store.record.RelationshipRecord; import org.neo4j.kernel.impl.store.record.RelationshipRecord;
import org.neo4j.kernel.impl.util.InstanceCache; import org.neo4j.kernel.impl.util.InstanceCache;
import org.neo4j.storageengine.api.PropertyItem; import org.neo4j.storageengine.api.PropertyItem;
Expand All @@ -43,7 +44,7 @@ public abstract class StoreAbstractRelationshipCursor extends EntityItemHelper
{ {
protected final RelationshipRecord relationshipRecord; protected final RelationshipRecord relationshipRecord;
protected final RelationshipStore relationshipStore; protected final RelationshipStore relationshipStore;
protected final RelationshipGroupStore relationshipGroupStore; protected final RecordStore<RelationshipGroupRecord> relationshipGroupStore;
private final LockService lockService; private final LockService lockService;
protected StoreStatement storeStatement; protected StoreStatement storeStatement;


Expand Down
Expand Up @@ -52,6 +52,7 @@
import org.neo4j.kernel.impl.api.TransactionApplierFacade; import org.neo4j.kernel.impl.api.TransactionApplierFacade;
import org.neo4j.kernel.impl.api.index.IndexingService; import org.neo4j.kernel.impl.api.index.IndexingService;
import org.neo4j.kernel.impl.api.index.IndexingServiceFactory; import org.neo4j.kernel.impl.api.index.IndexingServiceFactory;
import org.neo4j.kernel.impl.api.index.PropertyPhysicalToLogicalConverter;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig; import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider; import org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider;
import org.neo4j.kernel.impl.api.store.CacheLayer; import org.neo4j.kernel.impl.api.store.CacheLayer;
Expand Down Expand Up @@ -150,6 +151,7 @@ public class RecordStorageEngine implements StorageEngine, Lifecycle
private final WorkSync<IndexingService,IndexUpdatesWork> indexUpdatesSync; private final WorkSync<IndexingService,IndexUpdatesWork> indexUpdatesSync;
private final NeoStoreIndexStoreView indexStoreView; private final NeoStoreIndexStoreView indexStoreView;
private final LegacyIndexProviderLookup legacyIndexProviderLookup; private final LegacyIndexProviderLookup legacyIndexProviderLookup;
private final PropertyPhysicalToLogicalConverter indexUpdatesConverter;


// Immutable state for creating/applying commands // Immutable state for creating/applying commands
private final Loaders loaders; private final Loaders loaders;
Expand Down Expand Up @@ -199,6 +201,7 @@ public RecordStorageEngine(


try try
{ {
indexUpdatesConverter = new PropertyPhysicalToLogicalConverter( neoStores.getPropertyStore() );
schemaCache = new SchemaCache( constraintSemantics, Collections.<SchemaRule>emptyList() ); schemaCache = new SchemaCache( constraintSemantics, Collections.<SchemaRule>emptyList() );
schemaStorage = new SchemaStorage( neoStores.getSchemaStore() ); schemaStorage = new SchemaStorage( neoStores.getSchemaStore() );


Expand Down Expand Up @@ -358,7 +361,8 @@ private BatchTransactionApplierFacade applier( TransactionApplicationMode mode )


// Schema index application // Schema index application
appliers.add( new IndexBatchTransactionApplier( indexingService, labelScanStoreSync, indexUpdatesSync, appliers.add( new IndexBatchTransactionApplier( indexingService, labelScanStoreSync, indexUpdatesSync,
neoStores.getNodeStore(), neoStores.getPropertyStore(), new PropertyLoader( neoStores ), mode ) ); neoStores.getNodeStore(), neoStores.getPropertyStore(), new PropertyLoader( neoStores ),
indexUpdatesConverter, mode ) );


// Legacy index application // Legacy index application
appliers.add( appliers.add(
Expand Down
Expand Up @@ -1178,6 +1178,12 @@ public String toString()
return getClass().getSimpleName(); return getClass().getSimpleName();
} }


@Override
public int getStoreHeaderInt()
{
throw new UnsupportedOperationException( "No header" );
}

public static abstract class Configuration public static abstract class Configuration
{ {
public static final Setting<Boolean> rebuild_idgenerators_fast = public static final Setting<Boolean> rebuild_idgenerators_fast =
Expand Down
Expand Up @@ -111,6 +111,12 @@ protected boolean isInUse( PageCursor cursor )
return recordFormat.isInUse( cursor ); return recordFormat.isInUse( cursor );
} }


@Override
public int getStoreHeaderInt()
{
return ((IntStoreHeader) storeHeader).value();
}

@Override @Override
public <FAILURE extends Exception> void public <FAILURE extends Exception> void
accept( org.neo4j.kernel.impl.store.RecordStore.Processor<FAILURE> processor, RECORD record ) throws FAILURE accept( org.neo4j.kernel.impl.store.RecordStore.Processor<FAILURE> processor, RECORD record ) throws FAILURE
Expand Down
Expand Up @@ -19,10 +19,12 @@
*/ */
package org.neo4j.kernel.impl.store; package org.neo4j.kernel.impl.store;


import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;


import org.neo4j.helpers.collection.Pair;
import org.neo4j.kernel.impl.store.record.DynamicRecord; import org.neo4j.kernel.impl.store.record.DynamicRecord;
import org.neo4j.kernel.impl.store.record.NodeRecord; import org.neo4j.kernel.impl.store.record.NodeRecord;


Expand All @@ -36,7 +38,6 @@
import static org.neo4j.kernel.impl.store.NodeLabelsField.fieldPointsToDynamicRecordOfLabels; import static org.neo4j.kernel.impl.store.NodeLabelsField.fieldPointsToDynamicRecordOfLabels;
import static org.neo4j.kernel.impl.store.NodeLabelsField.firstDynamicLabelRecordId; import static org.neo4j.kernel.impl.store.NodeLabelsField.firstDynamicLabelRecordId;
import static org.neo4j.kernel.impl.store.NodeLabelsField.parseLabelsBody; import static org.neo4j.kernel.impl.store.NodeLabelsField.parseLabelsBody;
import static org.neo4j.kernel.impl.store.NodeStore.getDynamicLabelsArrayFromHeavyRecords;
import static org.neo4j.kernel.impl.store.PropertyType.ARRAY; import static org.neo4j.kernel.impl.store.PropertyType.ARRAY;


public class DynamicNodeLabels implements NodeLabels public class DynamicNodeLabels implements NodeLabels
Expand All @@ -62,7 +63,7 @@ public static long[] get( NodeRecord node, NodeStore nodeStore )
{ {
nodeStore.ensureHeavy( node, firstDynamicLabelRecordId( node.getLabelField() ) ); nodeStore.ensureHeavy( node, firstDynamicLabelRecordId( node.getLabelField() ) );
} }
return nodeStore.getDynamicLabelsArray( node.getUsedDynamicLabelRecords() ); return getDynamicLabelsArray( node.getUsedDynamicLabelRecords(), nodeStore.getDynamicLabelStore() );
} }


@Override @Override
Expand Down Expand Up @@ -104,7 +105,7 @@ public static Collection<DynamicRecord> putSorted( NodeRecord node, long[] label
{ {
Iterator<DynamicRecord> recycledRecords = changedDynamicRecords.iterator(); Iterator<DynamicRecord> recycledRecords = changedDynamicRecords.iterator();
Collection<DynamicRecord> allocatedRecords = Collection<DynamicRecord> allocatedRecords =
NodeStore.allocateRecordsForDynamicLabels( node.getId(), labelIds, allocateRecordsForDynamicLabels( node.getId(), labelIds,
recycledRecords, allocator ); recycledRecords, allocator );
// Set the rest of the previously set dynamic records as !inUse // Set the rest of the previously set dynamic records as !inUse
while ( recycledRecords.hasNext() ) while ( recycledRecords.hasNext() )
Expand All @@ -125,10 +126,10 @@ public Collection<DynamicRecord> add( long labelId, NodeStore nodeStore, Dynamic
{ {
nodeStore.ensureHeavy( node, firstDynamicLabelRecordId( labelField ) ); nodeStore.ensureHeavy( node, firstDynamicLabelRecordId( labelField ) );
Collection<DynamicRecord> existingRecords = node.getDynamicLabelRecords(); Collection<DynamicRecord> existingRecords = node.getDynamicLabelRecords();
long[] existingLabelIds = nodeStore.getDynamicLabelsArray( existingRecords ); long[] existingLabelIds = getDynamicLabelsArray( existingRecords, nodeStore.getDynamicLabelStore() );
long[] newLabelIds = LabelIdArray.concatAndSort( existingLabelIds, labelId ); long[] newLabelIds = LabelIdArray.concatAndSort( existingLabelIds, labelId );
Collection<DynamicRecord> changedDynamicRecords = Collection<DynamicRecord> changedDynamicRecords =
NodeStore.allocateRecordsForDynamicLabels( node.getId(), newLabelIds, existingRecords.iterator(), allocator ); allocateRecordsForDynamicLabels( node.getId(), newLabelIds, existingRecords.iterator(), allocator );
node.setLabelField( dynamicPointer( changedDynamicRecords ), changedDynamicRecords ); node.setLabelField( dynamicPointer( changedDynamicRecords ), changedDynamicRecords );
return changedDynamicRecords; return changedDynamicRecords;
} }
Expand All @@ -137,7 +138,8 @@ public Collection<DynamicRecord> add( long labelId, NodeStore nodeStore, Dynamic
public Collection<DynamicRecord> remove( long labelId, NodeStore nodeStore ) public Collection<DynamicRecord> remove( long labelId, NodeStore nodeStore )
{ {
nodeStore.ensureHeavy( node, firstDynamicLabelRecordId( labelField ) ); nodeStore.ensureHeavy( node, firstDynamicLabelRecordId( labelField ) );
long[] existingLabelIds = nodeStore.getDynamicLabelsArray( node.getUsedDynamicLabelRecords() ); long[] existingLabelIds = getDynamicLabelsArray( node.getUsedDynamicLabelRecords(),
nodeStore.getDynamicLabelStore() );
long[] newLabelIds = filter( existingLabelIds, labelId ); long[] newLabelIds = filter( existingLabelIds, labelId );
Collection<DynamicRecord> existingRecords = node.getDynamicLabelRecords(); Collection<DynamicRecord> existingRecords = node.getDynamicLabelRecords();
if ( InlineNodeLabels.tryInlineInNodeRecord( node, newLabelIds, existingRecords ) ) if ( InlineNodeLabels.tryInlineInNodeRecord( node, newLabelIds, existingRecords ) )
Expand All @@ -146,8 +148,8 @@ public Collection<DynamicRecord> remove( long labelId, NodeStore nodeStore )
} }
else else
{ {
Collection<DynamicRecord> newRecords = Collection<DynamicRecord> newRecords = allocateRecordsForDynamicLabels( node.getId(),
nodeStore.allocateRecordsForDynamicLabels( node.getId(), newLabelIds, existingRecords.iterator() ); newLabelIds, existingRecords.iterator(), nodeStore.getDynamicLabelStore() );
node.setLabelField( dynamicPointer( newRecords ), existingRecords ); node.setLabelField( dynamicPointer( newRecords ), existingRecords );
if ( !newRecords.equals( existingRecords ) ) if ( !newRecords.equals( existingRecords ) )
{ // One less dynamic record, mark that one as not in use { // One less dynamic record, mark that one as not in use
Expand Down Expand Up @@ -197,4 +199,42 @@ public String toString()
return format( "Dynamic(id:%d,[%s])", firstDynamicLabelRecordId( node.getLabelField() ), return format( "Dynamic(id:%d,[%s])", firstDynamicLabelRecordId( node.getLabelField() ),
Arrays.toString( getDynamicLabelsArrayFromHeavyRecords( node.getUsedDynamicLabelRecords() ) ) ); Arrays.toString( getDynamicLabelsArrayFromHeavyRecords( node.getUsedDynamicLabelRecords() ) ) );
} }

public static Collection<DynamicRecord> allocateRecordsForDynamicLabels( long nodeId, long[] labels,
Iterator<DynamicRecord> useFirst, AbstractDynamicStore dynamicLabelStore )
{
return allocateRecordsForDynamicLabels( nodeId, labels, useFirst, (DynamicRecordAllocator)dynamicLabelStore );
}

public static Collection<DynamicRecord> allocateRecordsForDynamicLabels( long nodeId, long[] labels,
Iterator<DynamicRecord> useFirst, DynamicRecordAllocator allocator )
{
long[] storedLongs = LabelIdArray.prependNodeId( nodeId, labels );
Collection<DynamicRecord> records = new ArrayList<>();
DynamicArrayStore.allocateRecords( records, storedLongs, useFirst, allocator );
return records;
}

public static long[] getDynamicLabelsArray( Iterable<DynamicRecord> records,
AbstractDynamicStore dynamicLabelStore )
{
long[] storedLongs = (long[])
DynamicArrayStore.getRightArray( dynamicLabelStore.readFullByteArray( records, PropertyType.ARRAY ) );
return LabelIdArray.stripNodeId( storedLongs );
}

public static long[] getDynamicLabelsArrayFromHeavyRecords( Iterable<DynamicRecord> records )
{
long[] storedLongs = (long[])
DynamicArrayStore.getRightArray( readFullByteArrayFromHeavyRecords( records, PropertyType.ARRAY ) );
return LabelIdArray.stripNodeId( storedLongs );
}

public static Pair<Long, long[]> getDynamicLabelsArrayAndOwner( Iterable<DynamicRecord> records,
AbstractDynamicStore dynamicLabelStore )
{
long[] storedLongs = (long[])
DynamicArrayStore.getRightArray( dynamicLabelStore.readFullByteArray( records, PropertyType.ARRAY ) );
return Pair.of(storedLongs[0], LabelIdArray.stripNodeId( storedLongs ));
}
} }
Expand Up @@ -42,6 +42,7 @@
import org.neo4j.kernel.impl.store.id.IdGeneratorFactory; import org.neo4j.kernel.impl.store.id.IdGeneratorFactory;
import org.neo4j.kernel.impl.store.id.IdType; import org.neo4j.kernel.impl.store.id.IdType;
import org.neo4j.kernel.impl.store.kvstore.DataInitializer; import org.neo4j.kernel.impl.store.kvstore.DataInitializer;
import org.neo4j.kernel.impl.store.record.RelationshipGroupRecord;
import org.neo4j.kernel.info.DiagnosticsManager; import org.neo4j.kernel.info.DiagnosticsManager;
import org.neo4j.logging.Log; import org.neo4j.logging.Log;
import org.neo4j.logging.LogProvider; import org.neo4j.logging.LogProvider;
Expand Down Expand Up @@ -326,10 +327,7 @@ private DynamicStringStore getPropertyKeyTokenNamesStore()
return (DynamicStringStore) getStore( StoreType.PROPERTY_KEY_TOKEN_NAME ); return (DynamicStringStore) getStore( StoreType.PROPERTY_KEY_TOKEN_NAME );
} }


/** public RecordStore<RelationshipGroupRecord> getRelationshipGroupStore()
* @return the {@link RelationshipGroupStore}
*/
public RelationshipGroupStore getRelationshipGroupStore()
{ {
return (RelationshipGroupStore) getStore( StoreType.RELATIONSHIP_GROUP ); return (RelationshipGroupStore) getStore( StoreType.RELATIONSHIP_GROUP );
} }
Expand Down
Expand Up @@ -20,12 +20,8 @@
package org.neo4j.kernel.impl.store; package org.neo4j.kernel.impl.store;


import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;


import org.neo4j.helpers.collection.Pair;
import org.neo4j.io.pagecache.PageCache; import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.configuration.Config; import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.store.format.RecordFormat; import org.neo4j.kernel.impl.store.format.RecordFormat;
Expand All @@ -37,7 +33,6 @@
import org.neo4j.kernel.impl.util.Bits; import org.neo4j.kernel.impl.util.Bits;
import org.neo4j.logging.LogProvider; import org.neo4j.logging.LogProvider;


import static org.neo4j.kernel.impl.store.AbstractDynamicStore.readFullByteArrayFromHeavyRecords;
import static org.neo4j.kernel.impl.store.NoStoreHeaderFormat.NO_STORE_HEADER_FORMAT; import static org.neo4j.kernel.impl.store.NoStoreHeaderFormat.NO_STORE_HEADER_FORMAT;


/** /**
Expand Down Expand Up @@ -121,42 +116,6 @@ public DynamicArrayStore getDynamicLabelStore()
return dynamicLabelStore; return dynamicLabelStore;
} }


public Collection<DynamicRecord> allocateRecordsForDynamicLabels( long nodeId, long[] labels,
Iterator<DynamicRecord> useFirst )
{
return allocateRecordsForDynamicLabels( nodeId, labels, useFirst, dynamicLabelStore );
}

public static Collection<DynamicRecord> allocateRecordsForDynamicLabels( long nodeId, long[] labels,
Iterator<DynamicRecord> useFirst, DynamicRecordAllocator allocator )
{
long[] storedLongs = LabelIdArray.prependNodeId( nodeId, labels );
Collection<DynamicRecord> records = new ArrayList<>();
DynamicArrayStore.allocateRecords( records, storedLongs, useFirst, allocator );
return records;
}

public long[] getDynamicLabelsArray( Iterable<DynamicRecord> records )
{
long[] storedLongs = (long[])
DynamicArrayStore.getRightArray( dynamicLabelStore.readFullByteArray( records, PropertyType.ARRAY ) );
return LabelIdArray.stripNodeId( storedLongs );
}

public static long[] getDynamicLabelsArrayFromHeavyRecords( Iterable<DynamicRecord> records )
{
long[] storedLongs = (long[])
DynamicArrayStore.getRightArray( readFullByteArrayFromHeavyRecords( records, PropertyType.ARRAY ) );
return LabelIdArray.stripNodeId( storedLongs );
}

public Pair<Long, long[]> getDynamicLabelsArrayAndOwner( Iterable<DynamicRecord> records )
{
long[] storedLongs = (long[])
DynamicArrayStore.getRightArray( dynamicLabelStore.readFullByteArray( records, PropertyType.ARRAY ) );
return Pair.of(storedLongs[0], LabelIdArray.stripNodeId( storedLongs ));
}

public void updateDynamicLabelRecords( Iterable<DynamicRecord> dynamicLabelRecords ) public void updateDynamicLabelRecords( Iterable<DynamicRecord> dynamicLabelRecords )
{ {
for ( DynamicRecord record : dynamicLabelRecords ) for ( DynamicRecord record : dynamicLabelRecords )
Expand Down
Expand Up @@ -34,9 +34,7 @@
import org.neo4j.io.pagecache.PageCache; import org.neo4j.io.pagecache.PageCache;
import org.neo4j.io.pagecache.PageCursor; import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.io.pagecache.PagedFile; import org.neo4j.io.pagecache.PagedFile;
import org.neo4j.kernel.api.index.NodePropertyUpdate;
import org.neo4j.kernel.configuration.Config; import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.api.index.PropertyPhysicalToLogicalConverter;
import org.neo4j.kernel.impl.api.store.PropertyRecordCursor; import org.neo4j.kernel.impl.api.store.PropertyRecordCursor;
import org.neo4j.kernel.impl.store.format.RecordFormat; import org.neo4j.kernel.impl.store.format.RecordFormat;
import org.neo4j.kernel.impl.store.id.IdGeneratorFactory; import org.neo4j.kernel.impl.store.id.IdGeneratorFactory;
Expand All @@ -47,7 +45,6 @@
import org.neo4j.kernel.impl.store.record.PropertyRecord; import org.neo4j.kernel.impl.store.record.PropertyRecord;
import org.neo4j.kernel.impl.store.record.Record; import org.neo4j.kernel.impl.store.record.Record;
import org.neo4j.kernel.impl.store.record.RecordLoad; import org.neo4j.kernel.impl.store.record.RecordLoad;
import org.neo4j.kernel.impl.transaction.state.PropertyRecordChange;
import org.neo4j.logging.LogProvider; import org.neo4j.logging.LogProvider;


import static org.neo4j.helpers.collection.IteratorUtil.first; import static org.neo4j.helpers.collection.IteratorUtil.first;
Expand All @@ -70,7 +67,6 @@ public static abstract class Configuration extends CommonAbstractStore.Configura
private final DynamicStringStore stringStore; private final DynamicStringStore stringStore;
private final PropertyKeyTokenStore propertyKeyTokenStore; private final PropertyKeyTokenStore propertyKeyTokenStore;
private final DynamicArrayStore arrayStore; private final DynamicArrayStore arrayStore;
private final PropertyPhysicalToLogicalConverter physicalToLogicalConverter;


public PropertyStore( public PropertyStore(
File fileName, File fileName,
Expand All @@ -88,7 +84,6 @@ public PropertyStore(
this.stringStore = stringPropertyStore; this.stringStore = stringPropertyStore;
this.propertyKeyTokenStore = propertyKeyTokenStore; this.propertyKeyTokenStore = propertyKeyTokenStore;
this.arrayStore = arrayPropertyStore; this.arrayStore = arrayPropertyStore;
this.physicalToLogicalConverter = new PropertyPhysicalToLogicalConverter( this );
} }


@Override @Override
Expand Down Expand Up @@ -428,35 +423,6 @@ public Collection<PropertyRecord> getPropertyRecordChain( long firstRecordId,
return toReturn; return toReturn;
} }


public void toLogicalUpdates( Collection<NodePropertyUpdate> target,
Iterable<PropertyRecordChange> changes,
long[] nodeLabelsBefore,
long[] nodeLabelsAfter )
{
physicalToLogicalConverter.apply( target, changes, nodeLabelsBefore, nodeLabelsAfter );
}

/**
* For property records there's no "inUse" byte and we need to read the whole record to
* see if there are any PropertyBlocks in use in it.
*/
@Override
protected boolean isInUse( PageCursor cursor )
{
int offsetAtBeginning = cursor.getOffset();
cursor.setOffset( offsetAtBeginning + 1/*mod*/ + 4/*prev*/ + 4/*next*/ );
int recordSize = getRecordSize();
while ( cursor.getOffset() - offsetAtBeginning < recordSize )
{
long block = cursor.getLong();
if ( PropertyType.getPropertyType( block, true ) != null )
{
return true;
}
}
return false;
}

@Override @Override
public PropertyRecord newRecord() public PropertyRecord newRecord()
{ {
Expand Down

0 comments on commit 23db4b0

Please sign in to comment.