You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/11/07 00:03:22 UTC
[09/16] usergrid git commit: Shorts circuit delete until further
testing
Shorts circuit delete until further testing
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/3f4d33ae
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/3f4d33ae
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/3f4d33ae
Branch: refs/heads/jackson-exclusion
Commit: 3f4d33aeed7a68778a5d64af8b875711a13b45b8
Parents: 6dfa2e2
Author: Todd Nine <tn...@apigee.com>
Authored: Fri Nov 6 10:40:18 2015 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Fri Nov 6 10:40:18 2015 -0700
----------------------------------------------------------------------
.../impl/shard/impl/ShardGroupDeletionImpl.java | 165 ++++++++++---------
.../shard/impl/ShardGroupDeletionImplTest.java | 2 +
2 files changed, 86 insertions(+), 81 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/3f4d33ae/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImpl.java
index ea10ed5..4d6be1b 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImpl.java
@@ -125,87 +125,90 @@ public class ShardGroupDeletionImpl implements ShardGroupDeletion {
final ShardEntryGroup shardEntryGroup,
final Iterator<MarkedEdge> edgeIterator ) {
- logger.trace( "Beginning audit of shard group {}", shardEntryGroup );
-
- /**
- * Compaction is pending, we cannot check it
- */
- if ( shardEntryGroup.isCompactionPending() ) {
- logger.trace( "Shard group {} is compacting, not auditing group", shardEntryGroup );
- return DeleteResult.COMPACTION_PENDING;
- }
-
-
- final long currentTime = timeService.getCurrentTime();
-
- if ( shardEntryGroup.isNew( currentTime ) ) {
- logger.trace( "Shard group {} contains a shard that is is too new, not auditing group", shardEntryGroup );
- return DeleteResult.TOO_NEW;
- }
-
- /**
- * We have edges, and therefore cannot delete them
- */
- if ( edgeIterator.hasNext() ) {
- logger.trace( "Shard group {} has edges, not deleting", shardEntryGroup );
-
- return DeleteResult.CONTAINS_EDGES;
- }
-
-
- //now we can proceed based on the shard meta state and we don't have any edge
-
- DeleteResult result = DeleteResult.NO_OP;
-
- MutationBatch rollup = null;
-
- for ( final Shard shard : shardEntryGroup.getReadShards() ) {
-
- //skip the min shard
- if(shard.isMinShard()){
- logger.trace( "Shard {} in group {} is the minimum, not deleting", shard, shardEntryGroup );
- continue;
- }
-
- //The shard is not compacted, we cannot remove it. This should never happen, a bit of an "oh shit" scenario.
- //the isCompactionPending should return false in this case
- if(!shard.isCompacted()){
- logger.warn( "Shard {} in group {} is not compacted yet was checked. Short circuiting", shard, shardEntryGroup );
- return DeleteResult.NO_OP;
- }
-
-
- final MutationBatch shardRemovalMutation =
- edgeShardSerialization.removeShardMeta( applicationScope, shard, directedEdgeMeta );
-
- if ( rollup == null ) {
- rollup = shardRemovalMutation;
- }
-
- else {
- rollup.mergeShallow( shardRemovalMutation );
- }
-
- result = DeleteResult.DELETED;
-
- logger.trace( "Removing shard {} in group {}", shard, shardEntryGroup );
- }
-
-
- if( rollup != null) {
-
- try {
- rollup.execute();
- }
- catch ( ConnectionException e ) {
- logger.error( "Unable to execute shard deletion", e );
- throw new RuntimeException( "Unable to execute shard deletion", e );
- }
- }
-
- logger.trace( "Completed auditing shard group {}", shardEntryGroup );
-
- return result;
+ //TEMPORARILY Removed until further testing
+ return DeleteResult.NO_OP;
+
+// logger.trace( "Beginning audit of shard group {}", shardEntryGroup );
+//
+// /**
+// * Compaction is pending, we cannot check it
+// */
+// if ( shardEntryGroup.isCompactionPending() ) {
+// logger.trace( "Shard group {} is compacting, not auditing group", shardEntryGroup );
+// return DeleteResult.COMPACTION_PENDING;
+// }
+//
+//
+// final long currentTime = timeService.getCurrentTime();
+//
+// if ( shardEntryGroup.isNew( currentTime ) ) {
+// logger.trace( "Shard group {} contains a shard that is is too new, not auditing group", shardEntryGroup );
+// return DeleteResult.TOO_NEW;
+// }
+//
+// /**
+// * We have edges, and therefore cannot delete them
+// */
+// if ( edgeIterator.hasNext() ) {
+// logger.trace( "Shard group {} has edges, not deleting", shardEntryGroup );
+//
+// return DeleteResult.CONTAINS_EDGES;
+// }
+//
+//
+// //now we can proceed based on the shard meta state and we don't have any edge
+//
+// DeleteResult result = DeleteResult.NO_OP;
+//
+// MutationBatch rollup = null;
+//
+// for ( final Shard shard : shardEntryGroup.getReadShards() ) {
+//
+// //skip the min shard
+// if(shard.isMinShard()){
+// logger.trace( "Shard {} in group {} is the minimum, not deleting", shard, shardEntryGroup );
+// continue;
+// }
+//
+// //The shard is not compacted, we cannot remove it. This should never happen, a bit of an "oh shit" scenario.
+// //the isCompactionPending should return false in this case
+// if(!shard.isCompacted()){
+// logger.warn( "Shard {} in group {} is not compacted yet was checked. Short circuiting", shard, shardEntryGroup );
+// return DeleteResult.NO_OP;
+// }
+//
+//
+// final MutationBatch shardRemovalMutation =
+// edgeShardSerialization.removeShardMeta( applicationScope, shard, directedEdgeMeta );
+//
+// if ( rollup == null ) {
+// rollup = shardRemovalMutation;
+// }
+//
+// else {
+// rollup.mergeShallow( shardRemovalMutation );
+// }
+//
+// result = DeleteResult.DELETED;
+//
+// logger.trace( "Removing shard {} in group {}", shard, shardEntryGroup );
+// }
+//
+//
+// if( rollup != null) {
+//
+// try {
+// rollup.execute();
+// }
+// catch ( ConnectionException e ) {
+// logger.error( "Unable to execute shard deletion", e );
+// throw new RuntimeException( "Unable to execute shard deletion", e );
+// }
+// }
+//
+// logger.trace( "Completed auditing shard group {}", shardEntryGroup );
+//
+// return result;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/3f4d33ae/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImplTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImplTest.java
index 9db997d..1cf6d54 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImplTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImplTest.java
@@ -24,6 +24,7 @@ import java.util.concurrent.ExecutionException;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.apache.usergrid.persistence.core.consistency.TimeService;
@@ -55,6 +56,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+@Ignore("Temporarily removing until delete is re-enabled")
public class ShardGroupDeletionImplTest {