@Override RecordStore<?> getRecordStore( StoreAccess storeAccess ) { return storeAccess.getNodeStore(); } },
@Override RecordStore<?> getRecordStore( StoreAccess storeAccess ) { return storeAccess.getNodeStore(); } },
@Override RecordStore<?> getRecordStore( StoreAccess storeAccess ) { return storeAccess.getNodeStore(); } },
@Override public RecordReference<NodeRecord> node( long id ) { return referenceTo( access.getNodeStore(), id ); }
@Override protected void processCache() { RecordStore<NodeRecord> nodeStore = storeAccess.getNodeStore(); CacheAccess.Client client = cacheAccess.client(); long highId = nodeStore.getHighId(); for ( long nodeId = 0; nodeId < highId; nodeId++ ) { if ( client.getFromCache( nodeId, CacheSlots.NextRelationship.SLOT_FIRST_IN_TARGET ) == 0 ) { NodeRecord node = nodeStore.getRecord( nodeId, nodeStore.newRecord(), FORCE ); if ( node.inUse() && !node.isDense() ) { storeProcessor.processNode( nodeStore, node ); } } } } }
StoreProcessor processor = multiPass.processor( CheckStage.Stage1_NS_PropsLabels, PROPERTIES ); tasks.add( create( CheckStage.Stage1_NS_PropsLabels.name(), nativeStores.getNodeStore(), processor, ROUND_ROBIN ) ); Scanner.scan( nativeStores.getNodeStore() ) ) ); new IterableStore<>( nativeStores.getNodeStore(), true ), new PropertyAndNode2LabelIndexProcessor( reporter, checkIndexes ? indexes : null, propertyReader, cacheAccess, mandatoryProperties.forNodes( reporter ) ), if ( checkLabelScanStore ) long highId = nativeStores.getNodeStore().getHighId(); tasks.add( new LabelIndexDirtyCheckTask() ); tasks.add( recordScanner( "LabelScanStore",
if ( processor.getStage() == CheckStage.Stage1_NS_PropsLabels ) highId = storeAccess.getNodeStore().getHighId(); highId = storeAccess.getNodeStore().getHighId();
storeAccess.getNodeStore().getRecord( nodeId, nodeRecord, FORCE ); nodeRecord.setLabelField( dynamicPointer( duplicatedLabel ), duplicatedLabel ); nodeRecord.setInUse( true ); storeAccess.getNodeStore().updateRecord( nodeRecord );
@Test public void shouldReportIndexInconsistencies() throws Exception { // given for ( Long indexedNodeId : indexedNodes ) { fixture.directStoreAccess().nativeStores().getNodeStore().updateRecord( notInUse( new NodeRecord( indexedNodeId, false, -1, -1 ) ) ); } // when ConsistencySummaryStatistics stats = check(); // then on( stats ).verify( RecordType.INDEX, 3 ) // 3 index entries are pointing to nodes not in use .verify( RecordType.LABEL_SCAN_DOCUMENT, 2 ) // the label scan is pointing to 2 nodes not in use .verify( RecordType.COUNTS, 3 ) .andThatsAllFolks(); }
@Test public void shouldNotReportIndexInconsistenciesIfIndexIsFailed() throws Exception { // this test fails all indexes, and then destroys a record and makes sure we only get a failure for // the label scan store but not for any index // given DirectStoreAccess storeAccess = fixture.directStoreAccess(); // fail all indexes Iterator<StoreIndexDescriptor> rules = new SchemaStorage( storeAccess.nativeStores().getSchemaStore() ).indexesGetAll(); while ( rules.hasNext() ) { StoreIndexDescriptor rule = rules.next(); IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.defaults() ); IndexPopulator populator = storeAccess.indexes().lookup( rule.providerDescriptor() ) .getPopulator( rule, samplingConfig ); populator.markAsFailed( "Oh noes! I was a shiny index and then I was failed" ); populator.close( false ); } for ( Long indexedNodeId : indexedNodes ) { storeAccess.nativeStores().getNodeStore().updateRecord( notInUse( new NodeRecord( indexedNodeId, false, -1, -1 ) ) ); } // when ConsistencySummaryStatistics stats = check(); // then on( stats ).verify( RecordType.LABEL_SCAN_DOCUMENT, 2 ) // the label scan is pointing to 2 nodes not in use .verify( RecordType.COUNTS, 3 ) .andThatsAllFolks(); }
.resolveDependency( RecordStorageEngine.class ).testAccessNeoStores() ).initialize(); schemaId = stores.getSchemaStore().getHighId(); nodeId = stores.getNodeStore().getHighId(); labelId = (int) stores.getLabelTokenStore().getHighId(); nodeLabelsId = stores.getNodeDynamicLabelStore().getHighId();
@Test public void shouldReportIndexInconsistencies() throws Exception { // given for ( Long indexedNodeId : indexedNodes ) { fixture.directStoreAccess().nativeStores().getNodeStore().forceUpdateRecord( notInUse( new NodeRecord( indexedNodeId, false, -1, -1 ) ) ); } // when ConsistencySummaryStatistics stats = check(); // then on( stats ).verify( RecordType.INDEX, 1 ) .verify( RecordType.LABEL_SCAN_DOCUMENT, 1 ) .verify( RecordType.COUNTS, 3 ) .andThatsAllFolks(); }
storeAccess.nativeStores().getNodeStore().forceUpdateRecord( notInUse( new NodeRecord( indexedNodeId, false, -1, -1 ) ) );
private void generateInitialData() { GraphDatabaseBuilder builder = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder( directory ); GraphDatabaseAPI graphDb = (GraphDatabaseAPI) builder.newGraphDatabase(); try { generateInitialData( graphDb ); StoreAccess stores = new StoreAccess( graphDb ).initialize(); schemaId = stores.getSchemaStore().getHighId(); nodeId = stores.getNodeStore().getHighId(); labelId = (int) stores.getLabelTokenStore().getHighId(); nodeLabelsId = stores.getNodeDynamicLabelStore().getHighId(); relId = stores.getRelationshipStore().getHighId(); relGroupId = stores.getRelationshipGroupStore().getHighId(); propId = (int) stores.getPropertyStore().getHighId(); stringPropId = stores.getStringStore().getHighId(); arrayPropId = stores.getArrayStore().getHighId(); relTypeId = (int) stores.getRelationshipTypeTokenStore().getHighId(); propKeyId = (int) stores.getPropertyKeyNameStore().getHighId(); } finally { graphDb.shutdown(); } }