You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2016/07/26 18:12:32 UTC

[05/50] [abbrv] usergrid git commit: Clean up em.removeFromCollection and fix UniqueValueScanner to just log duplicates if scanning all of unique values.

Clean up em.removeFromCollection and fix UniqueValueScanner to just log duplicates if scanning all of unique values.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/f4ae0cb8
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/f4ae0cb8
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/f4ae0cb8

Branch: refs/heads/datastax-cass-driver
Commit: f4ae0cb85b09547a2bb808a8a80fa8a36c485551
Parents: 426449e
Author: Michael Russo <mr...@apigee.com>
Authored: Wed Jun 29 10:55:14 2016 -0700
Committer: Michael Russo <mr...@apigee.com>
Committed: Wed Jun 29 10:55:14 2016 -0700

----------------------------------------------------------------------
 .../corepersistence/CpRelationManager.java      | 36 ++------------------
 .../mvcc/stage/write/WriteUniqueVerify.java     |  1 -
 2 files changed, 2 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/f4ae0cb8/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
index fbf0b14..d2ab702 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
@@ -525,41 +525,9 @@ public class CpRelationManager implements RelationManager {
 
         Id entityId = new SimpleId( itemRef.getUuid(), itemRef.getType() );
 
-        // remove edge from collection to item
-        GraphManager gm = managerCache.getGraphManager( applicationScope );
-
-
-
-        // mark the edge versions and take the first for later delete edge queue event ( load is descending )
-        final Edge markedSourceEdge = gm.loadEdgeVersions(
-            CpNamingUtils.createEdgeFromCollectionName( cpHeadEntity.getId(), collectionName, entityId ) )
-                .flatMap(edge -> gm.markEdge(edge)).toBlocking().firstOrDefault(null);
-
-
-        Edge markedReversedEdge = null;
-        CollectionInfo collection = getDefaultSchema().getCollection( headEntity.getType(), collectionName );
-        if (collection != null && collection.getLinkedCollection() != null) {
-            // delete reverse edges
-            final String pluralType = InflectionUtils.pluralize( cpHeadEntity.getId().getType() );
-            markedReversedEdge = gm.loadEdgeVersions(
-                    CpNamingUtils.createEdgeFromCollectionName( entityId, pluralType, cpHeadEntity.getId() ) )
-                    .flatMap(reverseEdge -> gm.markEdge(reverseEdge)).toBlocking().firstOrDefault(null);
-        }
-
-
-        /**
-         * Remove from the index.  This will call gm.deleteEdge which also deletes the reverse edge(s) and de-indexes
-         * older versions of the edge(s).
-         *
-         */
-        if( markedSourceEdge != null ) {
-            indexService.queueDeleteEdge(applicationScope, markedSourceEdge);
-        }
-        if( markedReversedEdge != null ){
-            indexService.queueDeleteEdge(applicationScope, markedReversedEdge);
-
-        }
 
+        // this will remove the edges from app->entity(collection)
+        removeItemFromCollection(collectionName, itemRef);
 
         // special handling for roles collection of a group
         if ( headEntity.getType().equals( Group.ENTITY_TYPE ) ) {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/f4ae0cb8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
index d7c8ecd..adbe03d 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
@@ -154,7 +154,6 @@ public class WriteUniqueVerify implements Action1<CollectionIoEvent<MvccEntity>>
             if(logger.isTraceEnabled()){
                 logger.trace("Pre-write unique violations found, raising exception before executing first write");
             }
-            logger.error("Pre-write unique violations found, raising exception before executing first write");
 
             throw new WriteUniqueVerifyException(mvccEntity, scope,
                 preWriteUniquenessViolations );