Skip to content

Commit

Permalink
Merge pull request #11847 from ragadeeshu/3.5-fix-batchinserter
Browse files Browse the repository at this point in the history
Fix batchinserter startup error
  • Loading branch information
ragadeeshu committed May 25, 2018
2 parents 6c26b9c + b4fd06b commit 319b1ed
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,16 @@ public BatchInserterImpl( final File storeDir, final FileSystemAbstraction fileS
schemaStore = neoStores.getSchemaStore();
labelTokenStore = neoStores.getLabelTokenStore();

indexStoreView = new NeoStoreIndexStoreView( LockService.NO_LOCK_SERVICE, neoStores );
Dependencies deps = new Dependencies();
Monitors monitors = new Monitors();
deps.satisfyDependencies( fileSystem, config, logService, indexStoreView, pageCache, monitors,
RecoveryCleanupWorkCollector.IMMEDIATE );
KernelExtensions extensions = life.add( new KernelExtensions(
new SimpleKernelContext( storeDir, DatabaseInfo.UNKNOWN, deps ),
kernelExtensions, deps, UnsatisfiedDependencyStrategies.ignore() ) );
IndexProvider provider = extensions.resolveDependency( IndexProvider.class,
HighestSelectionStrategy.INSTANCE );

IndexProvider provider = extensions.resolveDependency( IndexProvider.class, HighestSelectionStrategy.INSTANCE );
indexProviderMap = new DefaultIndexProviderMap( provider );

List<Token> indexes = propertyKeyTokenStore.getTokens( 10000 );
Expand All @@ -296,12 +300,6 @@ public BatchInserterImpl( final File storeDir, final FileSystemAbstraction fileS
indexStore = life.add( new IndexConfigStore( this.storeDir, fileSystem ) );
schemaCache = new SchemaCache( new StandardConstraintSemantics(), schemaStore, indexProviderMap );

indexStoreView = new NeoStoreIndexStoreView( LockService.NO_LOCK_SERVICE, neoStores );

Monitors monitors = new Monitors();
deps.satisfyDependencies( fileSystem, config, logService, indexStoreView, pageCache, monitors,
RecoveryCleanupWorkCollector.IMMEDIATE );

labelScanStore = new NativeLabelScanStore( pageCache, storeDir, fileSystem, FullStoreChangeStream.EMPTY, false, new Monitors(),
RecoveryCleanupWorkCollector.IMMEDIATE );
life.add( labelScanStore );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2002-2018 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j Enterprise Edition. The included source
* code can be redistributed and/or modified under the terms of the
* GNU AFFERO GENERAL PUBLIC LICENSE Version 3
* (http://www.fsf.org/licensing/licenses/agpl-3.0.html) with the
* Commons Clause, as found in the associated LICENSE.txt file.
*
* 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 Affero General Public License for more details.
*
* Neo4j object code can be licensed independently from the source
* under separate terms from the AGPL. Inquiries can be directed to:
* licensing@neo4j.com
*
* More information is also available at:
* https://neo4j.com/licensing/
*/
package org.neo4j.unsafe.batchinsert;

import org.junit.Rule;
import org.junit.Test;

import org.neo4j.helpers.collection.Iterables;
import org.neo4j.helpers.collection.MapUtil;
import org.neo4j.kernel.api.impl.schema.NativeLuceneFusionIndexProviderFactory20;
import org.neo4j.kernel.extension.KernelExtensionFactory;
import org.neo4j.test.rule.TestDirectory;

import static org.neo4j.unsafe.batchinsert.BatchInserters.inserter;

public class BatchInsertersIT
{

@Rule
public TestDirectory testDirectory = TestDirectory.testDirectory();

@Test
public void shouldStartBatchInserterWithRealIndexProvider() throws Exception
{
BatchInserter inserter = inserter( testDirectory.graphDbDir(), MapUtil.stringMap(), getKernelExtensions() );
//If we didn't throw, all good!
inserter.shutdown();
}

private Iterable<KernelExtensionFactory<?>> getKernelExtensions()
{
return Iterables.asIterable( new NativeLuceneFusionIndexProviderFactory20() );
}
}

0 comments on commit 319b1ed

Please sign in to comment.