From 1dd2abebe4cbc4f39898bbc023df0cca13206b91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Finn=C3=A9?= Date: Sun, 7 Oct 2018 16:28:03 +0200 Subject: [PATCH] Improvements to IndexPopulationStressTest - Parameterized instead of subclassed - Broke out some code to methods - Uses SimpleNodeValueClient instead of a modified NodeValueIterator - Simplified random value generator a bit --- .../impl/index/schema/NodeValueIterator.java | 11 +- .../GenericIndexPopulationStressTest.java | 48 ---- .../schema/IndexPopulationStressTest.java | 260 +++++++++++------- .../NumberIndexPopulationStressTest.java | 47 ---- .../SpatialIndexPopulationStressTest.java | 53 ---- .../StringIndexPopulationStressTest.java | 47 ---- .../TemporalIndexPopulationStressTest.java | 51 ---- 7 files changed, 161 insertions(+), 356 deletions(-) delete mode 100644 community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/GenericIndexPopulationStressTest.java delete mode 100644 community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberIndexPopulationStressTest.java delete mode 100644 community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/SpatialIndexPopulationStressTest.java delete mode 100644 community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringIndexPopulationStressTest.java delete mode 100644 community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/TemporalIndexPopulationStressTest.java diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/NodeValueIterator.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/NodeValueIterator.java index 61b6a9b73785d..edf49a3632d20 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/NodeValueIterator.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/NodeValueIterator.java @@ -37,8 +37,6 @@ public class NodeValueIterator extends PrimitiveLongCollections.PrimitiveLongBas { private boolean closed; private IndexProgressor progressor; - private boolean needsValues; - private Value[] values; @Override protected boolean fetchNext() @@ -61,25 +59,18 @@ public void initialize( IndexDescriptor descriptor, boolean needsValues ) { this.progressor = progressor; - this.needsValues = needsValues; } @Override public boolean acceptNode( long reference, Value... values ) { - this.values = values; return next( reference ); } - public Value[] getValues() - { - return values; - } - @Override public boolean needsValues() { - return needsValues; + return false; } @Override diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/GenericIndexPopulationStressTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/GenericIndexPopulationStressTest.java deleted file mode 100644 index cfd6bce309885..0000000000000 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/GenericIndexPopulationStressTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002-2018 "Neo4j," - * Neo4j Sweden AB [http://neo4j.com] - * - * This file is part of Neo4j. - * - * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.neo4j.kernel.impl.index.schema; - -import org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector; -import org.neo4j.kernel.api.index.IndexDirectoryStructure; -import org.neo4j.kernel.api.index.IndexProvider; -import org.neo4j.kernel.configuration.Config; -import org.neo4j.values.storable.RandomValues; -import org.neo4j.values.storable.Value; - -public class GenericIndexPopulationStressTest extends IndexPopulationStressTest -{ - public GenericIndexPopulationStressTest() - { - super( true, true ); - } - - @Override - IndexProvider newProvider( IndexDirectoryStructure.Factory directory ) - { - return new GenericNativeIndexProvider( directory, rules.pageCache(), rules.fileSystem(), IndexProvider.Monitor.EMPTY, - RecoveryCleanupWorkCollector.immediate(), false, Config.defaults() ); - } - - @Override - Value randomValue( RandomValues random ) - { - return random.nextValue(); - } -} diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/IndexPopulationStressTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/IndexPopulationStressTest.java index 2db0624901b66..2ef4ae2e10898 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/IndexPopulationStressTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/IndexPopulationStressTest.java @@ -23,6 +23,8 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; import java.io.File; import java.io.IOException; @@ -34,6 +36,7 @@ import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.function.Function; import org.neo4j.internal.kernel.api.IndexOrder; import org.neo4j.internal.kernel.api.IndexQuery; @@ -49,6 +52,7 @@ import org.neo4j.kernel.api.index.NodePropertyAccessor; import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig; import org.neo4j.storageengine.api.schema.IndexReader; +import org.neo4j.storageengine.api.schema.SimpleNodeValueClient; import org.neo4j.storageengine.api.schema.StoreIndexDescriptor; import org.neo4j.test.Race; import org.neo4j.test.rule.PageCacheAndDependenciesRule; @@ -59,6 +63,7 @@ import org.neo4j.values.storable.Value; import org.neo4j.values.storable.ValueTuple; +import static org.apache.commons.lang3.ArrayUtils.toArray; import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -66,15 +71,54 @@ import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector.immediate; import static org.neo4j.kernel.api.index.IndexDirectoryStructure.directoriesByProvider; import static org.neo4j.kernel.api.index.IndexDirectoryStructure.directoriesBySubProvider; +import static org.neo4j.kernel.api.index.IndexEntryUpdate.add; +import static org.neo4j.kernel.api.index.IndexEntryUpdate.change; +import static org.neo4j.kernel.api.index.IndexEntryUpdate.remove; +import static org.neo4j.kernel.api.index.IndexProvider.Monitor.EMPTY; import static org.neo4j.kernel.api.schema.SchemaDescriptorFactory.forLabel; +import static org.neo4j.kernel.configuration.Config.defaults; import static org.neo4j.storageengine.api.schema.IndexDescriptorFactory.forSchema; import static org.neo4j.test.Race.throwing; -public abstract class IndexPopulationStressTest +@RunWith( Parameterized.class ) +public class IndexPopulationStressTest { private static final IndexProviderDescriptor PROVIDER = new IndexProviderDescriptor( "provider", "1.0" ); + private static final int THREADS = 50; + private static final int MAX_BATCH_SIZE = 100; + private static final int BATCHES_PER_THREAD = 100; + + @Parameterized.Parameters( name = "{0}" ) + public static Collection providers() + { + Collection parameters = new ArrayList<>(); + // GenericNativeIndexProvider + parameters.add( of( "generic", true, true, RandomValues::nextValue, test -> + new GenericNativeIndexProvider( test.directory(), test.rules.pageCache(), test.rules.fileSystem(), EMPTY, immediate(),false, defaults() ) ) ); + // NumberIndexProvider + parameters.add( of( "number", true, false, RandomValues::nextNumberValue, test -> + new NumberIndexProvider( test.rules.pageCache(), test.rules.fileSystem(), test.directory(), EMPTY, immediate(), false ) ) ); + // StringIndexProvider + parameters.add( of( "string", true, false, RandomValues::nextAlphaNumericTextValue, test -> + new StringIndexProvider( test.rules.pageCache(), test.rules.fileSystem(), test.directory(), EMPTY, immediate(), false ) ) ); + // SpatialIndexProvider + parameters.add( of( "spatial", false, false, RandomValues::nextPointValue, test -> + new SpatialIndexProvider( test.rules.pageCache(), test.rules.fileSystem(), test.directory(), EMPTY, immediate(), false, defaults() ) ) ); + // TemporalIndexProvider + parameters.add( of( "temporal", true, false, RandomValues::nextTemporalValue, test -> + new TemporalIndexProvider( test.rules.pageCache(), test.rules.fileSystem(), test.directory(), EMPTY, immediate(), false ) ) ); + return parameters; + } + + private static Object[] of( String name, boolean hasValues, boolean canHandlePopulationConcurrentlyWithAdd, + Function valueGenerator, Function providerCreator ) + { + return toArray( name, hasValues, canHandlePopulationConcurrentlyWithAdd, valueGenerator, providerCreator ); + } + @Rule public final RandomRule random = new RandomRule(); @Rule @@ -82,42 +126,35 @@ public abstract class IndexPopulationStressTest new PageCacheAndDependenciesRule( DefaultFileSystemRule::new, this.getClass() ); protected final StoreIndexDescriptor descriptor = forSchema( forLabel( 0, 0 ), PROVIDER ).withId( 0 ); - protected final StoreIndexDescriptor descriptor2 = forSchema( forLabel( 1, 0 ), PROVIDER ).withId( 1 ); + private final StoreIndexDescriptor descriptor2 = forSchema( forLabel( 1, 0 ), PROVIDER ).withId( 1 ); private final IndexSamplingConfig samplingConfig = new IndexSamplingConfig( 1000, 0.2, true ); private final NodePropertyAccessor nodePropertyAccessor = mock( NodePropertyAccessor.class ); - private final boolean canHandlePopulationConcurrentlyWithAdd; - private final boolean hasValues; + @Parameterized.Parameter + public String name; + @Parameterized.Parameter( 1 ) + public boolean hasValues; + @Parameterized.Parameter( 2 ) + public boolean canHandlePopulationConcurrentlyWithAdd; + @Parameterized.Parameter( 3 ) + public Function valueGenerator; + @Parameterized.Parameter( 4 ) + public Function providerCreator; private IndexPopulator populator; private IndexProvider indexProvider; private boolean prevAccessCheck; - protected IndexPopulationStressTest( boolean canHandlePopulationConcurrentlyWithAdd, boolean hasValues ) + private IndexDirectoryStructure.Factory directory() { - this.canHandlePopulationConcurrentlyWithAdd = canHandlePopulationConcurrentlyWithAdd; - this.hasValues = hasValues; + File storeDir = rules.directory().databaseDir(); + return directoriesBySubProvider( directoriesByProvider( storeDir ).forProvider( PROVIDER ) ); } - /** - * Create the provider to stress. - */ - abstract IndexProvider newProvider( IndexDirectoryStructure.Factory directory ); - - /** - * Generate a random value to populate the index with. - */ - abstract Value randomValue( RandomValues random ); - @Before public void setup() throws IOException, EntityNotFoundException { - File storeDir = rules.directory().databaseDir(); - IndexDirectoryStructure.Factory directory = directoriesBySubProvider( directoriesByProvider( storeDir ).forProvider( PROVIDER ) ); - - indexProvider = newProvider( directory ); - + indexProvider = providerCreator.apply( this ); rules.fileSystem().mkdirs( indexProvider.directoryStructure().rootDirectory() ); - populator = indexProvider.getPopulator( descriptor, samplingConfig ); when( nodePropertyAccessor.getNodePropertyValue( anyLong(), anyInt() ) ).thenThrow( UnsupportedOperationException.class ); prevAccessCheck = UnsafeUtil.exchangeNativeAccessCheckEnabled( false ); @@ -137,50 +174,55 @@ public void teardown() public void stressIt() throws Throwable { Race race = new Race(); - int threads = 50; - AtomicReferenceArray>> lastBatches = new AtomicReferenceArray<>( threads ); - Generator[] generators = new Generator[threads]; + AtomicReferenceArray>> lastBatches = new AtomicReferenceArray<>( THREADS ); + Generator[] generators = new Generator[THREADS]; populator.create(); - int maxBatchSize = 100; - int batchesPerThread = 100; - int worstCaseEntriesPerThread = batchesPerThread * maxBatchSize; - CountDownLatch insertersDone = new CountDownLatch( threads ); + CountDownLatch insertersDone = new CountDownLatch( THREADS ); ReadWriteLock updateLock = new ReentrantReadWriteLock( true ); - for ( int i = 0; i < threads; i++ ) + for ( int i = 0; i < THREADS; i++ ) + { + race.addContestant( inserter( lastBatches, generators, insertersDone, updateLock, i ), 1 ); + } + Collection> updates = new ArrayList<>(); + race.addContestant( updater( lastBatches, insertersDone, updateLock, updates ) ); + + race.go(); + populator.close( true ); + populator = null; // to let the after-method know that we've closed it ourselves + + // then assert that a tree built by a single thread ends up exactly the same + buildReferencePopulatorSingleThreaded( generators, updates ); + try ( IndexAccessor accessor = indexProvider.getOnlineAccessor( descriptor, samplingConfig ); + IndexAccessor referenceAccessor = indexProvider.getOnlineAccessor( descriptor2, samplingConfig ); + IndexReader reader = accessor.newReader(); + IndexReader referenceReader = referenceAccessor.newReader() ) { - int slot = i; - race.addContestant( throwing( () -> + SimpleNodeValueClient entries = new SimpleNodeValueClient(); + SimpleNodeValueClient referenceEntries = new SimpleNodeValueClient(); + reader.query( entries, IndexOrder.NONE, hasValues, IndexQuery.exists( 0 ) ); + referenceReader.query( referenceEntries, IndexOrder.NONE, hasValues, IndexQuery.exists( 0 ) ); + while ( referenceEntries.next() ) { - try - { - Generator generator = generators[slot] = new Generator( maxBatchSize, random.seed(), slot * worstCaseEntriesPerThread ); - for ( int j = 0; j < batchesPerThread; j++ ) - { - List> batch = generator.batch(); - updateLock.readLock().lock(); - try - { - populator.add( batch ); - } - finally - { - updateLock.readLock().unlock(); - } - lastBatches.set( slot, batch ); - } - } - finally + assertTrue( entries.next() ); + assertEquals( referenceEntries.reference, entries.reference ); + if ( hasValues ) { - // This helps the updater know when to stop updating - insertersDone.countDown(); + assertEquals( ValueTuple.of( referenceEntries.values ), ValueTuple.of( entries.values ) ); } - } ), 1 ); + } + assertFalse( entries.next() ); } - Collection> updates = new ArrayList<>(); - race.addContestant( throwing( () -> + } + + private Runnable updater( AtomicReferenceArray>> lastBatches, CountDownLatch insertersDone, ReadWriteLock updateLock, + Collection> updates ) + { + return throwing( () -> { - Generator generator = new Generator( -1, random.seed() + threads, -1 ); + // Entity ids that have been removed, so that additions can reuse them + List removed = new ArrayList<>(); + RandomValues randomValues = RandomValues.create( new Random( random.seed() + THREADS ) ); while ( insertersDone.getCount() > 0 ) { // Do updates now and then @@ -191,17 +233,38 @@ public void stressIt() throws Throwable } try ( IndexUpdater updater = populator.newPopulatingUpdater( nodePropertyAccessor ) ) { - for ( int i = 0; i < threads; i++ ) + for ( int i = 0; i < THREADS; i++ ) { List> batch = lastBatches.get( i ); if ( batch != null ) { - IndexEntryUpdate removal = batch.get( generator.random.nextInt( batch.size() ) ); - IndexEntryUpdate change = random.nextBoolean() - ? IndexEntryUpdate.change( removal.getEntityId(), descriptor, removal.values(), generator.single() ) - : IndexEntryUpdate.remove( removal.getEntityId(), descriptor, removal.values() ); - updater.process( change ); - updates.add( change ); + IndexEntryUpdate update = null; + switch ( randomValues.nextInt( 3 ) ) + { + case 0: // add + if ( !removed.isEmpty() ) + { + Long id = removed.remove( randomValues.nextInt( removed.size() ) ); + update = add( id, descriptor, valueGenerator.apply( randomValues ) ); + } + break; + case 1: // remove + IndexEntryUpdate removal = batch.get( randomValues.nextInt( batch.size() ) ); + update = remove( removal.getEntityId(), descriptor, removal.values() ); + removed.add( removal.getEntityId() ); + break; + case 2: // change + removal = batch.get( randomValues.nextInt( batch.size() ) ); + change( removal.getEntityId(), descriptor, removal.values(), toArray( valueGenerator.apply( randomValues ) ) ); + break; + default: + throw new IllegalArgumentException(); + } + if ( update != null ) + { + updater.process( update ); + updates.add( update ); + } } } } @@ -213,37 +276,42 @@ public void stressIt() throws Throwable } } } - } ) ); - - race.go(); - populator.close( true ); - populator = null; // to let the after-method know that we've closed it ourselves + } ); + } - // then assert that a tree built by a single thread ends up exactly the same - buildReferencePopulatorSingleThreaded( generators, batchesPerThread, updates ); - try ( IndexAccessor accessor = indexProvider.getOnlineAccessor( descriptor, samplingConfig ); - IndexAccessor referenceAccessor = indexProvider.getOnlineAccessor( descriptor2, samplingConfig ); - IndexReader reader = accessor.newReader(); - IndexReader referenceReader = referenceAccessor.newReader() ) + private Runnable inserter( AtomicReferenceArray>> lastBatches, Generator[] generators, CountDownLatch insertersDone, + ReadWriteLock updateLock, int slot ) + { + int worstCaseEntriesPerThread = BATCHES_PER_THREAD * MAX_BATCH_SIZE; + return throwing( () -> { - NodeValueIterator entries = new NodeValueIterator(); - NodeValueIterator referenceEntries = new NodeValueIterator(); - reader.query( entries, IndexOrder.NONE, hasValues, IndexQuery.exists( 0 ) ); - referenceReader.query( referenceEntries, IndexOrder.NONE, hasValues, IndexQuery.exists( 0 ) ); - while ( referenceEntries.hasNext() ) + try { - assertTrue( entries.hasNext() ); - assertEquals( referenceEntries.next(), entries.next() ); - if ( hasValues ) + Generator generator = generators[slot] = new Generator( MAX_BATCH_SIZE, random.seed() + slot, slot * worstCaseEntriesPerThread ); + for ( int j = 0; j < BATCHES_PER_THREAD; j++ ) { - assertEquals( ValueTuple.of( referenceEntries.getValues() ), ValueTuple.of( entries.getValues() ) ); + List> batch = generator.batch(); + updateLock.readLock().lock(); + try + { + populator.add( batch ); + } + finally + { + updateLock.readLock().unlock(); + } + lastBatches.set( slot, batch ); } } - assertFalse( entries.hasNext() ); - } + finally + { + // This helps the updater know when to stop updating + insertersDone.countDown(); + } + } ); } - private void buildReferencePopulatorSingleThreaded( Generator[] generators, int batchesPerThread, Collection> updates ) + private void buildReferencePopulatorSingleThreaded( Generator[] generators, Collection> updates ) throws IndexEntryConflictException { IndexPopulator referencePopulator = indexProvider.getPopulator( descriptor2, samplingConfig ); @@ -254,12 +322,11 @@ private void buildReferencePopulatorSingleThreaded( Generator[] generators, int for ( Generator generator : generators ) { generator.reset(); - for ( int i = 0; i < batchesPerThread; i++ ) + for ( int i = 0; i < BATCHES_PER_THREAD; i++ ) { referencePopulator.add( generator.batch() ); } } - // Updates can be applied afterwards due to each generator having its own entityId ID space and index is non-unique try ( IndexUpdater updater = referencePopulator.newPopulatingUpdater( nodePropertyAccessor ) ) { for ( IndexEntryUpdate update : updates ) @@ -281,7 +348,6 @@ private class Generator private final long seed; private final long startEntityId; - private Random random; private RandomValues randomValues; private long nextEntityId; @@ -296,23 +362,17 @@ private class Generator private void reset() { - random = new Random( seed ); - randomValues = RandomValues.create( random ); + randomValues = RandomValues.create( new Random( seed ) ); nextEntityId = startEntityId; } - Value[] single() - { - return new Value[]{randomValue( randomValues )}; - } - List> batch() { - int n = random.nextInt( maxBatchSize ) + 1; + int n = randomValues.nextInt( maxBatchSize ) + 1; List> updates = new ArrayList<>( n ); for ( int i = 0; i < n; i++ ) { - updates.add( IndexEntryUpdate.add( nextEntityId++, descriptor, single() ) ); + updates.add( add( nextEntityId++, descriptor, valueGenerator.apply( randomValues ) ) ); } return updates; } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberIndexPopulationStressTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberIndexPopulationStressTest.java deleted file mode 100644 index 210bd5b66a1e4..0000000000000 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberIndexPopulationStressTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002-2018 "Neo4j," - * Neo4j Sweden AB [http://neo4j.com] - * - * This file is part of Neo4j. - * - * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.neo4j.kernel.impl.index.schema; - -import org.neo4j.kernel.api.index.IndexDirectoryStructure; -import org.neo4j.kernel.api.index.IndexProvider; -import org.neo4j.values.storable.RandomValues; -import org.neo4j.values.storable.Value; - -import static org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector.immediate; - -public class NumberIndexPopulationStressTest extends IndexPopulationStressTest -{ - public NumberIndexPopulationStressTest() - { - super( false, true ); - } - - @Override - IndexProvider newProvider( IndexDirectoryStructure.Factory directory ) - { - return new NumberIndexProvider( rules.pageCache(), rules.fileSystem(), directory, IndexProvider.Monitor.EMPTY, immediate(), false ); - } - - @Override - Value randomValue( RandomValues random ) - { - return random.nextNumberValue(); - } -} diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/SpatialIndexPopulationStressTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/SpatialIndexPopulationStressTest.java deleted file mode 100644 index f868ca512b276..0000000000000 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/SpatialIndexPopulationStressTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002-2018 "Neo4j," - * Neo4j Sweden AB [http://neo4j.com] - * - * This file is part of Neo4j. - * - * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.neo4j.kernel.impl.index.schema; - -import org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector; -import org.neo4j.kernel.api.index.IndexDirectoryStructure; -import org.neo4j.kernel.api.index.IndexProvider; -import org.neo4j.kernel.configuration.Config; -import org.neo4j.values.storable.RandomValues; -import org.neo4j.values.storable.Value; - -public class SpatialIndexPopulationStressTest extends IndexPopulationStressTest -{ - public SpatialIndexPopulationStressTest() - { - super( false, false ); - } - - @Override - IndexProvider newProvider( IndexDirectoryStructure.Factory directory ) - { - return new SpatialIndexProvider( rules.pageCache(), - rules.fileSystem(), - directory, - IndexProvider.Monitor.EMPTY, - RecoveryCleanupWorkCollector.immediate(), - false, - Config.defaults() ); - } - - @Override - Value randomValue( RandomValues random ) - { - return random.nextPointValue(); - } -} diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringIndexPopulationStressTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringIndexPopulationStressTest.java deleted file mode 100644 index c6d79bc9d793f..0000000000000 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringIndexPopulationStressTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002-2018 "Neo4j," - * Neo4j Sweden AB [http://neo4j.com] - * - * This file is part of Neo4j. - * - * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.neo4j.kernel.impl.index.schema; - -import org.neo4j.kernel.api.index.IndexDirectoryStructure; -import org.neo4j.kernel.api.index.IndexProvider; -import org.neo4j.values.storable.RandomValues; -import org.neo4j.values.storable.Value; - -import static org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector.immediate; - -public class StringIndexPopulationStressTest extends IndexPopulationStressTest -{ - public StringIndexPopulationStressTest() - { - super( false, true ); - } - - @Override - IndexProvider newProvider( IndexDirectoryStructure.Factory directory ) - { - return new StringIndexProvider( rules.pageCache(), rules.fileSystem(), directory, IndexProvider.Monitor.EMPTY, immediate(), false ); - } - - @Override - Value randomValue( RandomValues random ) - { - return random.nextAlphaNumericTextValue(); - } -} diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/TemporalIndexPopulationStressTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/TemporalIndexPopulationStressTest.java deleted file mode 100644 index 4018a638866fe..0000000000000 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/TemporalIndexPopulationStressTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2002-2018 "Neo4j," - * Neo4j Sweden AB [http://neo4j.com] - * - * This file is part of Neo4j. - * - * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.neo4j.kernel.impl.index.schema; - -import org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector; -import org.neo4j.kernel.api.index.IndexDirectoryStructure; -import org.neo4j.kernel.api.index.IndexProvider; -import org.neo4j.values.storable.RandomValues; -import org.neo4j.values.storable.Value; - -public class TemporalIndexPopulationStressTest extends IndexPopulationStressTest -{ - public TemporalIndexPopulationStressTest() - { - super( false, true ); - } - - @Override - IndexProvider newProvider( IndexDirectoryStructure.Factory directory ) - { - return new TemporalIndexProvider( rules.pageCache(), - rules.fileSystem(), - directory, - IndexProvider.Monitor.EMPTY, - RecoveryCleanupWorkCollector.immediate(), - false ); - } - - @Override - Value randomValue( RandomValues random ) - { - return random.nextTemporalValue(); - } -}