Skip to content

Commit

Permalink
Remove IndexSamplingConfig from NativeIndexProvider with friends
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen committed Sep 20, 2018
1 parent efcfe8e commit 25316bc
Show file tree
Hide file tree
Showing 59 changed files with 151 additions and 260 deletions.
Expand Up @@ -29,7 +29,6 @@
import org.neo4j.io.pagecache.IOLimiter;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.api.index.IndexProvider;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettingsCache;
import org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettingsWriter;
import org.neo4j.kernel.impl.util.Validator;
Expand All @@ -45,10 +44,9 @@ class GenericNativeIndexAccessor extends NativeIndexAccessor<CompositeGenericKey

GenericNativeIndexAccessor( PageCache pageCache, FileSystemAbstraction fs, File storeFile, IndexLayout<CompositeGenericKey,NativeIndexValue> layout,
RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor,
IndexSamplingConfig samplingConfig, IndexSpecificSpaceFillingCurveSettingsCache spaceFillingCurveSettings,
SpaceFillingCurveConfiguration configuration ) throws IOException
IndexSpecificSpaceFillingCurveSettingsCache spaceFillingCurveSettings, SpaceFillingCurveConfiguration configuration ) throws IOException
{
super( pageCache, fs, storeFile, layout, recoveryCleanupWorkCollector, monitor, descriptor, samplingConfig,
super( pageCache, fs, storeFile, layout, recoveryCleanupWorkCollector, monitor, descriptor,
new SpaceFillingCurveSettingsWriter( spaceFillingCurveSettings ) );
this.spaceFillingCurveSettings = spaceFillingCurveSettings;
this.configuration = configuration;
Expand All @@ -64,7 +62,7 @@ protected void afterTreeInstantiation( GBPTree<CompositeGenericKey,NativeIndexVa
@Override
public IndexReader newReader()
{
return new GenericNativeIndexReader( tree, layout, samplingConfig, descriptor, spaceFillingCurveSettings, configuration );
return new GenericNativeIndexReader( tree, layout, descriptor, spaceFillingCurveSettings, configuration );
}

@Override
Expand Down
Expand Up @@ -22,11 +22,9 @@
import java.io.File;

import org.neo4j.gis.spatial.index.curves.SpaceFillingCurveConfiguration;
import org.neo4j.index.internal.gbptree.Layout;
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.api.index.IndexProvider;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettingsCache;
import org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettingsWriter;
import org.neo4j.storageengine.api.schema.IndexReader;
Expand All @@ -38,17 +36,17 @@ class GenericNativeIndexPopulator extends NativeIndexPopulator<CompositeGenericK
private final SpaceFillingCurveConfiguration configuration;

GenericNativeIndexPopulator( PageCache pageCache, FileSystemAbstraction fs, File storeFile, IndexLayout<CompositeGenericKey,NativeIndexValue> layout,
IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig,
IndexSpecificSpaceFillingCurveSettingsCache spatialSettings, SpaceFillingCurveConfiguration configuration )
IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor, IndexSpecificSpaceFillingCurveSettingsCache spatialSettings,
SpaceFillingCurveConfiguration configuration )
{
super( pageCache, fs, storeFile, layout, monitor, descriptor, samplingConfig, new SpaceFillingCurveSettingsWriter( spatialSettings ) );
super( pageCache, fs, storeFile, layout, monitor, descriptor, new SpaceFillingCurveSettingsWriter( spatialSettings ) );
this.spatialSettings = spatialSettings;
this.configuration = configuration;
}

@Override
IndexReader newReader()
{
return new GenericNativeIndexReader( tree, layout, samplingConfig, descriptor, spatialSettings, configuration );
return new GenericNativeIndexReader( tree, layout, descriptor, spatialSettings, configuration );
}
}
Expand Up @@ -40,7 +40,6 @@
import org.neo4j.kernel.api.index.IndexDirectoryStructure;
import org.neo4j.kernel.api.index.IndexPopulator;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.kernel.impl.index.schema.config.ConfiguredSpaceFillingCurveSettingsCache;
import org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettingsCache;
import org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings;
Expand Down Expand Up @@ -153,18 +152,16 @@ GenericLayout layout( StoreIndexDescriptor descriptor, File storeFile )
}

@Override
protected IndexPopulator newIndexPopulator( File storeFile, GenericLayout layout, StoreIndexDescriptor descriptor,
IndexSamplingConfig samplingConfig )
protected IndexPopulator newIndexPopulator( File storeFile, GenericLayout layout, StoreIndexDescriptor descriptor )
{
return new GenericNativeIndexPopulator( pageCache, fs, storeFile, layout, monitor, descriptor, samplingConfig,
return new GenericNativeIndexPopulator( pageCache, fs, storeFile, layout, monitor, descriptor,
layout.getSpaceFillingCurveSettings(), configuration );
}

@Override
protected IndexAccessor newIndexAccessor( File storeFile, GenericLayout layout, StoreIndexDescriptor descriptor,
IndexSamplingConfig samplingConfig ) throws IOException
protected IndexAccessor newIndexAccessor( File storeFile, GenericLayout layout, StoreIndexDescriptor descriptor ) throws IOException
{
return new GenericNativeIndexAccessor( pageCache, fs, storeFile, layout, recoveryCleanupWorkCollector, monitor, descriptor, samplingConfig,
return new GenericNativeIndexAccessor( pageCache, fs, storeFile, layout, recoveryCleanupWorkCollector, monitor, descriptor,
layout.getSpaceFillingCurveSettings(), configuration );
}

Expand Down
Expand Up @@ -29,7 +29,6 @@
import org.neo4j.internal.kernel.api.IndexQuery.ExactPredicate;
import org.neo4j.internal.kernel.api.IndexQuery.RangePredicate;
import org.neo4j.internal.kernel.api.IndexQuery.StringPrefixPredicate;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.kernel.impl.api.schema.BridgingIndexProgressor;
import org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettingsCache;
import org.neo4j.storageengine.api.schema.IndexDescriptor;
Expand All @@ -49,10 +48,10 @@ class GenericNativeIndexReader extends NativeIndexReader<CompositeGenericKey,Nat
private final SpaceFillingCurveConfiguration configuration;

GenericNativeIndexReader( GBPTree<CompositeGenericKey,NativeIndexValue> tree, IndexLayout<CompositeGenericKey,NativeIndexValue> layout,
IndexSamplingConfig samplingConfig, IndexDescriptor descriptor, IndexSpecificSpaceFillingCurveSettingsCache spaceFillingCurveSettings,
IndexDescriptor descriptor, IndexSpecificSpaceFillingCurveSettingsCache spaceFillingCurveSettings,
SpaceFillingCurveConfiguration configuration )
{
super( tree, layout, samplingConfig, descriptor );
super( tree, layout, descriptor );
this.spaceFillingCurveSettings = spaceFillingCurveSettings;
this.configuration = configuration;
}
Expand Down
Expand Up @@ -35,7 +35,6 @@
import org.neo4j.kernel.api.index.IndexProvider;
import org.neo4j.kernel.api.index.NodePropertyAccessor;
import org.neo4j.kernel.impl.api.index.IndexUpdateMode;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.storageengine.api.schema.IndexReader;
import org.neo4j.storageengine.api.schema.StoreIndexDescriptor;

Expand All @@ -47,16 +46,14 @@ public abstract class NativeIndexAccessor<KEY extends NativeIndexKey<KEY>, VALUE
implements IndexAccessor
{
private final NativeIndexUpdater<KEY,VALUE> singleUpdater;
final IndexSamplingConfig samplingConfig;
final NativeIndexHeaderWriter headerWriter;

NativeIndexAccessor( PageCache pageCache, FileSystemAbstraction fs, File storeFile, IndexLayout<KEY,VALUE> layout,
RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor,
IndexSamplingConfig samplingConfig, Consumer<PageCursor> additionalHeaderWriter ) throws IOException
Consumer<PageCursor> additionalHeaderWriter ) throws IOException
{
super( pageCache, fs, storeFile, layout, monitor, descriptor );
singleUpdater = new NativeIndexUpdater<>( layout.newKey(), layout.newValue() );
this.samplingConfig = samplingConfig;
headerWriter = new NativeIndexHeaderWriter( BYTE_ONLINE, additionalHeaderWriter );
}

Expand Down
Expand Up @@ -44,7 +44,6 @@
import org.neo4j.kernel.api.index.IndexProvider;
import org.neo4j.kernel.api.index.IndexUpdater;
import org.neo4j.kernel.api.index.NodePropertyAccessor;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.kernel.impl.api.index.sampling.UniqueIndexSampler;
import org.neo4j.storageengine.api.schema.IndexReader;
import org.neo4j.storageengine.api.schema.IndexSample;
Expand Down Expand Up @@ -72,7 +71,6 @@ public abstract class NativeIndexPopulator<KEY extends NativeIndexKey<KEY>, VALU
private final KEY treeKey;
private final VALUE treeValue;
private final UniqueIndexSampler uniqueSampler;
final IndexSamplingConfig samplingConfig;
private final Consumer<PageCursor> additionalHeaderWriter;

private WorkSync<IndexUpdateApply<KEY,VALUE>,IndexUpdateWork<KEY,VALUE>> additionsWorkSync;
Expand All @@ -83,12 +81,11 @@ public abstract class NativeIndexPopulator<KEY extends NativeIndexKey<KEY>, VALU
private boolean closed;

NativeIndexPopulator( PageCache pageCache, FileSystemAbstraction fs, File storeFile, IndexLayout<KEY,VALUE> layout, IndexProvider.Monitor monitor,
StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig, Consumer<PageCursor> additionalHeaderWriter )
StoreIndexDescriptor descriptor, Consumer<PageCursor> additionalHeaderWriter )
{
super( pageCache, fs, storeFile, layout, monitor, descriptor );
this.treeKey = layout.newKey();
this.treeValue = layout.newValue();
this.samplingConfig = samplingConfig;
this.additionalHeaderWriter = additionalHeaderWriter;
switch ( descriptor.type() )
{
Expand Down
Expand Up @@ -75,21 +75,19 @@ public IndexPopulator getPopulator( StoreIndexDescriptor descriptor, IndexSampli
}

File storeFile = nativeIndexFileFromIndexId( descriptor.getId() );
return newIndexPopulator( storeFile, layout( descriptor, storeFile ), descriptor, samplingConfig );
return newIndexPopulator( storeFile, layout( descriptor, storeFile ), descriptor );
}

protected abstract IndexPopulator newIndexPopulator( File storeFile, LAYOUT layout, StoreIndexDescriptor descriptor,
IndexSamplingConfig samplingConfig );
protected abstract IndexPopulator newIndexPopulator( File storeFile, LAYOUT layout, StoreIndexDescriptor descriptor );

@Override
public IndexAccessor getOnlineAccessor( StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig ) throws IOException
{
File storeFile = nativeIndexFileFromIndexId( descriptor.getId() );
return newIndexAccessor( storeFile, layout( descriptor, storeFile ), descriptor, samplingConfig );
return newIndexAccessor( storeFile, layout( descriptor, storeFile ), descriptor );
}

protected abstract IndexAccessor newIndexAccessor( File storeFile, LAYOUT layout, StoreIndexDescriptor descriptor,
IndexSamplingConfig samplingConfig ) throws IOException;
protected abstract IndexAccessor newIndexAccessor( File storeFile, LAYOUT layout, StoreIndexDescriptor descriptor ) throws IOException;

@Override
public String getPopulationFailure( StoreIndexDescriptor descriptor ) throws IllegalStateException
Expand Down
Expand Up @@ -31,7 +31,6 @@
import org.neo4j.internal.kernel.api.IndexOrder;
import org.neo4j.internal.kernel.api.IndexQuery;
import org.neo4j.io.IOUtils;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.storageengine.api.schema.IndexDescriptor;
import org.neo4j.storageengine.api.schema.IndexProgressor;
import org.neo4j.storageengine.api.schema.IndexReader;
Expand All @@ -48,15 +47,11 @@ abstract class NativeIndexReader<KEY extends NativeIndexKey<KEY>, VALUE extends
final IndexLayout<KEY,VALUE> layout;
final Set<RawCursor<Hit<KEY,VALUE>,IOException>> openSeekers;
private final GBPTree<KEY,VALUE> tree;
private final IndexSamplingConfig samplingConfig;

NativeIndexReader( GBPTree<KEY,VALUE> tree, IndexLayout<KEY,VALUE> layout,
IndexSamplingConfig samplingConfig,
IndexDescriptor descriptor )
NativeIndexReader( GBPTree<KEY,VALUE> tree, IndexLayout<KEY,VALUE> layout, IndexDescriptor descriptor )
{
this.tree = tree;
this.layout = layout;
this.samplingConfig = samplingConfig;
this.descriptor = descriptor;
this.openSeekers = new HashSet<>();
}
Expand Down
Expand Up @@ -26,7 +26,6 @@
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.api.index.IndexProvider;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.storageengine.api.schema.IndexReader;
import org.neo4j.storageengine.api.schema.StoreIndexDescriptor;

Expand All @@ -35,17 +34,16 @@
public class NumberIndexAccessor extends NativeIndexAccessor<NumberIndexKey,NativeIndexValue>
{
NumberIndexAccessor( PageCache pageCache, FileSystemAbstraction fs, File storeFile, IndexLayout<NumberIndexKey,NativeIndexValue> layout,
RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor,
IndexSamplingConfig samplingConfig ) throws IOException
RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor ) throws IOException
{
super( pageCache, fs, storeFile, layout, recoveryCleanupWorkCollector, monitor, descriptor, samplingConfig, NO_HEADER_WRITER );
super( pageCache, fs, storeFile, layout, recoveryCleanupWorkCollector, monitor, descriptor, NO_HEADER_WRITER );
instantiateTree( recoveryCleanupWorkCollector, headerWriter );
}

@Override
public IndexReader newReader()
{
assertOpen();
return new NumberIndexReader<>( tree, layout, samplingConfig, descriptor );
return new NumberIndexReader<>( tree, layout, descriptor );
}
}
Expand Up @@ -24,7 +24,6 @@
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.api.index.IndexProvider;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.storageengine.api.schema.IndexReader;
import org.neo4j.storageengine.api.schema.StoreIndexDescriptor;

Expand All @@ -33,14 +32,14 @@
class NumberIndexPopulator extends NativeIndexPopulator<NumberIndexKey,NativeIndexValue>
{
NumberIndexPopulator( PageCache pageCache, FileSystemAbstraction fs, File storeFile, IndexLayout<NumberIndexKey,NativeIndexValue> layout,
IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig )
IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor )
{
super( pageCache, fs, storeFile, layout, monitor, descriptor, samplingConfig, NO_HEADER_WRITER );
super( pageCache, fs, storeFile, layout, monitor, descriptor, NO_HEADER_WRITER );
}

@Override
IndexReader newReader()
{
return new NumberIndexReader<>( tree, layout, samplingConfig, descriptor );
return new NumberIndexReader<>( tree, layout, descriptor );
}
}
Expand Up @@ -33,7 +33,6 @@
import org.neo4j.kernel.api.index.IndexAccessor;
import org.neo4j.kernel.api.index.IndexDirectoryStructure;
import org.neo4j.kernel.api.index.IndexPopulator;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.storageengine.api.schema.StoreIndexDescriptor;
import org.neo4j.values.storable.ValueCategory;

Expand All @@ -46,9 +45,8 @@ public class NumberIndexProvider extends NativeIndexProvider<NumberIndexKey,Nati
public static final IndexProviderDescriptor NATIVE_PROVIDER_DESCRIPTOR = new IndexProviderDescriptor( KEY, "1.0" );
static final IndexCapability CAPABILITY = new NumberIndexCapability();

public NumberIndexProvider( PageCache pageCache, FileSystemAbstraction fs,
IndexDirectoryStructure.Factory directoryStructure, Monitor monitor, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector,
boolean readOnly )
public NumberIndexProvider( PageCache pageCache, FileSystemAbstraction fs, IndexDirectoryStructure.Factory directoryStructure, Monitor monitor,
RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, boolean readOnly )
{
super( NATIVE_PROVIDER_DESCRIPTOR, 0, directoryStructure, pageCache, fs, monitor, recoveryCleanupWorkCollector, readOnly );
}
Expand All @@ -69,18 +67,15 @@ NumberLayout layout( StoreIndexDescriptor descriptor, File storeFile )
}

@Override
protected IndexPopulator newIndexPopulator( File storeFile, NumberLayout layout, StoreIndexDescriptor descriptor,
IndexSamplingConfig samplingConfig )
protected IndexPopulator newIndexPopulator( File storeFile, NumberLayout layout, StoreIndexDescriptor descriptor )
{
return new NumberIndexPopulator( pageCache, fs, storeFile, layout, monitor, descriptor, samplingConfig );
return new NumberIndexPopulator( pageCache, fs, storeFile, layout, monitor, descriptor );
}

@Override
protected IndexAccessor newIndexAccessor( File storeFile, NumberLayout layout, StoreIndexDescriptor descriptor,
IndexSamplingConfig samplingConfig ) throws IOException
protected IndexAccessor newIndexAccessor( File storeFile, NumberLayout layout, StoreIndexDescriptor descriptor ) throws IOException
{
return new NumberIndexAccessor( pageCache, fs, storeFile, layout, recoveryCleanupWorkCollector, monitor, descriptor,
samplingConfig );
return new NumberIndexAccessor( pageCache, fs, storeFile, layout, recoveryCleanupWorkCollector, monitor, descriptor );
}

@Override
Expand Down
Expand Up @@ -24,18 +24,16 @@
import org.neo4j.internal.kernel.api.IndexQuery;
import org.neo4j.internal.kernel.api.IndexQuery.ExactPredicate;
import org.neo4j.internal.kernel.api.IndexQuery.RangePredicate;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.storageengine.api.schema.IndexDescriptor;
import org.neo4j.values.storable.Value;
import org.neo4j.values.storable.ValueGroup;
import org.neo4j.values.storable.Values;

class NumberIndexReader<VALUE extends NativeIndexValue> extends NativeIndexReader<NumberIndexKey,VALUE>
{
NumberIndexReader( GBPTree<NumberIndexKey,VALUE> tree, IndexLayout<NumberIndexKey,VALUE> layout,
IndexSamplingConfig samplingConfig, IndexDescriptor descriptor )
NumberIndexReader( GBPTree<NumberIndexKey,VALUE> tree, IndexLayout<NumberIndexKey,VALUE> layout, IndexDescriptor descriptor )
{
super( tree, layout, samplingConfig, descriptor );
super( tree, layout, descriptor );
}

@Override
Expand Down

0 comments on commit 25316bc

Please sign in to comment.