Github user tnine commented on a diff in the pull request:
https://github.com/apache/usergrid/pull/388#discussion_r40232841
--- Diff:
stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
---
@@ -697,25 +695,35 @@ public ConnectionRef createConnection( String
connectionType, EntityRef connecte
final GraphManager gm = managerCache.getGraphManager(
applicationScope );
- //check if the edge exists
+ //write new edge
+ gm.writeEdge( edge ).subscribe();
- final SearchByEdge searchByEdge = new
SimpleSearchByEdge(edge.getSourceNode(), edge.getType(), edge.getTargetNode(),
Long.MAX_VALUE, SearchByEdgeType.Order.DESCENDING, Optional.absent() );
+ indexService.queueNewEdge( applicationScope, targetEntity, edge );
- //only take 1 and count it. If we don't have anything, create the
edge
- final int count = gm.loadEdgeVersions( searchByEdge ).take( 1
).count().toBlocking().last();
+ //now read all older versions of an edge, and remove them.
Finally calling delete
+ final SearchByEdge searchByEdge =
--- End diff --
I think we'll be ok. I agree, this may not be ideal from a performance
issue. However, I think (practically) at runtime, the most we'll be removing
is 1 edge since we'll always be removing the old one after write.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---