Fix false positives on CHECK DATABASE
@@ -283,6 +283,7 @@ public class OGraphRepair {
final OrientVertex v = graph.getVertex(vertex);
+ boolean vertexCorrupted = false;
for (String fieldName : vertex.fieldNames()) {
final OPair<Direction, String> connection = v.getConnection(Direction.BOTH, fieldName, null);
if (connection == null)
@@ -295,6 +296,7 @@ public class OGraphRepair {
if (isEdgeBroken(vertex, fieldName, connection.getKey(), (OIdentifiable) fieldValue, stats,
graph.settings.isUseVertexFieldsForEdgeLabels())) {
+ vertexCorrupted = true;
if (!checkOnly) {
vertex.field(fieldName, (Object) null);
} else
@@ -310,6 +312,7 @@ public class OGraphRepair {
if (isEdgeBroken(vertex, fieldName, connection.getKey(), (OIdentifiable) o, stats,
graph.settings.isUseVertexFieldsForEdgeLabels())) {
+ vertexCorrupted = true;
if (!checkOnly) {
it.remove();
} else
@@ -332,6 +335,7 @@ public class OGraphRepair {
final Object o = it.next();
if (isEdgeBroken(vertex, fieldName, connection.getKey(), (OIdentifiable) o, stats,
graph.settings.isUseVertexFieldsForEdgeLabels())) {
+ vertexCorrupted = true;
if (!checkOnly) {
it.remove();
} else
@@ -345,7 +349,7 @@ public class OGraphRepair {
}
}
- if (vertex.isDirty()) {
+ if (vertexCorrupted) {
stats.repairedVertices++;
if (eventListener != null)
eventListener.onRepairedVertex(vertex);
@@ -354,6 +358,9 @@ public class OGraphRepair {
if (!checkOnly) {
vertex.save();
}
+ } else if (vertex.isDirty() && !checkOnly) {
+ message(outputListener, "+ optimized vertex " + vertex + "\n");
+ vertex.save();
}
}
