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 2018/10/23 03:17:40 UTC

[02/16] usergrid git commit: check for deleted entity candidates before checking for stale candidates

check for deleted entity candidates before checking for stale candidates


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

Branch: refs/heads/master
Commit: a4f32fab8b8b044d4a0d3f9436225a147d9ab6f8
Parents: ec7c6b4
Author: Mike Dunker <md...@google.com>
Authored: Tue Mar 6 10:50:43 2018 -0800
Committer: Keyur Karnik <ke...@gmail.com>
Committed: Tue Aug 28 16:41:43 2018 -0700

----------------------------------------------------------------------
 .../read/search/CandidateEntityFilter.java      | 29 ++++++++++----------
 1 file changed, 14 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/a4f32fab/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/CandidateEntityFilter.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/CandidateEntityFilter.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/CandidateEntityFilter.java
index 20bcfe9..5dcbd27 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/CandidateEntityFilter.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/CandidateEntityFilter.java
@@ -317,7 +317,20 @@ public class CandidateEntityFilter extends AbstractFilter<FilterResult<Candidate
             final UUID entityVersion = entity.getVersion();
             final Id entityId = entity.getId();
 
-            //entity is newer than ES version, could be a missed or slow index event
+            // The entity is marked as deleted
+            if (!entity.getEntity().isPresent() || entity.getStatus() == MvccEntity.Status.DELETED ) {
+
+                // when updating entities, we don't delete all previous versions from ES so this action is expected
+                if(logger.isDebugEnabled()){
+                    logger.debug( "Deindexing deleted entity on edge {} for entityId {} and version {}",
+                        searchEdge, entityId, entityVersion);
+                }
+
+                batch.deindex( searchEdge, entityId, candidateVersion );
+                return;
+            }
+
+            // entity exists and is newer than ES version, could be a missed or slow index event
             if ( UUIDComparator.staticCompare(entityVersion, candidateVersion) > 0 ) {
 
                Date candidateTimeStamp = UUIDTimeStampToDate(candidateVersion);
@@ -344,20 +357,6 @@ public class CandidateEntityFilter extends AbstractFilter<FilterResult<Candidate
                 }
             }
 
-
-            // The entity is marked as deleted
-            if (!entity.getEntity().isPresent() || entity.getStatus() == MvccEntity.Status.DELETED ) {
-
-                // when updating entities, we don't delete previous versions from ES so this action is expected
-                if(logger.isDebugEnabled()){
-                    logger.debug( "Deindexing deleted entity on edge {} for entityId {} and version {}",
-                        searchEdge, entityId, entityVersion);
-                }
-
-                batch.deindex( searchEdge, entityId, candidateVersion );
-                return;
-            }
-
             //ES is newer than cass, it means we haven't repaired the record in Cass, we don't want to
             //remove the ES record, since the read in cass should cause a read repair, just ignore
             if ( UUIDComparator.staticCompare( candidateVersion, entityVersion ) > 0 ) {