use of org.neo4j.graphdb.GraphDatabaseService in project neo4j by neo4j.
the class CopiedStoreRecovery method recoverCopiedStore.
public synchronized void recoverCopiedStore(File tempStore) throws StoreCopyFailedException {
if (shutdown) {
throw new StoreCopyFailedException("Abort store-copied store recovery due to database shutdown");
}
try {
GraphDatabaseService graphDatabaseService = newTempDatabase(tempStore);
graphDatabaseService.shutdown();
} catch (Exception e) {
Throwable peeled = Exceptions.peel(e, (t) -> !(t instanceof UpgradeNotAllowedByConfigurationException));
if (peeled != null) {
throw new RuntimeException(failedToStartMessage(), e);
} else {
throw e;
}
}
}
use of org.neo4j.graphdb.GraphDatabaseService in project neo4j by neo4j.
the class TestConfiguration method testEnableDefaultsInConfig.
@Test
public void testEnableDefaultsInConfig() throws Exception {
GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder(SOURCE_DIR).setConfig(OnlineBackupSettings.online_backup_enabled, Settings.TRUE).newGraphDatabase();
OnlineBackup.from(HOST_ADDRESS).full(BACKUP_DIR);
db.shutdown();
}
use of org.neo4j.graphdb.GraphDatabaseService in project neo4j by neo4j.
the class RestoreDatabaseCommandTest method shouldAllowForcedCopyOverAnExistingDatabase.
@Test
public void shouldAllowForcedCopyOverAnExistingDatabase() throws Exception {
// given
String databaseName = "to";
Config config = configWith(Config.empty(), databaseName, directory.absolutePath().getAbsolutePath());
File fromPath = new File(directory.absolutePath(), "from");
File toPath = config.get(DatabaseManagementSystemSettings.database_path);
int fromNodeCount = 10;
int toNodeCount = 20;
createDbAt(fromPath, fromNodeCount);
createDbAt(toPath, toNodeCount);
// when
new RestoreDatabaseCommand(fileSystemRule.get(), fromPath, config, databaseName, true).execute();
// then
GraphDatabaseService copiedDb = new GraphDatabaseFactory().newEmbeddedDatabase(toPath);
try (Transaction ignored = copiedDb.beginTx()) {
assertEquals(fromNodeCount, Iterables.count(copiedDb.getAllNodes()));
}
copiedDb.shutdown();
}
use of org.neo4j.graphdb.GraphDatabaseService in project neo4j by neo4j.
the class BiggerThanLogTxIT method assertAllMembersHasNodeCount.
private void assertAllMembersHasNodeCount(long expectedNodeCount) {
for (GraphDatabaseService db : cluster.getAllMembers()) {
// Try again with sync, it will clear up...
if (expectedNodeCount != nodeCount(db)) {
for (int i = 0; i < 100; i++) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
long count = nodeCount(db);
if (expectedNodeCount == count) {
break;
}
cluster.sync();
}
}
assertEquals(expectedNodeCount, nodeCount(db));
}
}
use of org.neo4j.graphdb.GraphDatabaseService in project neo4j by neo4j.
the class MeasureUpdatePullingRecordAndIndexGap method awaitIndexes.
private void awaitIndexes(ManagedCluster cluster) {
for (GraphDatabaseService db : cluster.getAllMembers()) {
try (Transaction tx = db.beginTx()) {
db.schema().awaitIndexesOnline(1, MINUTES);
tx.success();
}
}
}
Aggregations