Skip to content

Commit

Permalink
Disables channel striping for the parallel population parts
Browse files Browse the repository at this point in the history
Because they are accessed by a single thread anyway.
Striping each part would create numberOfCores^2 file handles
for populating one index.
  • Loading branch information
tinwelint committed Oct 11, 2018
1 parent 7a63327 commit e0fee18
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.pagecache.IOLimiter;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.io.pagecache.PageCacheOpenOptions;
import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.index.IndexEntryUpdate;
Expand Down Expand Up @@ -80,7 +81,7 @@ public abstract class NativeIndexPopulator<KEY extends NativeIndexKey<KEY>, VALU
NativeIndexPopulator( PageCache pageCache, FileSystemAbstraction fs, File storeFile, IndexLayout<KEY,VALUE> layout, IndexProvider.Monitor monitor,
StoreIndexDescriptor descriptor, Consumer<PageCursor> additionalHeaderWriter, OpenOption... openOptions )
{
super( pageCache, fs, storeFile, layout, monitor, descriptor, openOptions );
super( pageCache, fs, storeFile, layout, monitor, descriptor, withNoStriping( openOptions ) );
this.treeKey = layout.newKey();
this.treeValue = layout.newValue();
this.additionalHeaderWriter = additionalHeaderWriter;
Expand All @@ -97,6 +98,14 @@ public abstract class NativeIndexPopulator<KEY extends NativeIndexKey<KEY>, VALU
}
}

/**
* Because index population is effectively single-threaded. For parallel population each thread has its own part so single-threaded even there.
*/
private static OpenOption[] withNoStriping( OpenOption[] openOptions )
{
return ArrayUtils.add( openOptions, PageCacheOpenOptions.NO_CHANNEL_STRIPING );
}

public void clear()
{
deleteFileIfPresent( fileSystem, storeFile );
Expand Down

0 comments on commit e0fee18

Please sign in to comment.