private void verifyReads( long[] expected ) { try ( LabelScanReader reader = store.newReader() ) { for ( int i = 0; i < LABEL_COUNT; i++ ) { long[] actualNodes = asArray( reader.nodesWithLabel( i ) ); long[] expectedNodes = nodesWithLabel( expected, i ); assertArrayEquals( expectedNodes, actualNodes ); } } }
private void assertNoContentInNativeLabelScanStore( DatabaseLayout databaseLayout ) { try ( Lifespan lifespan = new Lifespan() ) { NativeLabelScanStore nativeLabelScanStore = getNativeLabelScanStore( databaseLayout, true ); lifespan.add( nativeLabelScanStore ); try ( LabelScanReader labelScanReader = nativeLabelScanStore.newReader() ) { int count = PrimitiveLongCollections.count( labelScanReader.nodesWithLabel( 1 ) ); assertEquals( 0, count ); } } }
@Test public void populateNativeLabelScanIndexDuringMigration() throws IOException { prepare34DatabaseWithNodes(); indexMigrator.migrate( databaseLayout, migrationLayout, progressReporter, StandardV3_4.STORE_VERSION, StandardV3_4.STORE_VERSION ); indexMigrator.moveMigratedFiles( migrationLayout, databaseLayout, StandardV2_3.STORE_VERSION, StandardV3_2.STORE_VERSION ); try ( Lifespan lifespan = new Lifespan() ) { NativeLabelScanStore labelScanStore = getNativeLabelScanStore( databaseLayout, true ); lifespan.add( labelScanStore ); for ( int labelId = 0; labelId < 10; labelId++ ) { try ( LabelScanReader labelScanReader = labelScanStore.newReader() ) { int nodeCount = PrimitiveLongCollections.count( labelScanReader.nodesWithLabel( labelId ) ); assertEquals( format( "Expected to see only one node for label %d but was %d.", labelId, nodeCount ), 1, nodeCount ); } } } }