@Override public void close() throws IOException { accessor.close(); }
@Override public void close() { delegate.close(); }
@Override public void close() { accessor.close(); }
@Override public void close() throws IOException { for ( IndexAccessor accessor : accessors ) { accessor.close(); } accessors.clear(); onlineIndexRules.clear(); notOnlineIndexRules.clear(); } }
@Override public void close() { actual.close(); }
@Test public void closeMustCloseAll() { // when // ... all close successful fusionIndexAccessor.close(); // then for ( IndexAccessor accessor : aliveAccessors ) { verify( accessor, times( 1 ) ).close(); } }
private void createEmptySchemaIndex( DirectoryFactory directoryFactory ) throws IOException { Config config = Config.defaults(); LuceneIndexProvider indexProvider = getLuceneIndexProvider( config, directoryFactory, fileSystem, graphDbDir ); IndexAccessor onlineAccessor = getIndexAccessor( config, indexProvider ); onlineAccessor.close(); }
@After public void after() { try { testSuite.consistencyCheck( accessor ); } finally { accessor.drop(); accessor.close(); } }
private void addUpdates( SpatialIndexProvider provider, StoreIndexDescriptor schemaIndexDescriptor, ValueCreatorUtil<SpatialIndexKey,NativeIndexValue> layoutUtil ) throws IOException, IndexEntryConflictException { IndexAccessor accessor = provider.getOnlineAccessor( schemaIndexDescriptor, samplingConfig() ); try ( IndexUpdater updater = accessor.newUpdater( ONLINE ) ) { // when for ( IndexEntryUpdate<IndexDescriptor> update : layoutUtil.someUpdates( randomRule ) ) { updater.process( update ); } } accessor.force( IOLimiter.UNLIMITED ); accessor.close(); }
@Test public void shouldReportNodesWithDuplicatePropertyValueInUniqueIndex() throws Exception { // given IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.defaults() ); Iterator<StoreIndexDescriptor> indexRuleIterator = new SchemaStorage( fixture.directStoreAccess().nativeStores().getSchemaStore() ).indexesGetAll(); while ( indexRuleIterator.hasNext() ) { StoreIndexDescriptor indexRule = indexRuleIterator.next(); IndexAccessor accessor = fixture.directStoreAccess().indexes().lookup( indexRule.providerDescriptor() ) .getOnlineAccessor( indexRule, samplingConfig ); IndexUpdater updater = accessor.newUpdater( IndexUpdateMode.ONLINE ); updater.process( IndexEntryUpdate.add( 42, indexRule.schema(), values( indexRule ) ) ); updater.close(); accessor.force( IOLimiter.UNLIMITED ); accessor.close(); } // when ConsistencySummaryStatistics stats = check(); // then on( stats ).verify( RecordType.NODE, 1 ) // the duplicate in unique index .verify( RecordType.INDEX, 3 ) // the index entries pointing to non-existent node 42 .andThatsAllFolks(); }
accessor.close();
@Override public void close() { delegate.close(); }
@Override public void close() throws IOException { accessor.close(); }
@Test public void shouldReportNodesThatAreNotIndexed() throws Exception { // given IndexSamplingConfig samplingConfig = new IndexSamplingConfig( new Config() ); for ( IndexRule indexRule : loadAllIndexRules( fixture.directStoreAccess().nativeStores().getSchemaStore() ) ) { IndexAccessor accessor = fixture.directStoreAccess().indexes().getOnlineAccessor( indexRule.getId(), new IndexConfiguration( indexRule.isConstraintIndex() ), samplingConfig ); IndexUpdater updater = accessor.newUpdater( IndexUpdateMode.ONLINE ); updater.remove( asPrimitiveLongSet( indexedNodes ) ); updater.close(); accessor.close(); } // when ConsistencySummaryStatistics stats = check(); // then on( stats ).verify( RecordType.NODE, 1 ) .andThatsAllFolks(); }
@Test public void shouldReportNodesWithDuplicatePropertyValueInUniqueIndex() throws Exception { // given IndexConfiguration indexConfig = new IndexConfiguration( false ); IndexSamplingConfig samplingConfig = new IndexSamplingConfig( new Config() ); for ( IndexRule indexRule : loadAllIndexRules( fixture.directStoreAccess().nativeStores().getSchemaStore() ) ) { IndexAccessor accessor = fixture.directStoreAccess() .indexes() .getOnlineAccessor( indexRule.getId(), indexConfig, samplingConfig ); IndexUpdater updater = accessor.newUpdater( IndexUpdateMode.ONLINE ); updater.process( NodePropertyUpdate.add( 42, 0, "value", new long[]{3} ) ); updater.close(); accessor.close(); } // when ConsistencySummaryStatistics stats = check(); // then on( stats ).verify( RecordType.NODE, 1 ) .verify( RecordType.INDEX, 2 ) .andThatsAllFolks(); }