Skip to content

Commit

Permalink
Merge branch '2.0-maint'
Browse files Browse the repository at this point in the history
Conflicts:
	community/cypher/cypher-docs/src/test/java/org/neo4j/cypher/example/IntroDocTest.java
	community/cypher/cypher-docs/src/test/java/org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
	community/cypher/cypher-docs/src/test/java/org/neo4j/cypher/example/JavaQuery.java
	community/cypher/cypher-docs/src/test/java/org/neo4j/cypher/example/JavaQueryDocTest.java
	community/cypher/cypher-docs/src/test/java/org/neo4j/cypher/javacompat/IntroDocTest.java
	community/cypher/cypher-docs/src/test/java/org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
	community/cypher/cypher-docs/src/test/java/org/neo4j/cypher/javacompat/JavaQuery.java
	community/cypher/cypher-docs/src/test/java/org/neo4j/cypher/javacompat/JavaQueryDocTest.java
	community/cypher/cypher-docs/src/test/scala/org/neo4j/cypher/docgen/DocumentingTestBase.scala
	community/cypher/docs/cypher-docs/src/test/java/org/neo4j/cypher/javacompat/IntroDocTest.java
	community/cypher/docs/cypher-docs/src/test/java/org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
	community/cypher/docs/cypher-docs/src/test/java/org/neo4j/cypher/javacompat/JavaQuery.java
	community/cypher/docs/cypher-docs/src/test/java/org/neo4j/cypher/javacompat/JavaQueryDocTest.java
	community/graph-algo/src/main/java/org/neo4j/graphalgo/impl/path/AStar.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/storemigration/StoreMigratorIT.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/storemigration/legacystore/ReadRecordsTestIT.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/xaframework/TestUpgradeOneDotFourToFiveIT.java
	community/kernel/src/test/java/org/neo4j/test/Unzip.java
	community/kernel/src/test/resources/org/neo4j/kernel/impl/storemigration/legacystore/exampledb.zip
	community/kernel/src/test/resources/org/neo4j/kernel/impl/storemigration/legacystore/propkeydupdb.zip
	community/lucene-index/src/test/java/org/neo4j/kernel/impl/storemigration/legacystore/indexcompat/IndexFormatCompatibilityTest.java
	community/server/src/test/java/org/neo4j/server/preflight/TestPerformUpgradeIfNecessary.java
	community/server/src/test/resources/org/neo4j/server/preflight/legacystore/exampledb/neostore
	community/server/src/test/resources/org/neo4j/server/preflight/legacystore/exampledb/neostore.id
	community/server/src/test/resources/org/neo4j/server/preflight/legacystore/exampledb/neostore.nodestore.db.id
	community/server/src/test/resources/org/neo4j/server/preflight/legacystore/exampledb/neostore.propertystore.db.arrays
	community/server/src/test/resources/org/neo4j/server/preflight/legacystore/exampledb/neostore.propertystore.db.index
	community/server/src/test/resources/org/neo4j/server/preflight/legacystore/exampledb/neostore.propertystore.db.index.id
	community/server/src/test/resources/org/neo4j/server/preflight/legacystore/exampledb/neostore.propertystore.db.index.keys
	community/server/src/test/resources/org/neo4j/server/preflight/legacystore/exampledb/neostore.propertystore.db.strings
	community/server/src/test/resources/org/neo4j/server/preflight/legacystore/exampledb/neostore.relationshiptypestore.db.names
	enterprise/ha/src/main/java/org/neo4j/kernel/ha/cluster/HighAvailabilityModeSwitcher.java
  • Loading branch information
tinwelint committed Apr 15, 2014
2 parents bf7bd4c + 650419e commit 8f1956e
Show file tree
Hide file tree
Showing 56 changed files with 293 additions and 236 deletions.
Expand Up @@ -3,15 +3,15 @@

[TIP]
The full source code of the example:
https://github.com/neo4j/neo4j/blob/{neo4j-git-tag}/community/cypher/cypher-docs/src/test/java/org/neo4j/cypher/javacompat/JavaQuery.java[JavaQuery.java]
https://github.com/neo4j/neo4j/blob/{neo4j-git-tag}/community/cypher/cypher-docs/src/test/java/org/neo4j/cypher/example/JavaQuery.java[JavaQuery.java]

In Java, you can use the <<cypher-query-lang,Cypher query language>> as per the example below.
First, let's add some data.

[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaQuery.java
source=org/neo4j/cypher/example/JavaQuery.java
tag=addData
classifier=test-sources
----
Expand All @@ -21,7 +21,7 @@ Execute a query:
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaQuery.java
source=org/neo4j/cypher/example/JavaQuery.java
tag=execute
classifier=test-sources
----
Expand All @@ -39,7 +39,7 @@ You can get a list of the columns in the result:
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaQuery.java
source=org/neo4j/cypher/example/JavaQuery.java
tag=columns
classifier=test-sources
----
Expand All @@ -53,7 +53,7 @@ To fetch the result items from a single column, do like this:
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaQuery.java
source=org/neo4j/cypher/example/JavaQuery.java
tag=items
classifier=test-sources
----
Expand All @@ -67,7 +67,7 @@ To get all columns, do like this instead:
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaQuery.java
source=org/neo4j/cypher/example/JavaQuery.java
tag=rows
classifier=test-sources
----
Expand Down
Expand Up @@ -9,7 +9,7 @@ Below follows example of how to use parameters when executing Cypher queries fro
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
source=org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
tag=exampleWithParameterForNodeId
classifier=test-sources
----
Expand All @@ -18,7 +18,7 @@ classifier=test-sources
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
source=org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
tag=exampleWithParameterForNodeObject
classifier=test-sources
----
Expand All @@ -27,7 +27,7 @@ classifier=test-sources
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
source=org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
tag=exampleWithParameterForMultipleNodeIds
classifier=test-sources
----
Expand All @@ -36,7 +36,7 @@ classifier=test-sources
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
source=org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
tag=exampleWithStringLiteralAsParameter
classifier=test-sources
----
Expand All @@ -45,7 +45,7 @@ classifier=test-sources
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
source=org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
tag=exampleWithParameterForIndexValue
classifier=test-sources
----
Expand All @@ -54,7 +54,7 @@ classifier=test-sources
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
source=org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
tag=exampleWithParametersForQuery
classifier=test-sources
----
Expand All @@ -63,7 +63,7 @@ classifier=test-sources
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
source=org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
tag=exampleWithParameterForSkipLimit
classifier=test-sources
----
Expand All @@ -72,7 +72,7 @@ classifier=test-sources
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
source=org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
tag=exampleWithParameterRegularExpression
classifier=test-sources
----
Expand All @@ -81,7 +81,7 @@ classifier=test-sources
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
source=org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
tag=create_node_from_map
classifier=test-sources
----
Expand All @@ -90,7 +90,7 @@ classifier=test-sources
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
source=org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
tag=create_multiple_nodes_from_map
classifier=test-sources
----
Expand All @@ -99,7 +99,7 @@ classifier=test-sources
[snippet,java]
----
component=neo4j-cypher-docs
source=org/neo4j/cypher/javacompat/JavaExecutionEngineDocTest.java
source=org/neo4j/cypher/example/JavaExecutionEngineDocTest.java
tag=set_properties_on_a_node_from_a_map
classifier=test-sources
----
Expand Down
Expand Up @@ -200,8 +200,8 @@ protected Node fetchNextOrNull()
@SuppressWarnings( "unchecked" )
private void expand()
{
Iterable<Relationship> relationships = expander.expand( this, BranchState.NO_STATE );
for ( Relationship rel : relationships )
Iterable<Relationship> expand = expander.expand( this, BranchState.NO_STATE );
for ( Relationship rel : expand )
{
lastMetadata.rels++;
Node node = rel.getOtherNode( lastNode );
Expand Down
Expand Up @@ -23,12 +23,15 @@
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import org.neo4j.kernel.DefaultFileSystemAbstraction;
import org.neo4j.kernel.impl.nioneo.store.FileSystemAbstraction;
import org.neo4j.kernel.impl.nioneo.store.NodeRecord;
import org.neo4j.kernel.impl.storemigration.MigrationTestUtils;

import static org.junit.Assert.*;
import static org.neo4j.test.Unzip.unzip;

public class ReadRecordsTestIT
Expand Down Expand Up @@ -58,4 +61,14 @@ public void visit( NodeRecord record )
}

private final FileSystemAbstraction fs = new DefaultFileSystemAbstraction();

private File exampleDbStore( String fileName ) throws IOException
{
return new File( exampleDbStore(), fileName );
}

private File exampleDbStore() throws IOException
{
return MigrationTestUtils.findOldFormatStoreDirectory();
}
}
19 changes: 13 additions & 6 deletions community/kernel/src/test/java/org/neo4j/test/Unzip.java
Expand Up @@ -34,12 +34,14 @@ public class Unzip
public static File unzip( Class<?> testClass, String resource ) throws IOException
{
File dir = TargetDirectory.forTest( testClass ).makeGraphDbDir();
try ( InputStream source = testClass.getResourceAsStream( resource ) )
InputStream source = testClass.getResourceAsStream( resource );
if ( source == null )
{
throw new FileNotFoundException( "Could not find resource '" + resource + "' to unzip" );
}

try
{
if ( source == null )
{
throw new FileNotFoundException( "Could not find resource '" + resource + "' to unzip" );
}
ZipInputStream zipStream = new ZipInputStream( source );
ZipEntry entry = null;
byte[] scratch = new byte[8096];
Expand All @@ -51,7 +53,8 @@ public static File unzip( Class<?> testClass, String resource ) throws IOExcepti
}
else
{
OutputStream file = new BufferedOutputStream( new FileOutputStream( new File( dir, entry.getName() ) ) );
OutputStream file = new BufferedOutputStream(
new FileOutputStream( new File( dir, entry.getName() ) ) );
try
{
long toCopy = entry.getSize();
Expand All @@ -70,6 +73,10 @@ public static File unzip( Class<?> testClass, String resource ) throws IOExcepti
zipStream.closeEntry();
}
}
finally
{
source.close();
}
return dir;
}
}
Binary file not shown.
Expand Up @@ -19,21 +19,21 @@
*/
package org.neo4j.kernel.impl.storemigration.legacystore.indexcompat;

import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import org.neo4j.helpers.collection.IteratorUtil;
import org.neo4j.test.TargetDirectory;
import org.neo4j.test.Unzip;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
Expand All @@ -42,21 +42,17 @@
import static org.neo4j.helpers.collection.Iterables.single;
import static org.neo4j.helpers.collection.IteratorUtil.asList;
import static org.neo4j.helpers.collection.IteratorUtil.asSet;
import static org.neo4j.kernel.impl.util.FileUtils.copyRecursively;
import static org.neo4j.test.Unzip.unzip;

public class IndexFormatCompatibilityTest
{
@Rule
public TargetDirectory.TestDirectory storeDir = TargetDirectory.testDirForTest( getClass() );
private GraphDatabaseService db;

@Before
public void startDatabase() throws IOException
{
copyRecursively( unzip( getClass(), "db.zip" ), storeDir.directory() );
File storeDir = Unzip.unzip( getClass(), "db.zip" );

db = new GraphDatabaseFactory().newEmbeddedDatabase( storeDir.directory().getPath() );
db = new GraphDatabaseFactory().newEmbeddedDatabase( storeDir.getPath() );
}

@After
Expand Down
Binary file not shown.
56 changes: 15 additions & 41 deletions community/neo4j/src/docs/ops/upgrades.asciidoc
Expand Up @@ -3,8 +3,8 @@
Upgrading
=========

A database can be upgraded from a minor version to the next, e.g. 1.1 -> 1.2, and 1.2 -> 1.3,
but you can not jump directly from 1.1 -> 1.3. For version 1.8 in particular, it is possible to
A database can be upgraded from a minor version to the next, e.g. 1.6 -> 1.7, and 1.7 -> 1.8,
but you can not jump directly from 1.6 -> 1.8. For version 1.8 in particular, it is possible to
upgrade directly from version 1.5.3 and later, as an explicit upgrade.
The upgrade process is a one way step; databases cannot be downgraded.

Expand All @@ -14,20 +14,19 @@ automatically when you start up the database using the newer version of Neo4j.
However, some upgrades require more significant changes to the database store.
In these cases, Neo4j will refuse to start without explicit configuration to allow the upgrade.

The table below lists recent Neo4j versions, and the type of upgrade required.

.Upgrade process for Neo4j version
[format="csv",width="50%",cols="3",options="header"]
|====
From Version,To Version,Upgrade Type
1.3,1.4,Automatic
1.4,1.5,Explicit
1.5,1.6,Explicit
1.6,1.7,Automatic
1.7,1.8,Automatic
1.8,1.9,Automatic
1.9,2.0,Explicit
|====
.Upgrade process for recent Neo4j versions

1.6 -> 1.7::
Automatic

1.7 -> 1.8::
Automatic

1.8 -> 1.9::
Automatic

1.9 -> 2.0::
Explicit

[NOTE]
Downgrade is supported only between versions which do not have incompatible store layouts.
Expand Down Expand Up @@ -177,29 +176,4 @@ In an HA environment these steps need to be performed:
. remove the databases except the master and start the master database with 1.7
. start up the other databases so that they get a copy from the master

[[deployment-upgrading-one-six]]
== Upgrade 1.5 -> 1.6 ==

This upgrade changes lucene version from 3.1 to 3.5. The upgrade itself is done by Lucene by loading an index.

In an HA environment these steps need to be performed:

. shut down all the databases in the cluster
. shut down the ZooKeeper cluster and clear the 'version-2' directories on all the ZooKeeper instances
. start the ZooKeeper cluster again
. start up the other databases so that they get a copy from the master

[[deployment-upgrading-one-five]]
== Upgrade 1.4 -> 1.5 ==

This upgrade includes a significant change to the layout of property store files, which reduces their size on disk,
and improves IO performance. To achieve this layout change, the upgrade process takes some time to process the
whole of the existing database. You should budget for several minutes per gigabyte of data as part of your upgrade planning.

[WARNING]
The upgrade process for this upgrade temporarily requires additional disk space, for the period while the
upgrade is in progress. Before starting the upgrade to Neo4j 1.5, you should ensure that the machine performing the
upgrade has free space equal to the current size of of the database on disk. You can find the current space occupied
by the database by inspecting the store file directory ('data/graph.db' is the default location in Neo4j server).
Once the upgrade is complete, this additional space is no longer required.

0 comments on commit 8f1956e

Please sign in to comment.