use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class TestDatabaseManagementServiceBuilder method build.
@Override
public DatabaseManagementService build() {
Config cfg = config.set(GraphDatabaseSettings.neo4j_home, homeDirectory.toAbsolutePath()).fromConfig(fromConfig).build();
var originalDependencies = dependencies;
if (noOpSystemGraphInitializer) {
dependencies = TestDatabaseIdRepository.noOpSystemGraphInitializer(dependencies, cfg);
}
if (lazyProcedures) {
var dependencyWrapper = new Dependencies(dependencies);
dependencyWrapper.satisfyDependency(new LazyProcedures());
dependencies = dependencyWrapper;
}
var dbms = newDatabaseManagementService(cfg, databaseDependencies());
dependencies = originalDependencies;
return dbms;
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class DatabaseRecoveryIT method shouldSeeTheSameRecordsAtCheckpointAsAfterReverseRecovery.
@Test
void shouldSeeTheSameRecordsAtCheckpointAsAfterReverseRecovery() throws Exception {
// given
EphemeralFileSystemAbstraction fs = new EphemeralFileSystemAbstraction();
managementService = new TestDatabaseManagementServiceBuilder(directory.homePath()).setFileSystem(fs).impermanent().build();
GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
produceRandomGraphUpdates(db, 100);
checkPoint(db);
EphemeralFileSystemAbstraction checkPointFs = fs.snapshot();
// when
produceRandomGraphUpdates(db, 100);
flush(db);
EphemeralFileSystemAbstraction crashedFs = fs.snapshot();
managementService.shutdown();
fs.close();
Dependencies dependencies = new Dependencies();
Monitors monitors;
AtomicReference<EphemeralFileSystemAbstraction> reversedFs;
try (PageCache pageCache = pageCacheExtension.getPageCache(crashedFs)) {
dependencies.satisfyDependencies(pageCache);
monitors = new Monitors();
reversedFs = new AtomicReference<>();
monitors.addMonitorListener(new RecoveryMonitor() {
@Override
public void reverseStoreRecoveryCompleted(long checkpointTxId) {
try {
// Flush the page cache which will fished out of the GlobalModule at the point of constructing the database
pageCache.flushAndForce();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
// The stores should now be equal in content to the db as it was right after the checkpoint.
// Grab a snapshot so that we can compare later.
reversedFs.set(crashedFs.snapshot());
}
});
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(directory.homePath()).setFileSystem(crashedFs).setExternalDependencies(dependencies).setMonitors(monitors).impermanent().build();
managementService.shutdown();
}
// then
fs.close();
try {
// Here we verify that the neostore contents, record by record are exactly the same when comparing
// the store as it was right after the checkpoint with the store as it was right after reverse recovery completed.
assertSameStoreContents(checkPointFs, reversedFs.get(), databaseLayout);
} finally {
IOUtils.closeAll(checkPointFs, reversedFs.get());
}
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class DbmsDiagnosticsManager method dumpDatabaseDiagnostics.
private static void dumpDatabaseDiagnostics(Database database, Log log, boolean checkStatus) {
dumpAsSingleMessageWithDbPrefix(log, stringJoiner -> {
dumpDatabaseSectionName(database, stringJoiner::add);
if (checkStatus) {
logDatabaseStatus(database, stringJoiner::add);
if (!database.isStarted()) {
return;
}
}
Dependencies databaseResolver = database.getDependencyResolver();
DbmsInfo dbmsInfo = databaseResolver.resolveDependency(DbmsInfo.class);
FileSystemAbstraction fs = databaseResolver.resolveDependency(FileSystemAbstraction.class);
StorageEngineFactory storageEngineFactory = databaseResolver.resolveDependency(StorageEngineFactory.class);
StorageEngine storageEngine = databaseResolver.resolveDependency(StorageEngine.class);
DiagnosticsManager.dump(new VersionDiagnostics(dbmsInfo, database.getStoreId()), log, stringJoiner::add);
DiagnosticsManager.dump(new StoreFilesDiagnostics(storageEngineFactory, fs, database.getDatabaseLayout()), log, stringJoiner::add);
DiagnosticsManager.dump(new TransactionRangeDiagnostics(database), log, stringJoiner::add);
storageEngine.dumpDiagnostics(log, stringJoiner::add);
}, database.getNamedDatabaseId());
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class IndexingServiceTest method buildIndexDependencies.
private static DependencyResolver buildIndexDependencies(IndexProvider... providers) {
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependencies((Object[]) providers);
dependencies.satisfyDependency(tokenProvider());
return dependencies;
}
use of org.neo4j.collection.Dependencies in project neo4j by neo4j.
the class KernelTransactionsTest method createDependencies.
private static Dependencies createDependencies() {
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependency(mock(GraphDatabaseFacade.class));
dependencies.satisfyDependency(CommunitySecurityLog.NULL_LOG);
return dependencies;
}
Aggregations