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
Lucene Common Analyzers
Lucene Core
Lucene Memory
Lucene QueryParsers
opencsv
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
Lucene QueryParsers
opencsv
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
Lucene QueryParsers
Netty/All-in-One
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
Lucene QueryParsers
Netty/All-in-One
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
Lucene QueryParsers
Netty/All-in-One
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
Lucene QueryParsers
Netty/All-in-One
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
Lucene QueryParsers
opencsv
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
Lucene QueryParsers
opencsv
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
Lucene QueryParsers
opencsv
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
Lucene QueryParsers
opencsv
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 Commons Lang
Lucene Core
Lucene Memory
------------------------------------------------------------------------------

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 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 Commons Lang
Lucene Core
Lucene Memory
------------------------------------------------------------------------------

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 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 Commons Lang
Lucene Core
Lucene Memory
------------------------------------------------------------------------------

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 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
Lucene Common Analyzers
Lucene Core
Lucene Memory
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
Lucene Common Analyzers
Lucene Core
Lucene Memory
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 Commons Lang
Lucene Core
Lucene Memory
------------------------------------------------------------------------------

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 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>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-lucene-upgrade</artifactId>
<version>${project.version}</version>
</dependency>

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

File getStoreDirectory( File storeDir );

/**
* Returns a {@link LegacyIndexProviderTransaction} that keeps transaction state for all
* 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.UnderlyingStorageException;
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.StoreUpgrader;
import org.neo4j.kernel.impl.storemigration.StoreVersionCheck;
Expand Down Expand Up @@ -314,7 +315,7 @@ boolean applicable( DiagnosticsPhase phase )

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

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

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

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

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

// Build all modules and their services
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
// of the dependency tree, starting at the bottom
private void upgradeStore( File storeDir, StoreUpgrader storeMigrationProcess, SchemaIndexProvider indexProvider,
LabelScanStoreProvider labelScanStoreProvider )
LabelScanStoreProvider labelScanStoreProvider, Map<String,IndexImplementation> indexProviders,
LogProvider logProvider )
{
UpgradableDatabase upgradableDatabase =
new UpgradableDatabase( fs, new StoreVersionCheck( pageCache ), new LegacyStoreVersionCheck( fs ) );
storeMigrationProcess.addParticipant( indexProvider.storeMigrationParticipant( fs, pageCache ) );
storeMigrationProcess.addParticipant( new LegacyIndexMigrator( fs, indexProviders, logProvider) );
storeMigrationProcess.addParticipant( storeMigrator );
storeMigrationProcess.migrateIfNeeded( storeDir, upgradableDatabase, indexProvider, labelScanStoreProvider );
}
Expand All @@ -592,7 +596,7 @@ private StorageEngine buildStorageEngine(
return life.add(
new RecordStorageEngine( storeDir, config, idGeneratorFactory, pageCache, fs, logProvider, propertyKeyTokenHolder,
labelTokens, relationshipTypeTokens, schemaStateChangeCallback, constraintSemantics, scheduler,
tokenNameLookup, lockService, indexProvider, indexingServiceMonitor, databaseHealth,
tokenNameLookup, lockService, schemaIndexProvider, indexingServiceMonitor, databaseHealth,
labelScanStore, legacyIndexProviderLookup, indexConfigStore ) );
}

Expand Down

0 comments on commit 3299958

Please sign in to comment.