Repository: usergrid Updated Branches: refs/heads/hotfix-20160819 1e925c023 -> 23cfde0bc
Add additional logging if an edge is being written past the shard end timestamp. Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/23cfde0b Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/23cfde0b Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/23cfde0b Branch: refs/heads/hotfix-20160819 Commit: 23cfde0bc36ab5d6af53d6c7beb1ddc4c08877d0 Parents: 1e925c0 Author: Michael Russo <[email protected]> Authored: Wed Aug 31 10:27:25 2016 -0700 Committer: Michael Russo <[email protected]> Committed: Wed Aug 31 10:27:25 2016 -0700 ---------------------------------------------------------------------- .../graph/serialization/impl/shard/DirectedEdge.java | 7 +++++++ .../impl/shard/impl/NodeShardAllocationImpl.java | 4 ++-- .../impl/shard/impl/ShardedEdgeSerializationImpl.java | 10 ++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/23cfde0b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/DirectedEdge.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/DirectedEdge.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/DirectedEdge.java index 720c948..b8587a8 100644 --- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/DirectedEdge.java +++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/DirectedEdge.java @@ -38,4 +38,11 @@ public class DirectedEdge { this.timestamp = timestamp; this.id = id; } + + @Override + public String toString(){ + + return "DirectedEdge{ uuid="+id.getUuid()+", type="+id.getType()+", timestamp="+timestamp+" }"; + + } } http://git-wip-us.apache.org/repos/asf/usergrid/blob/23cfde0b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java index cf9a51c..876cd2c 100644 --- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java +++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java @@ -296,8 +296,8 @@ public class NodeShardAllocationImpl implements NodeShardAllocation { for ( DirectedEdgeMeta.NodeMeta node : directedEdgeMeta.getNodes() ) { - //short circuit - if ( !isNew || node.getId().getUuid().version() > 2 ) { + //short circuit if not a type 1 time UUID + if ( !isNew || node.getId().getUuid().version() != 1 ) { return false; } http://git-wip-us.apache.org/repos/asf/usergrid/blob/23cfde0b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardedEdgeSerializationImpl.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardedEdgeSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardedEdgeSerializationImpl.java index 55eb172..822f238 100644 --- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardedEdgeSerializationImpl.java +++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardedEdgeSerializationImpl.java @@ -729,6 +729,16 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization { final R rowKey = getRowKey( shard ); writeEdge( batch, columnFamily, scope, rowKey, column, shard, isDeleted ); + if(getDirectedEdge() instanceof DirectedEdge){ + DirectedEdge directedEdge = (DirectedEdge) getDirectedEdge(); + if( shard != null && shard.getShardEnd().isPresent() + && directedEdge.timestamp > shard.getShardEnd().get().timestamp){ + + logger.warn("Writing edge past shard end for edge: {}, shard: {}", directedEdge, shard ); + + } + } + // if an edge is being written to this shard, un-delete it in case it was previously marked // don't un-delete if the edge write is to actually remove an edge // Usergrid allows entities to be written with a UUID generated from the past (time)
