本文整理了Java中org.neo4j.kernel.impl.store.NodeStore.getHighId()
方法的一些代码示例,展示了NodeStore.getHighId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NodeStore.getHighId()
方法的具体详情如下:
包路径:org.neo4j.kernel.impl.store.NodeStore
类名称:NodeStore
方法名:getHighId
暂无
代码示例来源:origin: neo4j/neo4j
private RecordProxy<NodeRecord,Void> getNodeRecord( long id )
{
if ( id < 0 || id >= nodeStore.getHighId() )
{
throw new NotFoundException( "id=" + id );
}
return recordAccess.getNodeRecords().getOrLoad( id, null );
}
代码示例来源:origin: neo4j/neo4j
@Override
public void createNode( long id, Map<String, Object> properties, Label... labels )
{
IdValidator.assertValidId( IdType.NODE, id, maxNodeId );
if ( nodeStore.isInUse( id ) )
{
throw new IllegalArgumentException( "id=" + id + " already in use" );
}
long highId = nodeStore.getHighId();
if ( highId <= id )
{
nodeStore.setHighestPossibleIdInUse( id );
}
internalCreateNode( id, properties, labels );
}
代码示例来源:origin: neo4j/neo4j
private static ExecutionMonitor migrationBatchImporterMonitor( NeoStores legacyStore, final ProgressReporter progressReporter, Configuration config )
{
return new BatchImporterProgressMonitor(
legacyStore.getNodeStore().getHighId(), legacyStore.getRelationshipStore().getHighId(),
config, progressReporter );
}
代码示例来源:origin: neo4j/neo4j
/**
* Optimizes the relationship groups store by physically locating groups for each node together.
*/
public void defragmentRelationshipGroups()
{
// Defragment relationships groups for better performance
new RelationshipGroupDefragmenter( config, executionMonitor, RelationshipGroupDefragmenter.Monitor.EMPTY, numberArrayFactory )
.run( max( maxMemory, peakMemoryUsage ), neoStore, neoStore.getNodeStore().getHighId() );
}
代码示例来源:origin: neo4j/neo4j
@Test
void scanForHighIdOnlyOnceWhenProcessCache()
{
NeoStores neoStores = mock( NeoStores.class, Mockito.RETURNS_MOCKS );
NodeStore nodeStore = mock( NodeStore.class );
NodeRecord nodeRecord = mock( NodeRecord.class );
StoreProcessor storeProcessor = mock( StoreProcessor.class );
when( neoStores.getNodeStore() ).thenReturn( nodeStore );
when( nodeStore.getHighId() ).thenReturn( 10L );
when( nodeStore.getRecord( anyLong(), any( NodeRecord.class ), any( RecordLoad.class ) ) ).thenReturn( nodeRecord );
when( nodeStore.newRecord() ).thenReturn( nodeRecord );
StoreAccess storeAccess = new StoreAccess( neoStores );
storeAccess.initialize();
CacheTask.CheckNextRel cacheTask = new CacheTask.CheckNextRel( Stage.SEQUENTIAL_FORWARD, new DefaultCacheAccess( Counts.NONE, 1 ),
storeAccess, storeProcessor );
cacheTask.processCache();
verify( nodeStore, times( 1 ) ).getHighId();
}
}
代码示例来源:origin: neo4j/neo4j
@Test
public void shouldBeAbleToForceStoreScan() throws Exception
{
when( labelScanStore.newReader() ).thenThrow( new RuntimeException( "Should not be used" ) );
when( nodeStore.getHighestPossibleIdInUse() ).thenReturn( 200L );
when( nodeStore.getHighId() ).thenReturn( 20L );
when( nodeStore.openPageCursorForReading( anyLong() ) ).thenReturn( mock( PageCursor.class ) );
mockLabelNodeCount( countStore, 2 );
mockLabelNodeCount( countStore, 6 );
DynamicIndexStoreView storeView = dynamicIndexStoreView();
StoreScan<Exception> storeScan = storeView
.visitNodes( new int[]{2, 6}, propertyKeyIdFilter, propertyUpdateVisitor, labelUpdateVisitor, true );
storeScan.run();
Mockito.verify( nodeStore, times( 1 ) )
.getRecordByCursor( anyLong(), any( NodeRecord.class ), any( RecordLoad.class ), any( PageCursor.class ) );
Mockito.verify( nodeStore, times( 200 ) )
.nextRecordByCursor( any( NodeRecord.class ), any( RecordLoad.class ), any( PageCursor.class ) );
}
代码示例来源:origin: neo4j/neo4j
@Test
public void visitOnlyLabeledNodes() throws Exception
{
LabelScanReader labelScanReader = mock( LabelScanReader.class );
when( labelScanStore.newReader() ).thenReturn( labelScanReader );
when( nodeLabelRanges.maxCount() ).thenReturn( 1L );
PrimitiveLongResourceIterator labeledNodesIterator = PrimitiveLongResourceCollections.iterator( null, 1, 2, 3, 4, 5, 6, 7, 8 );
when( nodeStore.getHighestPossibleIdInUse() ).thenReturn( 200L );
when( nodeStore.getHighId() ).thenReturn( 20L );
when( labelScanReader.nodesWithAnyOfLabels( new int[] {2, 6} ) ).thenReturn( labeledNodesIterator );
when( nodeStore.openPageCursorForReading( anyLong() ) ).thenReturn( mock( PageCursor.class ) );
mockLabelNodeCount( countStore, 2 );
mockLabelNodeCount( countStore, 6 );
DynamicIndexStoreView storeView = dynamicIndexStoreView();
StoreScan<Exception> storeScan = storeView
.visitNodes( new int[]{2, 6}, propertyKeyIdFilter, propertyUpdateVisitor, labelUpdateVisitor, false );
storeScan.run();
Mockito.verify( nodeStore, times( 8 ) )
.getRecordByCursor( anyLong(), any( NodeRecord.class ), any( RecordLoad.class ), any( PageCursor.class ) );
}
代码示例来源:origin: neo4j/neo4j
@Test
public void iterateOverLabeledNodeIds()
{
PrimitiveLongResourceIterator labeledNodes = PrimitiveLongResourceCollections.iterator( null, 1, 2, 4, 8 );
when( nodeStore.getHighId() ).thenReturn( 15L );
int[] labelIds = new int[]{1, 2};
when( labelScanReader.nodesWithAnyOfLabels( labelIds ) ).thenReturn( labeledNodes );
LabelScanViewNodeStoreScan<Exception> storeScan = getLabelScanViewStoreScan( labelIds );
PrimitiveLongResourceIterator idIterator = storeScan.getEntityIdIterator();
List<Long> visitedNodeIds = PrimitiveLongCollections.asList( idIterator );
assertThat(visitedNodeIds, Matchers.hasSize( 4 ));
assertThat( visitedNodeIds, Matchers.hasItems( 1L, 2L, 4L, 8L ) );
}
代码示例来源:origin: neo4j/neo4j
private boolean databaseExistsAndContainsData()
{
File metaDataFile = databaseLayout.metadataStore();
try ( PagedFile pagedFile = pageCache.map( metaDataFile, pageCache.pageSize(), StandardOpenOption.READ ) )
{
// OK so the db probably exists
}
catch ( IOException e )
{
// It's OK
return false;
}
try ( NeoStores stores = newStoreFactory( databaseLayout ).openNeoStores( StoreType.NODE, StoreType.RELATIONSHIP ) )
{
return stores.getNodeStore().getHighId() > 0 || stores.getRelationshipStore().getHighId() > 0;
}
}
代码示例来源:origin: neo4j/neo4j
/**
* Populates {@link NodeRelationshipCache} with node degrees, which is required to know how to physically layout each
* relationship chain. This is required before running {@link #linkRelationships(int)}.
*/
public void calculateNodeDegrees()
{
Configuration relationshipConfig =
configWithRecordsPerPageBasedBatchSize( config, neoStore.getRelationshipStore() );
nodeRelationshipCache.setNodeCount( neoStore.getNodeStore().getHighId() );
MemoryUsageStatsProvider memoryUsageStats = new MemoryUsageStatsProvider( neoStore, nodeRelationshipCache );
NodeDegreeCountStage nodeDegreeStage = new NodeDegreeCountStage( relationshipConfig,
neoStore.getRelationshipStore(), nodeRelationshipCache, memoryUsageStats );
executeStage( nodeDegreeStage );
nodeRelationshipCache.countingCompleted();
availableMemoryForLinking = maxMemory - totalMemoryUsageOf( nodeRelationshipCache, neoStore );
}
代码示例来源:origin: neo4j/neo4j
when( nodeStore.getHighId() ).thenReturn( total );
NodeRecord emptyRecord = new NodeRecord( 0 );
NodeRecord inUseRecord = new NodeRecord( 42 );
代码示例来源:origin: neo4j/neo4j
@Test
public void shouldSetCorrectHighIdWhenApplyingExternalTransactions() throws Exception
{
// WHEN recovering a transaction that creates some data
long nodeId = neoStores.getNodeStore().nextId();
long relationshipId = neoStores.getRelationshipStore().nextId();
int type = 1;
applyExternalTransaction( 1,
new NodeCommand( new NodeRecord( nodeId ), inUse( created( new NodeRecord( nodeId ) ) ) ),
new RelationshipCommand( null,
inUse( created( with( new RelationshipRecord( relationshipId ), nodeId, nodeId, type ) ) ) ) );
// and when, later on, recovering a transaction deleting some of those
applyExternalTransaction( 2,
new NodeCommand( inUse( created( new NodeRecord( nodeId ) ) ), new NodeRecord( nodeId ) ),
new RelationshipCommand( null, new RelationshipRecord( relationshipId ) ) );
// THEN that should be possible and the high ids should be correct, i.e. highest applied + 1
assertEquals( nodeId + 1, neoStores.getNodeStore().getHighId() );
assertEquals( relationshipId + 1, neoStores.getRelationshipStore().getHighId() );
}
代码示例来源:origin: neo4j/neo4j
assertEquals( node.getSecondaryUnitId() + 1, neoStores.getNodeStore().getHighId() );
assertEquals( relationship.getSecondaryUnitId() + 1, neoStores.getRelationshipStore().getHighId() );
assertEquals( relationshipGroup.getSecondaryUnitId() + 1, neoStores.getRelationshipGroupStore().getHighId() );
代码示例来源:origin: neo4j/neo4j
assertEquals( "NodeStore", 20 + 1, neoStores.getNodeStore().getHighId() );
assertEquals( "DynamicNodeLabelStore", 5 + 1, neoStores.getNodeStore().getDynamicLabelStore().getHighId() );
assertEquals( "RelationshipStore", 45 + 1, neoStores.getRelationshipStore().getHighId() );
代码示例来源:origin: org.neo4j/neo4j-kernel
private RecordProxy<NodeRecord,Void> getNodeRecord( long id )
{
if ( id < 0 || id >= nodeStore.getHighId() )
{
throw new NotFoundException( "id=" + id );
}
return recordAccess.getNodeRecords().getOrLoad( id, null );
}
代码示例来源:origin: org.neo4j/neo4j-kernel
@Override
public void createNode( long id, Map<String, Object> properties, Label... labels )
{
IdValidator.assertValidId( IdType.NODE, id, maxNodeId );
if ( nodeStore.isInUse( id ) )
{
throw new IllegalArgumentException( "id=" + id + " already in use" );
}
long highId = nodeStore.getHighId();
if ( highId <= id )
{
nodeStore.setHighestPossibleIdInUse( id );
}
internalCreateNode( id, properties, labels );
}
代码示例来源:origin: org.neo4j/neo4j-kernel
private static ExecutionMonitor migrationBatchImporterMonitor( NeoStores legacyStore, final ProgressReporter progressReporter, Configuration config )
{
return new BatchImporterProgressMonitor(
legacyStore.getNodeStore().getHighId(), legacyStore.getRelationshipStore().getHighId(),
config, progressReporter );
}
代码示例来源:origin: org.neo4j/neo4j-kernel
/**
* Optimizes the relationship groups store by physically locating groups for each node together.
*/
public void defragmentRelationshipGroups()
{
// Defragment relationships groups for better performance
new RelationshipGroupDefragmenter( config, executionMonitor, RelationshipGroupDefragmenter.Monitor.EMPTY, numberArrayFactory )
.run( max( maxMemory, peakMemoryUsage ), neoStore, neoStore.getNodeStore().getHighId() );
}
代码示例来源:origin: org.neo4j/neo4j-kernel
private boolean databaseExistsAndContainsData()
{
File metaDataFile = databaseLayout.metadataStore();
try ( PagedFile pagedFile = pageCache.map( metaDataFile, pageCache.pageSize(), StandardOpenOption.READ ) )
{
// OK so the db probably exists
}
catch ( IOException e )
{
// It's OK
return false;
}
try ( NeoStores stores = newStoreFactory( databaseLayout ).openNeoStores( StoreType.NODE, StoreType.RELATIONSHIP ) )
{
return stores.getNodeStore().getHighId() > 0 || stores.getRelationshipStore().getHighId() > 0;
}
}
代码示例来源:origin: org.neo4j/neo4j-kernel
/**
* Populates {@link NodeRelationshipCache} with node degrees, which is required to know how to physically layout each
* relationship chain. This is required before running {@link #linkRelationships(int)}.
*/
public void calculateNodeDegrees()
{
Configuration relationshipConfig =
configWithRecordsPerPageBasedBatchSize( config, neoStore.getRelationshipStore() );
nodeRelationshipCache.setNodeCount( neoStore.getNodeStore().getHighId() );
MemoryUsageStatsProvider memoryUsageStats = new MemoryUsageStatsProvider( neoStore, nodeRelationshipCache );
NodeDegreeCountStage nodeDegreeStage = new NodeDegreeCountStage( relationshipConfig,
neoStore.getRelationshipStore(), nodeRelationshipCache, memoryUsageStats );
executeStage( nodeDegreeStage );
nodeRelationshipCache.countingCompleted();
availableMemoryForLinking = maxMemory - totalMemoryUsageOf( nodeRelationshipCache, neoStore );
}
内容来源于网络,如有侵权,请联系作者删除!