add extra logging for orphaned connection repair

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

Branch: refs/heads/asf-site
Commit: a769f304aaef3356334e85e2d8e1b8ca1d5afc91
Parents: b93f8d4
Author: Mike Dunker <[email protected]>
Authored: Mon Oct 16 17:04:58 2017 -0700
Committer: Mike Dunker <[email protected]>
Committed: Mon Oct 16 17:04:58 2017 -0700

----------------------------------------------------------------------
 .../pipeline/read/traverse/EntityLoadVerifyFilter.java    | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/a769f304/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/traverse/EntityLoadVerifyFilter.java
----------------------------------------------------------------------
diff --git 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/traverse/EntityLoadVerifyFilter.java
 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/traverse/EntityLoadVerifyFilter.java
index cc82bd8..c6a3462 100644
--- 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/traverse/EntityLoadVerifyFilter.java
+++ 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/traverse/EntityLoadVerifyFilter.java
@@ -167,6 +167,7 @@ public class EntityLoadVerifyFilter extends 
AbstractFilter<FilterResult<Id>, Fil
 
                 int edgesDeleted = 0;
                 List<MarkedEdge> edgeList = 
graphManager.loadEdgeVersions(searchByEdge).toList().toBlocking().last();
+                boolean timestampAllowsDelete = false;
                 if (edgeList.size() > 0) {
                     MarkedEdge firstEdge = edgeList.get(0);
                     long currentTimestamp = 
CpNamingUtils.createGraphOperationTimestamp();
@@ -176,6 +177,7 @@ public class EntityLoadVerifyFilter extends 
AbstractFilter<FilterResult<Id>, Fil
                     // timestamps are in 100 nanoseconds, convert from seconds
                     long allowedDiff = orphanDelaySecs * 1000L * 1000L * 10L;
                     if (timestampDiff > allowedDiff) {
+                        timestampAllowsDelete = true;
                         // edges must be orphans, delete edges
                         for (MarkedEdge edge: edgeList) {
                             
graphManager.markEdge(edge).toBlocking().lastOrDefault(null);
@@ -188,6 +190,14 @@ public class EntityLoadVerifyFilter extends 
AbstractFilter<FilterResult<Id>, Fil
                 if (edgesDeleted > 0) {
                     logger.warn("Read graph edge and received candidate with 
entityId {} (application {}), yet was not found in cassandra."
                         + "  Deleted at least {} edges.", candidateId, 
applicationScope.getApplication().getUuid().toString(), edgesDeleted);
+                } else if (edgeList.size() == 0) {
+                    logger.warn("Read graph edge and received candidate with 
entityId {} (application {}), yet was not found in cassandra."
+                            + "  No edges were deleted (loadEdgeVersions 
returned 0 edges)",
+                        candidateId, 
applicationScope.getApplication().getUuid().toString());
+                } else if (timestampAllowsDelete) {
+                    logger.warn("Read graph edge and received candidate with 
entityId {} (application {}), yet was not found in cassandra."
+                        + "  Timestamp is old enough to delete, but no edges 
were deleted (loadEdgeVersions returned {} edges)",
+                        candidateId, 
applicationScope.getApplication().getUuid().toString(), edgeList.size());
                 } else {
                     logger.warn("Read graph edge and received candidate with 
entityId {} (application {}), yet was not found in cassandra."
                         + "  Ignoring since this could be a region sync 
issue", candidateId, applicationScope.getApplication().getUuid().toString());

Reply via email to