LOG.debug("v0: " + v0 + "\n");
for (int ctr1 = ctr0 + 1; ctr1 < cnt; ctr1++) {
DesignerVertex v1 = ptree_vertices.get(ctr1);
LOG.debug(" |- v1: " + v1 + "\n");
DesignerEdge ag_edge = this.agraph.findEdge(v0, v1);
if (((v0.getCatalogItem().getName().equals("WAREHOUSE") && v1.getCatalogItem().getName().equals("STOCK")) || (v1.getCatalogItem().getName().equals("WAREHOUSE") && v0.getCatalogItem()
.getName().equals("STOCK")))
&& ag_edge == null) {
LOG.debug("???????????\n");
}
//
// If this other vertex is already replicated, then we don't
// care
//
if (this.ptree.isReplicated(v1))
continue;
//
// If there is an edge between these two vertices, then check
// whether
// there is a path from the "upper" vertex to the "lower" vertex
//
if (ag_edge != null && this.ptree.getPath(v0, v1).isEmpty() && this.ptree.getPath(v1, v0).isEmpty() && graph.getPath(v0, v1).isEmpty() && graph.getPath(v1, v0).isEmpty()) {
//
// There was no edge in the PartitionTree, so that means we
// want to add
// an edge in our replication tree. Note that although edges
// in the AccessGraph
// are undirected, we need to make sure that our edge goes
// in the right direction.
// Well, that's easy then there is a foreign key but what
// about when it's just
// some random join?
//
boolean found = false;
for (int ctr = 0; ctr < 2; ctr++) {
if (ctr == 1) {
DesignerVertex temp = v0;
v0 = v1;
v1 = temp;
}
// Edge dg_edge = this.info.dgraph.findEdge(v0, v1);
// Edge dg_edge = this.agraph.findEdge(v0, v1);
if (this.info.dependencies.getDescendants((Table) v0.getCatalogItem()).contains(v1.getCatalogItem())) {
LOG.debug("CREATED EDGE: " + v0 + " -> " + v1 + "\n");
DesignerEdge new_edge = new DesignerEdge(graph, ag_edge);
graph.addEdge(new_edge, v0, v1, EdgeType.DIRECTED);
this.conflict_edges.add(new_edge);
this.conflict_vertices.add(v1);
found = true;
modified.add(v0);