Skip to content

Commit

Permalink
Addressed Chris Vest's comments
Browse files Browse the repository at this point in the history
Moved JvmRunner code to TestHelpers
Moved TestHelpers to enterprise kernel
Resolved CC starting Backup protocol unintentionally.
  • Loading branch information
phughk committed Sep 29, 2017
1 parent 80ae0fb commit b63950d
Show file tree
Hide file tree
Showing 34 changed files with 196 additions and 289 deletions.
Expand Up @@ -33,7 +33,7 @@
import org.neo4j.commandline.arguments.Arguments;
import org.neo4j.commandline.arguments.OptionalBooleanArg;
import org.neo4j.commandline.arguments.common.OptionalCanonicalPath;
import org.neo4j.consistency.checking.full.CheckConsistencyConfig;
import org.neo4j.consistency.checking.full.ConsistencyFlags;
import org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException;
import org.neo4j.dbms.DatabaseManagementSystemSettings;
import org.neo4j.helpers.Strings;
Expand Down Expand Up @@ -185,7 +185,7 @@ public void execute( String[] args ) throws IncorrectUsage, CommandFailed
.runFullConsistencyCheck( storeDir, config, ProgressMonitorFactory.textual( System.err ),
FormattedLogProvider.toOutputStream( System.out ), fileSystem, verbose,
reportDir.toFile(),
new CheckConsistencyConfig(
new ConsistencyFlags(
checkGraph, checkIndexes, checkLabelScanStore, checkPropertyOwners ) );

if ( !consistencyCheckResult.isSuccessful() )
Expand Down
Expand Up @@ -25,7 +25,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;

import org.neo4j.consistency.checking.full.CheckConsistencyConfig;
import org.neo4j.consistency.checking.full.ConsistencyFlags;
import org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException;
import org.neo4j.consistency.checking.full.FullCheck;
import org.neo4j.consistency.report.ConsistencySummaryStatistics;
Expand Down Expand Up @@ -98,18 +98,18 @@ public Result runFullConsistencyCheck( File storeDir, Config tuningConfiguration
throws ConsistencyCheckIncompleteException, IOException
{
return runFullConsistencyCheck( storeDir, tuningConfiguration, progressFactory, logProvider, verbose,
new CheckConsistencyConfig(tuningConfiguration) );
new ConsistencyFlags(tuningConfiguration) );
}

public Result runFullConsistencyCheck( File storeDir, Config config, ProgressMonitorFactory progressFactory,
LogProvider logProvider, boolean verbose, CheckConsistencyConfig checkConsistencyConfig )
LogProvider logProvider, boolean verbose, ConsistencyFlags consistencyFlags )
throws ConsistencyCheckIncompleteException, IOException
{
FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction();
try
{
return runFullConsistencyCheck( storeDir, config, progressFactory, logProvider,
fileSystem, verbose, checkConsistencyConfig );
fileSystem, verbose, consistencyFlags );
}
finally
{
Expand All @@ -131,15 +131,15 @@ public Result runFullConsistencyCheck( File storeDir, Config tuningConfiguration
boolean verbose ) throws ConsistencyCheckIncompleteException, IOException
{
return runFullConsistencyCheck( storeDir, tuningConfiguration, progressFactory, logProvider, fileSystem,
verbose, new CheckConsistencyConfig(tuningConfiguration) );
verbose, new ConsistencyFlags(tuningConfiguration) );
}

public Result runFullConsistencyCheck( File storeDir, Config config, ProgressMonitorFactory progressFactory,
LogProvider logProvider, FileSystemAbstraction fileSystem, boolean verbose,
CheckConsistencyConfig checkConsistencyConfig ) throws ConsistencyCheckIncompleteException, IOException
ConsistencyFlags consistencyFlags ) throws ConsistencyCheckIncompleteException, IOException
{
return runFullConsistencyCheck( storeDir, config, progressFactory, logProvider, fileSystem,
verbose, defaultReportDir( config, storeDir ), checkConsistencyConfig );
verbose, defaultReportDir( config, storeDir ), consistencyFlags );
}

@Deprecated
Expand All @@ -148,12 +148,12 @@ public Result runFullConsistencyCheck( File storeDir, Config tuningConfiguration
boolean verbose, File reportDir ) throws ConsistencyCheckIncompleteException, IOException
{
return runFullConsistencyCheck( storeDir, tuningConfiguration, progressFactory, logProvider, fileSystem,
verbose, reportDir, new CheckConsistencyConfig(tuningConfiguration ) );
verbose, reportDir, new ConsistencyFlags(tuningConfiguration ) );
}

public Result runFullConsistencyCheck( File storeDir, Config config, ProgressMonitorFactory progressFactory,
LogProvider logProvider, FileSystemAbstraction fileSystem, boolean verbose, File reportDir,
CheckConsistencyConfig checkConsistencyConfig ) throws ConsistencyCheckIncompleteException, IOException
ConsistencyFlags consistencyFlags ) throws ConsistencyCheckIncompleteException, IOException
{
Log log = logProvider.getLog( getClass() );
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(
Expand All @@ -164,7 +164,7 @@ public Result runFullConsistencyCheck( File storeDir, Config config, ProgressMon
try
{
return runFullConsistencyCheck( storeDir, config, progressFactory, logProvider, fileSystem,
pageCache, verbose, reportDir, checkConsistencyConfig );
pageCache, verbose, reportDir, consistencyFlags );
}
finally
{
Expand All @@ -186,16 +186,16 @@ public Result runFullConsistencyCheck( final File storeDir, Config tuningConfigu
throws ConsistencyCheckIncompleteException
{
return runFullConsistencyCheck( storeDir, tuningConfiguration, progressFactory, logProvider, fileSystem,
pageCache, verbose, new CheckConsistencyConfig(tuningConfiguration ) );
pageCache, verbose, new ConsistencyFlags(tuningConfiguration ) );
}

public Result runFullConsistencyCheck( final File storeDir, Config config, ProgressMonitorFactory progressFactory,
final LogProvider logProvider, final FileSystemAbstraction fileSystem, final PageCache pageCache,
final boolean verbose, CheckConsistencyConfig checkConsistencyConfig )
final boolean verbose, ConsistencyFlags consistencyFlags )
throws ConsistencyCheckIncompleteException
{
return runFullConsistencyCheck( storeDir, config, progressFactory, logProvider, fileSystem, pageCache,
verbose, defaultReportDir( config, storeDir ), checkConsistencyConfig );
verbose, defaultReportDir( config, storeDir ), consistencyFlags );
}

@Deprecated
Expand All @@ -205,12 +205,12 @@ public Result runFullConsistencyCheck( final File storeDir, Config tuningConfigu
throws ConsistencyCheckIncompleteException
{
return runFullConsistencyCheck( storeDir, tuningConfiguration, progressFactory, logProvider, fileSystem,
pageCache, verbose, reportDir, new CheckConsistencyConfig(tuningConfiguration) );
pageCache, verbose, reportDir, new ConsistencyFlags(tuningConfiguration) );
}

public Result runFullConsistencyCheck( final File storeDir, Config config, ProgressMonitorFactory progressFactory,
final LogProvider logProvider, final FileSystemAbstraction fileSystem, final PageCache pageCache,
final boolean verbose, File reportDir, CheckConsistencyConfig checkConsistencyConfig )
final boolean verbose, File reportDir, ConsistencyFlags consistencyFlags )
throws ConsistencyCheckIncompleteException
{
Log log = logProvider.getLog( getClass() );
Expand Down Expand Up @@ -267,7 +267,7 @@ public Result runFullConsistencyCheck( final File storeDir, Config config, Progr
}
storeAccess.initialize();
DirectStoreAccess stores = new DirectStoreAccess( storeAccess, labelScanStore, indexes );
FullCheck check = new FullCheck( progressFactory, statistics, numberOfThreads, checkConsistencyConfig );
FullCheck check = new FullCheck( progressFactory, statistics, numberOfThreads, consistencyFlags );
summary = check.execute( stores, new DuplicatingLog( log, reportLog ) );
}
finally
Expand Down
Expand Up @@ -25,7 +25,7 @@
import java.util.List;
import java.util.Map;

import org.neo4j.consistency.checking.full.CheckConsistencyConfig;
import org.neo4j.consistency.checking.full.ConsistencyFlags;
import org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException;
import org.neo4j.helpers.Args;
import org.neo4j.helpers.Strings;
Expand Down Expand Up @@ -112,7 +112,7 @@ ConsistencyCheckService.Result run( String... args ) throws ToolFailureException
try
{
return consistencyCheckService.runFullConsistencyCheck( storeDir, tuningConfiguration,
ProgressMonitorFactory.textual( System.err ), logProvider, fs, verbose, new CheckConsistencyConfig(tuningConfiguration) );
ProgressMonitorFactory.textual( System.err ), logProvider, fs, verbose, new ConsistencyFlags(tuningConfiguration) );
}
catch ( ConsistencyCheckIncompleteException e )
{
Expand Down
Expand Up @@ -25,22 +25,22 @@
import org.neo4j.consistency.ConsistencyCheckSettings;
import org.neo4j.kernel.configuration.Config;

public class CheckConsistencyConfig
public class ConsistencyFlags
{
private final boolean checkGraph;
private final boolean checkIndexes;
private final boolean checkLabelScanStore;
private final boolean checkPropertyOwners;

public CheckConsistencyConfig( Config tuningConfiguration )
public ConsistencyFlags( Config tuningConfiguration )
{
this( tuningConfiguration.get( ConsistencyCheckSettings.consistency_check_graph ),
tuningConfiguration.get( ConsistencyCheckSettings.consistency_check_indexes ),
tuningConfiguration.get( ConsistencyCheckSettings.consistency_check_label_scan_store ),
tuningConfiguration.get( ConsistencyCheckSettings.consistency_check_property_owners ) );
}

public CheckConsistencyConfig( boolean checkGraph,
public ConsistencyFlags( boolean checkGraph,
boolean checkIndexes,
boolean checkLabelScanStore,
boolean checkPropertyOwners )
Expand Down
Expand Up @@ -66,20 +66,20 @@ public class FullCheck
public FullCheck( Config tuningConfiguration, ProgressMonitorFactory progressFactory,
Statistics statistics, int threads )
{
this(progressFactory, statistics, threads, new CheckConsistencyConfig(tuningConfiguration) );
this(progressFactory, statistics, threads, new ConsistencyFlags(tuningConfiguration) );
}

public FullCheck( ProgressMonitorFactory progressFactory, Statistics statistics, int threads,
CheckConsistencyConfig checkConsistencyConfig )
ConsistencyFlags consistencyFlags )
{
this.statistics = statistics;
this.threads = threads;
this.progressFactory = progressFactory;
this.samplingConfig = new IndexSamplingConfig( Config.embeddedDefaults() );
this.checkGraph = checkConsistencyConfig.isCheckGraph();
this.checkIndexes = checkConsistencyConfig.isCheckIndexes();
this.checkLabelScanStore = checkConsistencyConfig.isCheckLabelScanStore();
this.checkPropertyOwners = checkConsistencyConfig.isCheckPropertyOwners();
this.checkGraph = consistencyFlags.isCheckGraph();
this.checkIndexes = consistencyFlags.isCheckIndexes();
this.checkLabelScanStore = consistencyFlags.isCheckLabelScanStore();
this.checkPropertyOwners = consistencyFlags.isCheckPropertyOwners();
}

public ConsistencySummaryStatistics execute( DirectStoreAccess stores, Log log )
Expand Down

0 comments on commit b63950d

Please sign in to comment.