Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
add extra logging for orphaned connection repair
Browse files Browse the repository at this point in the history
  • Loading branch information
mdunker committed Oct 17, 2017
1 parent b93f8d4 commit a769f30
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ private void validate( final FilterResult<Id> filterResult ) {

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();
Expand All @@ -176,6 +177,7 @@ private void validate( final FilterResult<Id> filterResult ) {
// 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);
Expand All @@ -188,6 +190,14 @@ private void validate( final FilterResult<Id> filterResult ) {
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());
Expand Down

0 comments on commit a769f30

Please sign in to comment.