Skip to content

Commit

Permalink
Reversed dependency between CC and backup
Browse files Browse the repository at this point in the history
Before this commit, CC is dependant on backup.
Applying this commit will shuffle dependencies around to be more sensible
  • Loading branch information
phughk committed Sep 29, 2017
1 parent 48c0290 commit 1f1ff95
Show file tree
Hide file tree
Showing 30 changed files with 198 additions and 158 deletions.
Expand Up @@ -77,7 +77,7 @@ final class MuninnPagedFile implements PagedFile, Flushable
/**
* The header state includes both the reference count of the PagedFile – 15 bits – and the ID of the last page in
* the file – 48 bits, plus an empty file marker bit. Because our pages are usually 2^13 bytes, this means that we
* only loose 3 bits to the reference count, in terms of keeping large files byte addressable.
* only lose 3 bits to the reference count, in terms of keeping large files byte addressable.
*
* The layout looks like this:
*
Expand Down
Expand Up @@ -25,7 +25,7 @@ public class DefaultPageCursorTracerSupplier implements PageCursorTracerSupplier

public static final DefaultPageCursorTracerSupplier INSTANCE = new DefaultPageCursorTracerSupplier();

private DefaultPageCursorTracerSupplier()
public DefaultPageCursorTracerSupplier()
{
}

Expand Down
33 changes: 33 additions & 0 deletions enterprise/backup/LICENSES.txt
Expand Up @@ -5,6 +5,10 @@ libraries. For an overview of the licenses see the NOTICE.txt file.
Apache Software License, Version 2.0
Apache Commons Compress
Apache Commons Lang
Apache Shiro :: Core
Caffeine cache
Commons BeanUtils
hazelcast-all
Lucene Core
Lucene Memory
Netty
Expand Down Expand Up @@ -246,4 +250,33 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


------------------------------------------------------------------------------
MIT License
SLF4J API Module
SLF4J NOP Binding
------------------------------------------------------------------------------

The MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.



8 changes: 8 additions & 0 deletions enterprise/backup/NOTICE.txt
Expand Up @@ -27,6 +27,10 @@ Third-party licenses
Apache Software License, Version 2.0
Apache Commons Compress
Apache Commons Lang
Apache Shiro :: Core
Caffeine cache
Commons BeanUtils
hazelcast-all
Lucene Core
Lucene Memory
Netty
Expand All @@ -36,3 +40,7 @@ Bouncy Castle License
Bouncy Castle PKIX, CMS, EAC, TSP, PKCS, OCSP, CMP, and CRMF APIs
Bouncy Castle Provider

MIT License
SLF4J API Module
SLF4J NOP Binding

19 changes: 19 additions & 0 deletions enterprise/backup/pom.xml
Expand Up @@ -76,6 +76,11 @@
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-causal-clustering</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-com</artifactId>
Expand Down Expand Up @@ -109,6 +114,13 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-causal-clustering</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
Expand Down Expand Up @@ -147,6 +159,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-enterprise-kernel</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-io</artifactId>
Expand Down
Expand Up @@ -20,7 +20,6 @@
package org.neo4j.backup;

import org.apache.commons.lang3.SystemUtils;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
Expand All @@ -30,36 +29,29 @@
import org.junit.runners.Parameterized.Parameters;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.neo4j.commandline.admin.AdminTool;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.io.proc.ProcessUtil;
import org.neo4j.kernel.configuration.Settings;
import org.neo4j.kernel.impl.store.format.highlimit.HighLimit;
import org.neo4j.kernel.impl.store.format.standard.Standard;
import org.neo4j.test.DbRepresentation;
import org.neo4j.test.ProcessStreamHandler;
import org.neo4j.test.rule.EmbeddedDatabaseRule;
import org.neo4j.test.rule.SuppressOutput;
import org.neo4j.test.rule.TestDirectory;
import org.neo4j.util.JvmRunner;

import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeFalse;

@RunWith( Parameterized.class )
public class OnlineBackupCommandIT
public class OnlineBackupCommandIT extends JvmRunner
{
@ClassRule
public static final TestDirectory testDirectory = TestDirectory.testDirectory();

private final EmbeddedDatabaseRule db = new EmbeddedDatabaseRule( testDirectory.directory( "db" ) ).startLazily();
private final EmbeddedDatabaseRule db = new EmbeddedDatabaseRule().startLazily();

@Rule
public final RuleChain ruleChain = RuleChain.outerRule( SuppressOutput.suppressAll() ).around( db );
Expand Down Expand Up @@ -154,26 +146,6 @@ private void startDb( String backupPort )
createSomeData( db );
}

private static int runBackupToolFromOtherJvmToGetExitCode( String... args )
throws Exception
{
return runBackupToolFromOtherJvmToGetExitCode( testDirectory.absolutePath(), args );
}

public static int runBackupToolFromOtherJvmToGetExitCode( File neo4jHome, String... args )
throws Exception
{
List<String> allArgs = new ArrayList<>( Arrays.asList(
ProcessUtil.getJavaExecutable().toString(), "-cp", ProcessUtil.getClassPath(),
AdminTool.class.getName() ) );
allArgs.add( "backup" );
allArgs.addAll( Arrays.asList( args ) );

Process process = Runtime.getRuntime().exec( allArgs.toArray( new String[allArgs.size()] ),
new String[] {"NEO4J_HOME=" + neo4jHome.getAbsolutePath()} );
return new ProcessStreamHandler( process, true ).waitForResult();
}

private DbRepresentation getDbRepresentation()
{
return DbRepresentation.of( db );
Expand Down
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.causalclustering.backup;
package org.neo4j.backup.causalclustering;

import org.junit.Before;
import org.junit.Rule;
Expand All @@ -44,7 +44,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.neo4j.backup.OnlineBackupCommandIT.runBackupToolFromOtherJvmToGetExitCode;
import static org.neo4j.util.JvmRunner.runBackupToolFromOtherJvmToGetExitCode;
import static org.neo4j.graphdb.Label.label;

public class BackupCoreIT
Expand Down
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.causalclustering.backup;
package org.neo4j.backup.causalclustering;

import org.junit.Before;
import org.junit.Rule;
Expand All @@ -42,11 +42,11 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.neo4j.backup.OnlineBackupCommandIT.runBackupToolFromOtherJvmToGetExitCode;
import static org.neo4j.causalclustering.backup.BackupCoreIT.backupArguments;
import static org.neo4j.causalclustering.backup.BackupCoreIT.createSomeData;
import static org.neo4j.causalclustering.backup.BackupCoreIT.getConfig;
import static org.neo4j.backup.causalclustering.BackupCoreIT.backupArguments;
import static org.neo4j.backup.causalclustering.BackupCoreIT.createSomeData;
import static org.neo4j.backup.causalclustering.BackupCoreIT.getConfig;
import static org.neo4j.function.Predicates.awaitEx;
import static org.neo4j.util.JvmRunner.runBackupToolFromOtherJvmToGetExitCode;

public class BackupReadReplicaIT
{
Expand Down
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.causalclustering.backup;
package org.neo4j.backup.causalclustering;

import org.junit.After;
import org.junit.Before;
Expand All @@ -44,10 +44,10 @@
import static java.util.Collections.emptyMap;
import static java.util.Collections.singletonMap;
import static org.junit.Assert.assertEquals;
import static org.neo4j.backup.OnlineBackupCommandIT.runBackupToolFromOtherJvmToGetExitCode;
import static org.neo4j.causalclustering.backup.BackupCoreIT.backupAddress;
import static org.neo4j.backup.causalclustering.BackupCoreIT.backupAddress;
import static org.neo4j.causalclustering.discovery.Cluster.dataMatchesEventually;
import static org.neo4j.causalclustering.helpers.DataCreator.createEmptyNodes;
import static org.neo4j.util.JvmRunner.runBackupToolFromOtherJvmToGetExitCode;

public class ClusterSeedingIT
{
Expand Down
14 changes: 0 additions & 14 deletions enterprise/causal-clustering/pom.xml
Expand Up @@ -159,20 +159,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-backup</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-backup</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher</artifactId>
Expand Down
Expand Up @@ -25,8 +25,8 @@
import javax.annotation.Nonnull;

import org.neo4j.causalclustering.load_balancing.LoadBalancingPluginLoader;
import org.neo4j.cluster.ClusterSettings;
import org.neo4j.cluster.ClusterSettings.Mode;
import org.neo4j.kernel.impl.enterprise.configuration.EnterpriseEditionSettings;
import org.neo4j.kernel.impl.enterprise.configuration.EnterpriseEditionSettings.Mode;
import org.neo4j.graphdb.config.InvalidSettingException;
import org.neo4j.graphdb.config.SettingValidator;
import org.neo4j.kernel.configuration.Config;
Expand All @@ -43,7 +43,7 @@ public Map<String,String> validate( @Nonnull Collection<SettingValidator> settin
@Nonnull Map<String,String> rawConfig, @Nonnull Log log, boolean parsingFile ) throws InvalidSettingException
{
// Make sure mode is CC
Mode mode = ClusterSettings.mode.apply( rawConfig::get );
Mode mode = EnterpriseEditionSettings.mode.apply( rawConfig::get );
if ( !mode.equals( Mode.CORE ) && !mode.equals( Mode.READ_REPLICA ) )
{
// Nothing to validate
Expand Down
Expand Up @@ -22,8 +22,6 @@
import java.io.File;
import java.util.function.Supplier;

import org.neo4j.backup.OnlineBackupKernelExtension;
import org.neo4j.backup.OnlineBackupSettings;
import org.neo4j.causalclustering.ReplicationModule;
import org.neo4j.causalclustering.catchup.CatchUpClient;
import org.neo4j.causalclustering.catchup.CatchupServer;
Expand Down Expand Up @@ -62,13 +60,11 @@
import org.neo4j.causalclustering.messaging.CoreReplicatedContentMarshal;
import org.neo4j.causalclustering.messaging.LoggingInbound;
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.kernel.NeoStoreDataSource;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.factory.PlatformModule;
import org.neo4j.kernel.impl.logging.LogService;
import org.neo4j.kernel.impl.transaction.log.LogicalTransactionStore;
import org.neo4j.kernel.impl.transaction.log.TransactionIdStore;
import org.neo4j.kernel.impl.transaction.state.DataSourceManager;
import org.neo4j.kernel.impl.util.Dependencies;
import org.neo4j.kernel.impl.util.JobScheduler;
import org.neo4j.kernel.internal.DatabaseHealth;
Expand Down Expand Up @@ -136,29 +132,6 @@ public CoreServerModule( IdentityModule identityModule, final PlatformModule pla

LifeSupport servicesToStopOnStoreCopy = new LifeSupport();

if ( config.get( OnlineBackupSettings.online_backup_enabled ) )
{
platformModule.dataSourceManager.addListener( new DataSourceManager.Listener()
{
@Override
public void registered( NeoStoreDataSource dataSource )
{
servicesToStopOnStoreCopy.add( pickBackupExtension( dataSource ) );
}

@Override
public void unregistered( NeoStoreDataSource dataSource )
{
servicesToStopOnStoreCopy.remove( pickBackupExtension( dataSource ) );
}

private OnlineBackupKernelExtension pickBackupExtension( NeoStoreDataSource dataSource )
{
return dataSource.getDependencyResolver().resolveDependency( OnlineBackupKernelExtension.class );
}
} );
}

CoreState coreState = new CoreState( coreStateMachinesModule.coreStateMachines,
replicationModule.getSessionTracker(), lastFlushedStorage );

Expand Down

0 comments on commit 1f1ff95

Please sign in to comment.