Skip to content

Commit

Permalink
Renaming KernelHealth to DatabaseHealth.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimwebber authored and apcj committed Dec 3, 2015
1 parent 28b83b5 commit 34b3a15
Show file tree
Hide file tree
Showing 21 changed files with 129 additions and 147 deletions.
Expand Up @@ -140,6 +140,7 @@
import org.neo4j.kernel.info.DiagnosticsExtractor;
import org.neo4j.kernel.info.DiagnosticsManager;
import org.neo4j.kernel.info.DiagnosticsPhase;
import org.neo4j.kernel.internal.DatabaseHealth;
import org.neo4j.kernel.lifecycle.LifeSupport;
import org.neo4j.kernel.lifecycle.Lifecycle;
import org.neo4j.kernel.lifecycle.LifecycleAdapter;
Expand Down Expand Up @@ -294,7 +295,7 @@ boolean applicable( DiagnosticsPhase phase )
private final FileSystemAbstraction fs;
private final StoreUpgrader storeMigrationProcess;
private final TransactionMonitor transactionMonitor;
private final KernelHealth kernelHealth;
private final DatabaseHealth databaseHealth;
private final PhysicalLogFile.Monitor physicalLogMonitor;
private final TransactionHeaderInformationFactory transactionHeaderInformationFactory;
private final StartupStatisticsProvider startupStatistics;
Expand Down Expand Up @@ -354,7 +355,7 @@ public NeoStoreDataSource(
FileSystemAbstraction fs,
StoreUpgrader storeMigrationProcess,
TransactionMonitor transactionMonitor,
KernelHealth kernelHealth,
DatabaseHealth databaseHealth,
PhysicalLogFile.Monitor physicalLogMonitor,
TransactionHeaderInformationFactory transactionHeaderInformationFactory,
StartupStatisticsProvider startupStatistics,
Expand Down Expand Up @@ -382,7 +383,7 @@ public NeoStoreDataSource(
this.fs = fs;
this.storeMigrationProcess = storeMigrationProcess;
this.transactionMonitor = transactionMonitor;
this.kernelHealth = kernelHealth;
this.databaseHealth = databaseHealth;
this.physicalLogMonitor = physicalLogMonitor;
this.transactionHeaderInformationFactory = transactionHeaderInformationFactory;
this.startupStatistics = startupStatistics;
Expand Down Expand Up @@ -554,7 +555,7 @@ public void start() throws IOException
* in the case of HA). Standalone instances will have to be restarted by the user, as is proper for all
* kernel panics.
*/
kernelHealth.healed();
databaseHealth.healed();
}

// Startup sequence
Expand All @@ -580,7 +581,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, kernelHealth,
tokenNameLookup, lockService, indexProvider, indexingServiceMonitor, databaseHealth,
labelScanStore, legacyIndexProviderLookup, indexConfigStore ) );
}

Expand Down Expand Up @@ -641,11 +642,11 @@ public long getTimestampForVersion( long version ) throws IOException
final StoreFlusher storeFlusher = new StoreFlusher( storageEngine, indexProviders );

final LogRotation logRotation =
new LogRotationImpl( monitors.newMonitor( LogRotation.Monitor.class ), logFile, kernelHealth );
new LogRotationImpl( monitors.newMonitor( LogRotation.Monitor.class ), logFile, databaseHealth );

final TransactionAppender appender = life.add( new BatchingTransactionAppender(
logFile, logRotation, transactionMetadataCache, transactionIdStore, legacyIndexTransactionOrdering,
kernelHealth ) );
databaseHealth ) );
final LogicalTransactionStore logicalTransactionStore =
new PhysicalLogicalTransactionStore( logFile, transactionMetadataCache );

Expand All @@ -661,7 +662,7 @@ public long getTimestampForVersion( long version ) throws IOException
CheckPointThresholds.or( countCommittedTransactionThreshold, timeCheckPointThreshold );

final CheckPointerImpl checkPointer = new CheckPointerImpl(
transactionIdStore, threshold, storeFlusher, logPruning, appender, kernelHealth, logProvider,
transactionIdStore, threshold, storeFlusher, logPruning, appender, databaseHealth, logProvider,
tracers.checkPointTracer );

long recurringPeriod = Math.min( timeMillisThreshold, TimeUnit.SECONDS.toMillis( 10 ) );
Expand Down Expand Up @@ -815,7 +816,7 @@ public KernelAPI get()
storageEngine.indexConfigStore(), legacyIndexProviderLookup, hooks, transactionMonitor,
life, tracers, storageEngine ) );

final Kernel kernel = new Kernel( kernelTransactions, hooks, kernelHealth, transactionMonitor );
final Kernel kernel = new Kernel( kernelTransactions, hooks, databaseHealth, transactionMonitor );

kernel.registerTransactionHook( transactionEventHandlers );

Expand Down Expand Up @@ -926,7 +927,7 @@ public synchronized void stop()

//Write new checkpoint in the log only if the kernel is healthy.
// We cannot throw here since we need to shutdown without exceptions.
if ( kernelHealth.isHealthy() )
if ( databaseHealth.isHealthy() )
{
try
{
Expand Down Expand Up @@ -954,7 +955,7 @@ private void awaitAllTransactionsClosed()
{
// Only wait for committed transactions to be applied if the kernel is healthy (i.e. no panic)
// otherwise if there has been a panic transactions will not be applied properly anyway.
while ( kernelHealth.isHealthy() &&
while ( databaseHealth.isHealthy() &&
!storageEngine.neoStores().getMetaDataStore().closedTransactionIdIsOnParWithOpenedTransactionId() )
{
LockSupport.parkNanos( 10_000_000 ); // 10 ms
Expand Down
Expand Up @@ -39,7 +39,7 @@ public TransactionFailureException( Status statusCode, String message, Object...
super( statusCode, message, parameters );
}

// To satisfy KernelHealth
// To satisfy DatabaseHealth
public TransactionFailureException( String message, Throwable cause )
{
super( Status.Transaction.CouldNotBegin, cause, message );
Expand Down
Expand Up @@ -19,7 +19,7 @@
*/
package org.neo4j.kernel.impl.api;

import org.neo4j.kernel.KernelHealth;
import org.neo4j.kernel.internal.DatabaseHealth;
import org.neo4j.kernel.api.KernelAPI;
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.api.TransactionHook;
Expand Down Expand Up @@ -63,11 +63,11 @@ public class Kernel extends LifecycleAdapter implements KernelAPI
{
private final KernelTransactions transactions;
private final TransactionHooks hooks;
private final KernelHealth health;
private final DatabaseHealth health;
private final TransactionMonitor transactionMonitor;

public Kernel( KernelTransactions transactionFactory,
TransactionHooks hooks, KernelHealth health, TransactionMonitor transactionMonitor )
TransactionHooks hooks, DatabaseHealth health, TransactionMonitor transactionMonitor )
{
this.transactions = transactionFactory;
this.hooks = hooks;
Expand Down
Expand Up @@ -21,7 +21,7 @@

import java.io.IOException;

import org.neo4j.kernel.KernelHealth;
import org.neo4j.kernel.internal.DatabaseHealth;
import org.neo4j.kernel.api.index.NodePropertyUpdate;
import org.neo4j.kernel.impl.store.NeoStores;
import org.neo4j.kernel.impl.store.NodeStore;
Expand All @@ -43,13 +43,13 @@ public class OnlineIndexUpdatesValidator implements IndexUpdatesValidator
private final PropertyStore propertyStore;
private final PropertyLoader propertyLoader;
private final IndexingService indexing;
private final KernelHealth kernelHealth;
private final DatabaseHealth databaseHealth;
private final IndexUpdateMode updateMode;

public OnlineIndexUpdatesValidator( NeoStores neoStore, KernelHealth kernelHealth, PropertyLoader propertyLoader,
IndexingService indexing, IndexUpdateMode updateMode )
public OnlineIndexUpdatesValidator( NeoStores neoStore, DatabaseHealth databaseHealth, PropertyLoader propertyLoader,
IndexingService indexing, IndexUpdateMode updateMode )
{
this.kernelHealth = kernelHealth;
this.databaseHealth = databaseHealth;
this.updateMode = updateMode;
this.nodeStore = neoStore.getNodeStore();
this.propertyStore = neoStore.getPropertyStore();
Expand All @@ -67,7 +67,7 @@ public ValidatedIndexUpdates validate( TransactionRepresentation transaction ) t
}
catch ( IOException cause )
{
kernelHealth.panic( cause );
databaseHealth.panic( cause );
throw cause;
}

Expand Down
Expand Up @@ -25,11 +25,11 @@
import org.neo4j.graphdb.event.ErrorState;
import org.neo4j.kernel.KernelEventHandlers;

public class KernelPanicEventGenerator
public class DatabasePanicEventGenerator
{
private final KernelEventHandlers kernelEventHandlers;

public KernelPanicEventGenerator( KernelEventHandlers kernelEventHandlers )
public DatabasePanicEventGenerator( KernelEventHandlers kernelEventHandlers )
{
this.kernelEventHandlers = kernelEventHandlers;
}
Expand Down
Expand Up @@ -36,7 +36,7 @@
import org.neo4j.kernel.AvailabilityGuard;
import org.neo4j.kernel.DatabaseAvailability;
import org.neo4j.kernel.KernelEventHandlers;
import org.neo4j.kernel.KernelHealth;
import org.neo4j.kernel.internal.DatabaseHealth;
import org.neo4j.kernel.NeoStoreDataSource;
import org.neo4j.kernel.TransactionEventHandlers;
import org.neo4j.kernel.api.KernelAPI;
Expand All @@ -47,7 +47,7 @@
import org.neo4j.kernel.impl.api.SchemaWriteGuard;
import org.neo4j.kernel.impl.api.index.IndexingService;
import org.neo4j.kernel.impl.cache.MonitorGc;
import org.neo4j.kernel.impl.core.KernelPanicEventGenerator;
import org.neo4j.kernel.impl.core.DatabasePanicEventGenerator;
import org.neo4j.kernel.impl.core.NodeManager;
import org.neo4j.kernel.impl.core.NodeProxy;
import org.neo4j.kernel.impl.core.RelationshipProxy;
Expand Down Expand Up @@ -177,11 +177,11 @@ public GraphDatabaseService getGraphDatabaseService()

kernelEventHandlers = new KernelEventHandlers( logging.getInternalLog( KernelEventHandlers.class ) );

KernelPanicEventGenerator kernelPanicEventGenerator = deps.satisfyDependency(
new KernelPanicEventGenerator( kernelEventHandlers ) );
DatabasePanicEventGenerator databasePanicEventGenerator = deps.satisfyDependency(
new DatabasePanicEventGenerator( kernelEventHandlers ) );

KernelHealth kernelHealth = deps.satisfyDependency( new KernelHealth( kernelPanicEventGenerator,
logging.getInternalLog( KernelHealth.class ) ) );
DatabaseHealth databaseHealth = deps.satisfyDependency( new DatabaseHealth( databasePanicEventGenerator,
logging.getInternalLog( DatabaseHealth.class ) ) );

neoStoreDataSource = deps.satisfyDependency( new NeoStoreDataSource( storeDir, config,
editionModule.idGeneratorFactory, logging.getInternalLogProvider(), platformModule.jobScheduler,
Expand All @@ -190,7 +190,7 @@ public GraphDatabaseService getGraphDatabaseService()
deps, editionModule.propertyKeyTokenHolder, editionModule.labelTokenHolder, relationshipTypeTokenHolder,
editionModule.lockManager, schemaWriteGuard, transactionEventHandlers,
platformModule.monitors.newMonitor( IndexingService.Monitor.class ), fileSystem,
storeMigrationProcess, platformModule.transactionMonitor, kernelHealth,
storeMigrationProcess, platformModule.transactionMonitor, databaseHealth,
platformModule.monitors.newMonitor( PhysicalLogFile.Monitor.class ),
editionModule.headerInformationFactory, startupStatistics, nodeManager, guard,
editionModule.commitProcessFactory, pageCache, editionModule.constraintSemantics,
Expand Down
Expand Up @@ -22,7 +22,6 @@
import java.util.Collection;
import java.util.stream.Stream;

import org.neo4j.kernel.KernelHealth;
import org.neo4j.kernel.api.exceptions.TransactionFailureException;
import org.neo4j.kernel.api.exceptions.schema.ConstraintValidationKernelException;
import org.neo4j.kernel.api.exceptions.schema.CreateConstraintFailureException;
Expand Down Expand Up @@ -161,9 +160,6 @@ Collection<Command> createCommands(
@Deprecated
IndexConfigStore indexConfigStore();

@Deprecated
KernelHealth kernelHealth();

@Deprecated
IdOrderingQueue legacyIndexTransactionOrdering();

Expand Down
Expand Up @@ -33,7 +33,7 @@
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.IdGeneratorFactory;
import org.neo4j.kernel.KernelHealth;
import org.neo4j.kernel.internal.DatabaseHealth;
import org.neo4j.kernel.api.TokenNameLookup;
import org.neo4j.kernel.api.exceptions.TransactionFailureException;
import org.neo4j.kernel.api.exceptions.schema.ConstraintValidationKernelException;
Expand Down Expand Up @@ -127,7 +127,7 @@ public class RecordStorageEngine implements StorageEngine, Lifecycle
private final PropertyKeyTokenHolder propertyKeyTokenHolder;
private final RelationshipTypeTokenHolder relationshipTypeTokenHolder;
private final LabelTokenHolder labelTokenHolder;
private final KernelHealth kernelHealth;
private final DatabaseHealth databaseHealth;
private final IndexConfigStore indexConfigStore;
private final SchemaCache schemaCache;
private final IntegrityValidator integrityValidator;
Expand Down Expand Up @@ -162,7 +162,7 @@ public RecordStorageEngine(
LockService lockService,
SchemaIndexProvider indexProvider,
IndexingService.Monitor indexingServiceMonitor,
KernelHealth kernelHealth,
DatabaseHealth databaseHealth,
LabelScanStoreProvider labelScanStoreProvider,
LegacyIndexProviderLookup legacyIndexProviderLookup,
IndexConfigStore indexConfigStore )
Expand All @@ -173,7 +173,7 @@ public RecordStorageEngine(
this.schemaStateChangeCallback = schemaStateChangeCallback;
this.constraintSemantics = constraintSemantics;
this.lockService = lockService;
this.kernelHealth = kernelHealth;
this.databaseHealth = databaseHealth;
this.indexConfigStore = indexConfigStore;
final StoreFactory storeFactory = new StoreFactory( storeDir, config, idGeneratorFactory, pageCache, fs, logProvider );
neoStores = storeFactory.openAllNeoStores( true );
Expand All @@ -192,7 +192,7 @@ public RecordStorageEngine(

integrityValidator = new IntegrityValidator( neoStores, indexingService );
indexUpdatesValidator = new OnlineIndexUpdatesValidator(
neoStores, kernelHealth, new PropertyLoader( neoStores ),
neoStores, databaseHealth, new PropertyLoader( neoStores ),
indexingService, IndexUpdateMode.BATCHED );
cacheAccess = new BridgingCacheAccess( schemaCache, schemaStateChangeCallback,
propertyKeyTokenHolder, relationshipTypeTokens, labelTokens );
Expand Down Expand Up @@ -303,7 +303,7 @@ public void apply( TransactionToApply batch, TransactionApplicationMode mode ) t
}
catch ( Throwable cause )
{
kernelHealth.panic( cause );
databaseHealth.panic( cause );
throw cause;
}
}
Expand Down Expand Up @@ -439,12 +439,6 @@ public IndexConfigStore indexConfigStore()
return indexConfigStore;
}

@Override
public KernelHealth kernelHealth()
{
return kernelHealth;
}

@Override
public IdOrderingQueue legacyIndexTransactionOrdering()
{
Expand Down
Expand Up @@ -29,7 +29,7 @@
import java.util.concurrent.locks.ReentrantLock;

import org.neo4j.helpers.ThisShouldNotHappenError;
import org.neo4j.kernel.KernelHealth;
import org.neo4j.kernel.internal.DatabaseHealth;
import org.neo4j.kernel.impl.api.TransactionToApply;
import org.neo4j.kernel.impl.transaction.TransactionRepresentation;
import org.neo4j.kernel.impl.transaction.log.entry.LogEntryWriter;
Expand Down Expand Up @@ -64,7 +64,7 @@ public class BatchingTransactionAppender extends LifecycleAdapter implements Tra
private final LogRotation logRotation;
private final TransactionIdStore transactionIdStore;
private final LogPositionMarker positionMarker = new LogPositionMarker();
private final KernelHealth kernelHealth;
private final DatabaseHealth databaseHealth;
private final Lock forceLock = new ReentrantLock();

private WritableLogChannel writer;
Expand All @@ -73,13 +73,13 @@ public class BatchingTransactionAppender extends LifecycleAdapter implements Tra

public BatchingTransactionAppender( LogFile logFile, LogRotation logRotation,
TransactionMetadataCache transactionMetadataCache, TransactionIdStore transactionIdStore,
IdOrderingQueue legacyIndexTransactionOrdering, KernelHealth kernelHealth )
IdOrderingQueue legacyIndexTransactionOrdering, DatabaseHealth databaseHealth )
{
this.logFile = logFile;
this.logRotation = logRotation;
this.transactionIdStore = transactionIdStore;
this.legacyIndexTransactionOrdering = legacyIndexTransactionOrdering;
this.kernelHealth = kernelHealth;
this.databaseHealth = databaseHealth;
this.transactionMetadataCache = transactionMetadataCache;
}

Expand All @@ -105,7 +105,7 @@ public long append( TransactionToApply batch, LogAppendEvent logAppendEvent ) th
synchronized ( logFile )
{
// Assert that kernel is healthy before making any changes
kernelHealth.assertHealthy( IOException.class );
databaseHealth.assertHealthy( IOException.class );
try ( SerializeTransactionEvent serialiseEvent = logAppendEvent.beginSerializeTransaction() )
{
// Append all transactions in this batch to the log under the same logFile monitor
Expand Down Expand Up @@ -176,7 +176,7 @@ public void checkPoint( LogPosition logPosition, LogCheckPointEvent logCheckPoin
}
catch ( Throwable cause )
{
kernelHealth.panic( cause );
databaseHealth.panic( cause );
throw cause;
}

Expand Down Expand Up @@ -224,7 +224,7 @@ private TransactionCommitment appendToLog( TransactionRepresentation transaction
}
catch ( final Throwable panic )
{
kernelHealth.panic( panic );
databaseHealth.panic( panic );
throw panic;
}
}
Expand Down Expand Up @@ -281,7 +281,7 @@ private void forceLog( LogForceEvents logForceEvents ) throws IOException
}
catch ( final Throwable panic )
{
kernelHealth.panic( panic );
databaseHealth.panic( panic );
throw panic;
}
finally
Expand Down

0 comments on commit 34b3a15

Please sign in to comment.