Skip to content

Commit

Permalink
Introduce neo4j upgrader artifact to be able to migrate oblsolete ver…
Browse files Browse the repository at this point in the history
…sions of lucene indexes.
  • Loading branch information
MishaDemianenko committed Dec 5, 2015
1 parent b369359 commit 3299958
Show file tree
Hide file tree
Showing 101 changed files with 1,995 additions and 99 deletions.
1 change: 1 addition & 0 deletions advanced/neo4j-advanced/LICENSES.txt
Expand Up @@ -7,6 +7,7 @@ Apache Software License, Version 2.0
ConcurrentLinkedHashMap ConcurrentLinkedHashMap
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
opencsv opencsv
parboiled-core parboiled-core
Expand Down
1 change: 1 addition & 0 deletions advanced/neo4j-advanced/NOTICE.txt
Expand Up @@ -29,6 +29,7 @@ Apache Software License, Version 2.0
ConcurrentLinkedHashMap ConcurrentLinkedHashMap
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
opencsv opencsv
parboiled-core parboiled-core
Expand Down
1 change: 1 addition & 0 deletions advanced/server-advanced/LICENSES.txt
Expand Up @@ -24,6 +24,7 @@ Apache Software License, Version 2.0
Jetty :: XML utilities Jetty :: XML utilities
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
Netty/All-in-One Netty/All-in-One
opencsv opencsv
Expand Down
1 change: 1 addition & 0 deletions advanced/server-advanced/NOTICE.txt
Expand Up @@ -46,6 +46,7 @@ Apache Software License, Version 2.0
Jetty :: XML utilities Jetty :: XML utilities
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
Netty/All-in-One Netty/All-in-One
opencsv opencsv
Expand Down
1 change: 1 addition & 0 deletions community/bolt/LICENSES.txt
Expand Up @@ -7,6 +7,7 @@ Apache Software License, Version 2.0
ConcurrentLinkedHashMap ConcurrentLinkedHashMap
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
Netty/All-in-One Netty/All-in-One
opencsv opencsv
Expand Down
1 change: 1 addition & 0 deletions community/bolt/NOTICE.txt
Expand Up @@ -30,6 +30,7 @@ Apache Software License, Version 2.0
ConcurrentLinkedHashMap ConcurrentLinkedHashMap
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
Netty/All-in-One Netty/All-in-One
opencsv opencsv
Expand Down
1 change: 1 addition & 0 deletions community/consistency-check-legacy/LICENSES.txt
Expand Up @@ -6,6 +6,7 @@ Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
------------------------------------------------------------------------------ ------------------------------------------------------------------------------


Expand Down
1 change: 1 addition & 0 deletions community/consistency-check-legacy/NOTICE.txt
Expand Up @@ -29,5 +29,6 @@ Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers


1 change: 1 addition & 0 deletions community/consistency-check/LICENSES.txt
Expand Up @@ -6,6 +6,7 @@ Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
------------------------------------------------------------------------------ ------------------------------------------------------------------------------


Expand Down
1 change: 1 addition & 0 deletions community/consistency-check/NOTICE.txt
Expand Up @@ -29,5 +29,6 @@ Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers


1 change: 1 addition & 0 deletions community/cypher/cypher/LICENSES.txt
Expand Up @@ -6,6 +6,7 @@ Apache Software License, Version 2.0
ConcurrentLinkedHashMap ConcurrentLinkedHashMap
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
opencsv opencsv
parboiled-core parboiled-core
Expand Down
1 change: 1 addition & 0 deletions community/cypher/cypher/NOTICE.txt
Expand Up @@ -29,6 +29,7 @@ Apache Software License, Version 2.0
ConcurrentLinkedHashMap ConcurrentLinkedHashMap
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
opencsv opencsv
parboiled-core parboiled-core
Expand Down
1 change: 1 addition & 0 deletions community/embedded-examples/LICENSES.txt
Expand Up @@ -7,6 +7,7 @@ Apache Software License, Version 2.0
ConcurrentLinkedHashMap ConcurrentLinkedHashMap
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
opencsv opencsv
parboiled-core parboiled-core
Expand Down
1 change: 1 addition & 0 deletions community/embedded-examples/NOTICE.txt
Expand Up @@ -30,6 +30,7 @@ Apache Software License, Version 2.0
ConcurrentLinkedHashMap ConcurrentLinkedHashMap
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
opencsv opencsv
parboiled-core parboiled-core
Expand Down
2 changes: 2 additions & 0 deletions community/graph-algo/LICENSES.txt
Expand Up @@ -4,6 +4,8 @@ libraries. For an overview of the licenses see the NOTICE.txt file.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Apache Software License, Version 2.0 Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Core
Lucene Memory
------------------------------------------------------------------------------ ------------------------------------------------------------------------------


Apache License Apache License
Expand Down
2 changes: 2 additions & 0 deletions community/graph-algo/NOTICE.txt
Expand Up @@ -27,4 +27,6 @@ Third-party licenses


Apache Software License, Version 2.0 Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Core
Lucene Memory


2 changes: 2 additions & 0 deletions community/graph-matching/LICENSES.txt
Expand Up @@ -4,6 +4,8 @@ libraries. For an overview of the licenses see the NOTICE.txt file.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Apache Software License, Version 2.0 Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Core
Lucene Memory
------------------------------------------------------------------------------ ------------------------------------------------------------------------------


Apache License Apache License
Expand Down
2 changes: 2 additions & 0 deletions community/graph-matching/NOTICE.txt
Expand Up @@ -27,4 +27,6 @@ Third-party licenses


Apache Software License, Version 2.0 Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Core
Lucene Memory


2 changes: 2 additions & 0 deletions community/graphviz/LICENSES.txt
Expand Up @@ -4,6 +4,8 @@ libraries. For an overview of the licenses see the NOTICE.txt file.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Apache Software License, Version 2.0 Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Core
Lucene Memory
------------------------------------------------------------------------------ ------------------------------------------------------------------------------


Apache License Apache License
Expand Down
2 changes: 2 additions & 0 deletions community/graphviz/NOTICE.txt
Expand Up @@ -27,4 +27,6 @@ Third-party licenses


Apache Software License, Version 2.0 Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Core
Lucene Memory


1 change: 1 addition & 0 deletions community/import-tool/LICENSES.txt
Expand Up @@ -5,6 +5,7 @@ libraries. For an overview of the licenses see the NOTICE.txt file.
Apache Software License, Version 2.0 Apache Software License, Version 2.0
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers
------------------------------------------------------------------------------ ------------------------------------------------------------------------------


Expand Down
1 change: 1 addition & 0 deletions community/import-tool/NOTICE.txt
Expand Up @@ -28,5 +28,6 @@ Third-party licenses
Apache Software License, Version 2.0 Apache Software License, Version 2.0
Lucene Common Analyzers Lucene Common Analyzers
Lucene Core Lucene Core
Lucene Memory
Lucene QueryParsers Lucene QueryParsers


2 changes: 2 additions & 0 deletions community/kernel/LICENSES.txt
Expand Up @@ -4,6 +4,8 @@ libraries. For an overview of the licenses see the NOTICE.txt file.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Apache Software License, Version 2.0 Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Core
Lucene Memory
------------------------------------------------------------------------------ ------------------------------------------------------------------------------


Apache License Apache License
Expand Down
2 changes: 2 additions & 0 deletions community/kernel/NOTICE.txt
Expand Up @@ -27,4 +27,6 @@ Third-party licenses


Apache Software License, Version 2.0 Apache Software License, Version 2.0
Apache Commons Lang Apache Commons Lang
Lucene Core
Lucene Memory


5 changes: 5 additions & 0 deletions community/kernel/pom.xml
Expand Up @@ -294,6 +294,11 @@ the relevant Commercial Agreement.
<artifactId>neo4j-logging</artifactId> <artifactId>neo4j-logging</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-lucene-upgrade</artifactId>
<version>${project.version}</version>
</dependency>


<!-- test dependencies --> <!-- test dependencies -->
<dependency> <dependency>
Expand Down
Expand Up @@ -35,6 +35,9 @@
*/ */
public interface IndexImplementation extends Lifecycle public interface IndexImplementation extends Lifecycle
{ {

File getStoreDirectory( File storeDir );

/** /**
* Returns a {@link LegacyIndexProviderTransaction} that keeps transaction state for all * Returns a {@link LegacyIndexProviderTransaction} that keeps transaction state for all
* indexes for a given provider in a transaction. * indexes for a given provider in a transaction.
Expand Down
Expand Up @@ -90,6 +90,7 @@
import org.neo4j.kernel.impl.store.StoreId; import org.neo4j.kernel.impl.store.StoreId;
import org.neo4j.kernel.impl.store.UnderlyingStorageException; import org.neo4j.kernel.impl.store.UnderlyingStorageException;
import org.neo4j.kernel.impl.store.record.SchemaRule; import org.neo4j.kernel.impl.store.record.SchemaRule;
import org.neo4j.kernel.impl.storemigration.LegacyIndexMigrator;
import org.neo4j.kernel.impl.storemigration.StoreMigrator; import org.neo4j.kernel.impl.storemigration.StoreMigrator;
import org.neo4j.kernel.impl.storemigration.StoreUpgrader; import org.neo4j.kernel.impl.storemigration.StoreUpgrader;
import org.neo4j.kernel.impl.storemigration.StoreVersionCheck; import org.neo4j.kernel.impl.storemigration.StoreVersionCheck;
Expand Down Expand Up @@ -314,7 +315,7 @@ boolean applicable( DiagnosticsPhase phase )


private Dependencies dependencies; private Dependencies dependencies;
private LifeSupport life; private LifeSupport life;
private SchemaIndexProvider indexProvider; private SchemaIndexProvider schemaIndexProvider;
private File storeDir; private File storeDir;
private boolean readOnly; private boolean readOnly;


Expand Down Expand Up @@ -444,7 +445,7 @@ public void start() throws IOException
dependencies = new Dependencies(); dependencies = new Dependencies();
life = new LifeSupport(); life = new LifeSupport();


indexProvider = dependencyResolver.resolveDependency( SchemaIndexProvider.class, schemaIndexProvider = dependencyResolver.resolveDependency( SchemaIndexProvider.class,
HighestSelectionStrategy.getInstance() ); HighestSelectionStrategy.getInstance() );


LabelScanStoreProvider labelScanStoreProvider = LabelScanStoreProvider labelScanStoreProvider =
Expand All @@ -464,7 +465,8 @@ public void start() throws IOException
life.add( new Lifecycle.Delegate( Lifecycles.multiple( indexProviders.values() ) ) ); life.add( new Lifecycle.Delegate( Lifecycles.multiple( indexProviders.values() ) ) );


// Upgrade the store before we begin // Upgrade the store before we begin
upgradeStore( storeDir, storeMigrationProcess, indexProvider, labelScanStoreProvider ); upgradeStore( storeDir, storeMigrationProcess, schemaIndexProvider, labelScanStoreProvider, indexProviders,
logProvider );


// Build all modules and their services // Build all modules and their services
StorageEngine storageEngine = null; StorageEngine storageEngine = null;
Expand Down Expand Up @@ -572,11 +574,13 @@ public void start() throws IOException
// By doing this sequence of method calls we can ensure that no dependency cycles exist, and get a clearer view // By doing this sequence of method calls we can ensure that no dependency cycles exist, and get a clearer view
// of the dependency tree, starting at the bottom // of the dependency tree, starting at the bottom
private void upgradeStore( File storeDir, StoreUpgrader storeMigrationProcess, SchemaIndexProvider indexProvider, private void upgradeStore( File storeDir, StoreUpgrader storeMigrationProcess, SchemaIndexProvider indexProvider,
LabelScanStoreProvider labelScanStoreProvider ) LabelScanStoreProvider labelScanStoreProvider, Map<String,IndexImplementation> indexProviders,
LogProvider logProvider )
{ {
UpgradableDatabase upgradableDatabase = UpgradableDatabase upgradableDatabase =
new UpgradableDatabase( fs, new StoreVersionCheck( pageCache ), new LegacyStoreVersionCheck( fs ) ); new UpgradableDatabase( fs, new StoreVersionCheck( pageCache ), new LegacyStoreVersionCheck( fs ) );
storeMigrationProcess.addParticipant( indexProvider.storeMigrationParticipant( fs, pageCache ) ); storeMigrationProcess.addParticipant( indexProvider.storeMigrationParticipant( fs, pageCache ) );
storeMigrationProcess.addParticipant( new LegacyIndexMigrator( fs, indexProviders, logProvider) );
storeMigrationProcess.addParticipant( storeMigrator ); storeMigrationProcess.addParticipant( storeMigrator );
storeMigrationProcess.migrateIfNeeded( storeDir, upgradableDatabase, indexProvider, labelScanStoreProvider ); storeMigrationProcess.migrateIfNeeded( storeDir, upgradableDatabase, indexProvider, labelScanStoreProvider );
} }
Expand All @@ -592,7 +596,7 @@ private StorageEngine buildStorageEngine(
return life.add( return life.add(
new RecordStorageEngine( storeDir, config, idGeneratorFactory, pageCache, fs, logProvider, propertyKeyTokenHolder, new RecordStorageEngine( storeDir, config, idGeneratorFactory, pageCache, fs, logProvider, propertyKeyTokenHolder,
labelTokens, relationshipTypeTokens, schemaStateChangeCallback, constraintSemantics, scheduler, labelTokens, relationshipTypeTokens, schemaStateChangeCallback, constraintSemantics, scheduler,
tokenNameLookup, lockService, indexProvider, indexingServiceMonitor, databaseHealth, tokenNameLookup, lockService, schemaIndexProvider, indexingServiceMonitor, databaseHealth,
labelScanStore, legacyIndexProviderLookup, indexConfigStore ) ); labelScanStore, legacyIndexProviderLookup, indexConfigStore ) );
} }


Expand Down

0 comments on commit 3299958

Please sign in to comment.