use of com.tinkerpop.blueprints.impls.orient.OGraphRepair in project orientdb by orientechnologies.
the class TestGraphRecovering method testRecoverPerfectGraphLW.
@Test
public void testRecoverPerfectGraphLW() {
final OrientBaseGraph g = new OrientGraphNoTx("memory:testRecoverPerfectGraphLW");
try {
init(g, true);
final TestListener eventListener = new TestListener();
new OGraphRepair().setEventListener(eventListener).repair(g, null, null);
Assert.assertEquals(eventListener.scannedEdges, 0);
Assert.assertEquals(eventListener.removedEdges, 0);
Assert.assertEquals(eventListener.scannedVertices, 3);
Assert.assertEquals(eventListener.scannedLinks, 6);
Assert.assertEquals(eventListener.removedLinks, 0);
Assert.assertEquals(eventListener.repairedVertices, 0);
} finally {
g.shutdown();
}
}
use of com.tinkerpop.blueprints.impls.orient.OGraphRepair in project orientdb by orientechnologies.
the class OGremlinConsole method repairDatabase.
@Override
@ConsoleCommand(description = "Repair database structure", splitInWords = false)
public void repairDatabase(@ConsoleParameter(name = "options", description = "Options: [--fix-graph] [--fix-links] [-v]] [--fix-ridbags] [--fix-bonsai]", optional = true) String iOptions) throws IOException {
checkForDatabase();
final boolean fix_graph = iOptions == null || iOptions.contains("--fix-graph");
if (fix_graph) {
// REPAIR GRAPH
final Map<String, List<String>> options = parseOptions(iOptions);
new OGraphRepair().repair(OrientGraphFactory.getNoTxGraphImplFactory().getGraph(currentDatabase), this, options);
}
final boolean fix_links = iOptions == null || iOptions.contains("--fix-links");
if (fix_links) {
// REPAIR DATABASE AT LOW LEVEL
super.repairDatabase(iOptions);
}
if (!currentDatabase.getURL().startsWith("plocal")) {
message("\n fix-bonsai can be run only on plocal connection \n");
return;
}
final boolean fix_ridbags = iOptions == null || iOptions.contains("--fix-ridbags");
if (fix_ridbags) {
OBonsaiTreeRepair repairer = new OBonsaiTreeRepair();
repairer.repairDatabaseRidbags(currentDatabase, this);
}
final boolean fix_bonsai = iOptions == null || iOptions.contains("--fix-bonsai");
if (fix_bonsai) {
OBonsaiTreeRepair repairer = new OBonsaiTreeRepair();
repairer.repairDatabaseRidbags(currentDatabase, this);
}
}
use of com.tinkerpop.blueprints.impls.orient.OGraphRepair in project orientdb by orientechnologies.
the class TestGraphRecovering method testRecoverPerfectGraphNonLW.
@Test
public void testRecoverPerfectGraphNonLW() {
final OrientBaseGraph g = new OrientGraphNoTx("memory:testRecoverPerfectGraphNonLW");
try {
init(g, false);
final TestListener eventListener = new TestListener();
new OGraphRepair().setEventListener(eventListener).repair(g, null, null);
Assert.assertEquals(eventListener.scannedEdges, 3);
Assert.assertEquals(eventListener.removedEdges, 0);
Assert.assertEquals(eventListener.scannedVertices, 3);
Assert.assertEquals(eventListener.scannedLinks, 6);
Assert.assertEquals(eventListener.removedLinks, 0);
Assert.assertEquals(eventListener.repairedVertices, 0);
} finally {
g.shutdown();
}
}
use of com.tinkerpop.blueprints.impls.orient.OGraphRepair in project orientdb by orientechnologies.
the class TestGraphRecovering method testRecoverBrokenGraphAllEdges.
@Test
public void testRecoverBrokenGraphAllEdges() {
final OrientBaseGraph g = new OrientGraphNoTx("memory:testRecoverBrokenGraphAllEdges");
try {
init(g, false);
for (Edge e : g.getEdges()) {
((OrientEdge) e).getRecord().removeField("out");
((OrientEdge) e).getRecord().save();
}
final TestListener eventListener = new TestListener();
new OGraphRepair().setEventListener(eventListener).repair(g, null, null);
Assert.assertEquals(eventListener.scannedEdges, 3);
Assert.assertEquals(eventListener.removedEdges, 3);
Assert.assertEquals(eventListener.scannedVertices, 3);
Assert.assertEquals(eventListener.scannedLinks, 6);
Assert.assertEquals(eventListener.removedLinks, 6);
Assert.assertEquals(eventListener.repairedVertices, 3);
} finally {
g.shutdown();
}
}
use of com.tinkerpop.blueprints.impls.orient.OGraphRepair in project orientdb by orientechnologies.
the class TestGraphRecovering method testRecoverBrokenGraphLinksInVerticesNonLW.
@Test
public void testRecoverBrokenGraphLinksInVerticesNonLW() {
final OrientBaseGraph g = new OrientGraphNoTx("memory:testRecoverBrokenGraphLinksInVerticesNonLW");
try {
init(g, false);
for (Vertex v : g.getVertices()) {
for (String f : ((OrientVertex) v).getRecord().fieldNames()) {
if (f.startsWith("out_"))
((OrientVertex) v).getRecord().removeField(f);
}
}
final TestListener eventListener = new TestListener();
new OGraphRepair().setEventListener(eventListener).repair(g, null, null);
Assert.assertEquals(eventListener.scannedEdges, 3);
Assert.assertEquals(eventListener.removedEdges, 3);
Assert.assertEquals(eventListener.scannedVertices, 3);
Assert.assertEquals(eventListener.scannedLinks, 3);
Assert.assertEquals(eventListener.removedLinks, 3);
Assert.assertEquals(eventListener.repairedVertices, 3);
} finally {
g.shutdown();
}
}
Aggregations