You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/08/24 23:46:02 UTC
[2/3] usergrid git commit: Updated tests and finished basic check +
allocate algorithm
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9f3bf2b3/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
deleted file mode 100644
index 13f7427..0000000
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardedEdgeSerializationImpl.java
+++ /dev/null
@@ -1,1006 +0,0 @@
-/*
- *
- * * Licensed to the Apache Software Foundation (ASF) under one
- * * or more contributor license agreements. See the NOTICE file
- * * distributed with this work for additional information
- * * regarding copyright ownership. The ASF licenses this file
- * * to you under the Apache License, Version 2.0 (the
- * * "License"); you may not use this file except in compliance
- * * with the License. You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing,
- * * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * * KIND, either express or implied. See the License for the
- * * specific language governing permissions and limitations
- * * under the License.
- *
- */
-package org.apache.usergrid.persistence.graph.serialization.impl.shard.impl;
-
-
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.UUID;
-
-import javax.annotation.Nullable;
-import javax.inject.Inject;
-
-import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
-import org.apache.usergrid.persistence.core.consistency.TimeService;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.core.util.ValidationUtils;
-import org.apache.usergrid.persistence.graph.Edge;
-import org.apache.usergrid.persistence.graph.GraphFig;
-import org.apache.usergrid.persistence.graph.MarkedEdge;
-import org.apache.usergrid.persistence.graph.SearchByEdge;
-import org.apache.usergrid.persistence.graph.SearchByEdgeType;
-import org.apache.usergrid.persistence.graph.SearchByIdType;
-import org.apache.usergrid.persistence.graph.impl.SimpleMarkedEdge;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.DirectedEdge;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.DirectedEdgeMeta;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeColumnFamilies;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeRowKey;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeShardStrategy;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.RowKey;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.RowKeyType;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.Shard;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.ShardedEdgeSerialization;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.comparators.DescendingTimestampComparator;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.comparators.OrderedComparator;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.comparators
- .SourceDirectedEdgeDescendingComparator;
-import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.comparators
- .TargetDirectedEdgeDescendingComparator;
-import org.apache.usergrid.persistence.graph.serialization.util.GraphValidation;
-import org.apache.usergrid.persistence.model.entity.Id;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.inject.Singleton;
-import com.netflix.astyanax.Keyspace;
-import com.netflix.astyanax.MutationBatch;
-import com.netflix.astyanax.Serializer;
-import com.netflix.astyanax.util.RangeBuilder;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-
-/**
- * TODO: Rafactor this to use shards only, no shard groups, just collections of shards. The parent caller can aggregate
- * the results of multiple groups together, this has an impedance mismatch in the API layer.
- */
-@Singleton
-public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
-
- protected final Keyspace keyspace;
- protected final CassandraConfig cassandraConfig;
- protected final GraphFig graphFig;
- protected final EdgeShardStrategy writeEdgeShardStrategy;
- protected final TimeService timeService;
-
-
- @Inject
- public ShardedEdgeSerializationImpl( final Keyspace keyspace, final CassandraConfig cassandraConfig,
- final GraphFig graphFig, final EdgeShardStrategy writeEdgeShardStrategy,
- final TimeService timeService ) {
-
-
- checkNotNull( "keyspace required", keyspace );
- checkNotNull( "cassandraConfig required", cassandraConfig );
- checkNotNull( "consistencyFig required", graphFig );
- checkNotNull( "writeEdgeShardStrategy required", writeEdgeShardStrategy );
- checkNotNull( "timeService required", timeService );
-
-
- this.keyspace = keyspace;
- this.cassandraConfig = cassandraConfig;
- this.graphFig = graphFig;
- this.writeEdgeShardStrategy = writeEdgeShardStrategy;
- this.timeService = timeService;
- }
-
-
- @Override
- public MutationBatch writeEdgeFromSource( final EdgeColumnFamilies columnFamilies, final ApplicationScope scope,
- final MarkedEdge markedEdge, final Collection<Shard> shards,
- final DirectedEdgeMeta directedEdgeMeta, final UUID timestamp ) {
- ValidationUtils.validateApplicationScope( scope );
- GraphValidation.validateEdge( markedEdge );
- ValidationUtils.verifyTimeUuid( timestamp, "timestamp" );
-
- return new SourceWriteOp( columnFamilies, markedEdge ) {
-
- @Override
- void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
- final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge,
- final Shard shard, final boolean isDeleted ) {
-
- batch.withRow( columnFamily, ScopedRowKey.fromKey( scope.getApplication(), rowKey ) ).putColumn( edge, isDeleted );
-
- if ( !isDeleted ) {
- writeEdgeShardStrategy.increment( scope, shard, 1, directedEdgeMeta );
- }
- }
- }.createBatch( scope, shards, timestamp );
- }
-
-
- @Override
- public MutationBatch writeEdgeFromSourceWithTargetType( final EdgeColumnFamilies columnFamilies,
- final ApplicationScope scope, final MarkedEdge markedEdge,
- final Collection<Shard> shards,
- final DirectedEdgeMeta directedEdgeMeta,
- final UUID timestamp ) {
- ValidationUtils.validateApplicationScope( scope );
- GraphValidation.validateEdge( markedEdge );
- ValidationUtils.verifyTimeUuid( timestamp, "timestamp" );
-
-
- return new SourceTargetTypeWriteOp( columnFamilies, markedEdge ) {
-
- @Override
- void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
- final ApplicationScope scope, final RowKeyType rowKey, final DirectedEdge edge,
- final Shard shard, final boolean isDeleted ) {
-
-
- batch.withRow( columnFamily, ScopedRowKey.fromKey( scope.getApplication(), rowKey ) ).putColumn( edge, isDeleted );
-
-
- if ( !isDeleted ) {
- writeEdgeShardStrategy.increment( scope, shard, 1, directedEdgeMeta );
- }
- }
- }.createBatch( scope, shards, timestamp );
- }
-
-
- @Override
- public MutationBatch writeEdgeToTarget( final EdgeColumnFamilies columnFamilies, final ApplicationScope scope,
- final MarkedEdge markedEdge, final Collection<Shard> shards,
- final DirectedEdgeMeta targetEdgeMeta, final UUID timestamp ) {
- ValidationUtils.validateApplicationScope( scope );
- GraphValidation.validateEdge( markedEdge );
- ValidationUtils.verifyTimeUuid( timestamp, "timestamp" );
-
-
- return new TargetWriteOp( columnFamilies, markedEdge ) {
-
- @Override
- void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
- final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge,
- final Shard shard, final boolean isDeleted ) {
-
- batch.withRow( columnFamily, ScopedRowKey.fromKey( scope.getApplication(), rowKey ) ).putColumn( edge, isDeleted );
-
-
- if ( !isDeleted ) {
- writeEdgeShardStrategy.increment( scope, shard, 1, targetEdgeMeta );
- }
- }
- }.createBatch( scope, shards, timestamp );
- }
-
-
- @Override
- public MutationBatch writeEdgeToTargetWithSourceType( final EdgeColumnFamilies columnFamilies,
- final ApplicationScope scope, final MarkedEdge markedEdge,
- final Collection<Shard> shards,
- final DirectedEdgeMeta directedEdgeMeta,
- final UUID timestamp ) {
- ValidationUtils.validateApplicationScope( scope );
- GraphValidation.validateEdge( markedEdge );
- ValidationUtils.verifyTimeUuid( timestamp, "timestamp" );
-
-
- return new TargetSourceTypeWriteOp( columnFamilies, markedEdge ) {
-
- @Override
- void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
- final ApplicationScope scope, final RowKeyType rowKey, final DirectedEdge edge,
- final Shard shard, final boolean isDeleted ) {
-
- batch.withRow( columnFamilies.getTargetNodeSourceTypeCfName(), ScopedRowKey.fromKey( scope.getApplication(), rowKey ) )
- .putColumn( edge, isDeleted );
-
-
- if ( !isDeleted ) {
- writeEdgeShardStrategy.increment( scope, shard, 1, directedEdgeMeta );
- }
- }
- }.createBatch( scope, shards, timestamp );
- }
-
-
- @Override
- public MutationBatch writeEdgeVersions( final EdgeColumnFamilies columnFamilies, final ApplicationScope scope,
- final MarkedEdge markedEdge, final Collection<Shard> shards,
- final DirectedEdgeMeta directedEdgeMeta, final UUID timestamp ) {
-
- ValidationUtils.validateApplicationScope( scope );
- GraphValidation.validateEdge( markedEdge );
- ValidationUtils.verifyTimeUuid( timestamp, "timestamp" );
-
-
- return new EdgeVersions( columnFamilies, markedEdge ) {
-
- @Override
- void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily,
- final ApplicationScope scope, final EdgeRowKey rowKey, final Long column, final Shard shard,
- final boolean isDeleted ) {
- batch.withRow( columnFamilies.getGraphEdgeVersions(), ScopedRowKey.fromKey( scope.getApplication(), rowKey ) )
- .putColumn( column, isDeleted );
-
-
- if ( !isDeleted ) {
- writeEdgeShardStrategy.increment( scope, shard, 1, directedEdgeMeta );
- }
- }
- }.createBatch( scope, shards, timestamp );
- }
-
-
- @Override
- public MutationBatch deleteEdgeFromSource( final EdgeColumnFamilies columnFamilies, final ApplicationScope scope,
- final MarkedEdge markedEdge, final Collection<Shard> shards,
- final DirectedEdgeMeta directedEdgeMeta, final UUID timestamp ) {
-
- return new SourceWriteOp( columnFamilies, markedEdge ) {
-
- @Override
- void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
- final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge,
- final Shard shard, final boolean isDeleted ) {
-
- batch.withRow( columnFamily, ScopedRowKey.fromKey( scope.getApplication(), rowKey ) ).deleteColumn( edge );
- writeEdgeShardStrategy.increment( scope, shard, -1, directedEdgeMeta );
- }
- }.createBatch( scope, shards, timestamp );
- }
-
-
- @Override
- public MutationBatch deleteEdgeFromSourceWithTargetType( final EdgeColumnFamilies columnFamilies,
- final ApplicationScope scope, final MarkedEdge markedEdge,
- final Collection<Shard> shards,
- final DirectedEdgeMeta directedEdgeMeta,
- final UUID timestamp ) {
- return new SourceTargetTypeWriteOp( columnFamilies, markedEdge ) {
-
- @Override
- void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
- final ApplicationScope scope, final RowKeyType rowKey, final DirectedEdge edge,
- final Shard shard, final boolean isDeleted ) {
-
-
- batch.withRow( columnFamilies.getSourceNodeTargetTypeCfName(), ScopedRowKey.fromKey( scope.getApplication(), rowKey ) )
- .deleteColumn( edge );
- writeEdgeShardStrategy.increment( scope, shard, -1, directedEdgeMeta );
- }
- }.createBatch( scope, shards, timestamp );
- }
-
-
- @Override
- public MutationBatch deleteEdgeToTarget( final EdgeColumnFamilies columnFamilies, final ApplicationScope scope,
- final MarkedEdge markedEdge, final Collection<Shard> shards,
- final DirectedEdgeMeta directedEdgeMeta, final UUID timestamp ) {
-
- return new TargetWriteOp( columnFamilies, markedEdge ) {
-
- @Override
- void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
- final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge,
- final Shard shard, final boolean isDeleted ) {
-
- batch.withRow( columnFamily, ScopedRowKey.fromKey( scope.getApplication(), rowKey ) ).deleteColumn( edge );
- writeEdgeShardStrategy.increment( scope, shard, -1, directedEdgeMeta );
- }
- }.createBatch( scope, shards, timestamp );
- }
-
-
- @Override
- public MutationBatch deleteEdgeToTargetWithSourceType( final EdgeColumnFamilies columnFamilies,
- final ApplicationScope scope, final MarkedEdge markedEdge,
- final Collection<Shard> shards,
- final DirectedEdgeMeta directedEdgeMeta,
- final UUID timestamp ) {
-
- return new TargetSourceTypeWriteOp( columnFamilies, markedEdge ) {
-
- @Override
- void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
- final ApplicationScope scope, final RowKeyType rowKey, final DirectedEdge edge,
- final Shard shard, final boolean isDeleted ) {
-
- batch.withRow( columnFamilies.getTargetNodeSourceTypeCfName(), ScopedRowKey.fromKey( scope.getApplication(), rowKey ) )
- .deleteColumn( edge );
- writeEdgeShardStrategy.increment( scope, shard, -1, directedEdgeMeta );
- }
- }.createBatch( scope, shards, timestamp );
- }
-
-
- @Override
- public MutationBatch deleteEdgeVersions( final EdgeColumnFamilies columnFamilies, final ApplicationScope scope,
- final MarkedEdge markedEdge, final Collection<Shard> shards,
- final DirectedEdgeMeta directedEdgeMeta, final UUID timestamp ) {
-
- return new EdgeVersions( columnFamilies, markedEdge ) {
-
- @Override
- void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily,
- final ApplicationScope scope, final EdgeRowKey rowKey, final Long column, final Shard shard,
- final boolean isDeleted ) {
- batch.withRow( columnFamilies.getGraphEdgeVersions(), ScopedRowKey.fromKey( scope.getApplication(), rowKey ) )
- .deleteColumn( column );
- writeEdgeShardStrategy.increment( scope, shard, -1, directedEdgeMeta );
- }
- }.createBatch( scope, shards, timestamp );
- }
-
-
- @Override
- public Iterator<MarkedEdge> getEdgeVersions( final EdgeColumnFamilies columnFamilies, final ApplicationScope scope,
- final SearchByEdge search, final Collection<Shard> shards ) {
- ValidationUtils.validateApplicationScope( scope );
- GraphValidation.validateSearchByEdge( search );
-
- final Id targetId = search.targetNode();
- final Id sourceId = search.sourceNode();
- final String type = search.getType();
- final long maxTimestamp = search.getMaxTimestamp();
- final MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily =
- columnFamilies.getGraphEdgeVersions();
- final Serializer<Long> serializer = columnFamily.getColumnSerializer();
-
-
- final OrderedComparator<MarkedEdge> comparator = new OrderedComparator<>( DescendingTimestampComparator.INSTANCE, search.getOrder());
-
-
-
-
- final EdgeSearcher<EdgeRowKey, Long, MarkedEdge> searcher =
- new EdgeSearcher<EdgeRowKey, Long, MarkedEdge>( scope, shards, search.getOrder(), comparator, maxTimestamp,
- search.last().transform( TRANSFORM ) ) {
-
-
- @Override
- protected Serializer<Long> getSerializer() {
- return serializer;
- }
-
-
- @Override
- public void buildRange( final RangeBuilder builder ) {
-
-
- if ( last.isPresent() ) {
- super.buildRange( builder );
- return;
- }
-
- //start seeking at a value < our max version
- builder.setStart( maxTimestamp );
- }
-
-
- @Override
- protected EdgeRowKey generateRowKey( long shard ) {
- return new EdgeRowKey( sourceId, type, targetId, shard );
- }
-
-
- @Override
- protected Long createColumn( final MarkedEdge last ) {
- return last.getTimestamp();
- }
-
-
- @Override
- protected MarkedEdge createEdge( final Long column, final boolean marked ) {
- return new SimpleMarkedEdge( sourceId, type, targetId, column.longValue(), marked );
- }
-
-
-
- };
-
- return new ShardsColumnIterator<>( searcher, columnFamily, keyspace, cassandraConfig.getReadCL(),
- graphFig.getScanPageSize() );
- }
-
-
- @Override
- public Iterator<MarkedEdge> getEdgesFromSource( final EdgeColumnFamilies columnFamilies,
- final ApplicationScope scope, final SearchByEdgeType search,
- final Collection<Shard> shards ) {
-
- ValidationUtils.validateApplicationScope( scope );
- GraphValidation.validateSearchByEdgeType( search );
-
- final Id sourceId = search.getNode();
- final String type = search.getType();
- final long maxTimestamp = search.getMaxTimestamp();
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily =
- columnFamilies.getSourceNodeCfName();
- final Serializer<DirectedEdge> serializer = columnFamily.getColumnSerializer();
-
-
- final OrderedComparator<MarkedEdge> comparator = new OrderedComparator<>( TargetDirectedEdgeDescendingComparator.INSTANCE, search.getOrder());
-
-
-
- final EdgeSearcher<RowKey, DirectedEdge, MarkedEdge> searcher =
- new EdgeSearcher<RowKey, DirectedEdge, MarkedEdge>( scope, shards, search.getOrder(), comparator, maxTimestamp,
- search.last().transform( TRANSFORM ) ) {
-
-
- @Override
- protected Serializer<DirectedEdge> getSerializer() {
- return serializer;
- }
-
-
- @Override
- protected RowKey generateRowKey( long shard ) {
- return new RowKey( sourceId, type, shard );
- }
-
-
- @Override
- protected DirectedEdge createColumn( final MarkedEdge last ) {
- return new DirectedEdge( last.getTargetNode(), last.getTimestamp() );
- }
-
-
- @Override
- protected MarkedEdge createEdge( final DirectedEdge edge, final boolean marked ) {
- return new SimpleMarkedEdge( sourceId, type, edge.id, edge.timestamp, marked );
- }
- };
-
-
- return new ShardsColumnIterator<>( searcher, columnFamily, keyspace, cassandraConfig.getReadCL(),
- graphFig.getScanPageSize() );
- }
-
-
- @Override
- public Iterator<MarkedEdge> getEdgesFromSourceByTargetType( final EdgeColumnFamilies columnFamilies,
- final ApplicationScope scope,
- final SearchByIdType search,
- final Collection<Shard> shards ) {
-
- ValidationUtils.validateApplicationScope( scope );
- GraphValidation.validateSearchByEdgeType( search );
-
- final Id targetId = search.getNode();
- final String type = search.getType();
- final String targetType = search.getIdType();
- final long maxTimestamp = search.getMaxTimestamp();
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily =
- columnFamilies.getSourceNodeTargetTypeCfName();
- final Serializer<DirectedEdge> serializer = columnFamily.getColumnSerializer();
-
- final OrderedComparator<MarkedEdge> comparator = new OrderedComparator<>( TargetDirectedEdgeDescendingComparator.INSTANCE, search.getOrder());
-
-
- final EdgeSearcher<RowKeyType, DirectedEdge, MarkedEdge> searcher =
- new EdgeSearcher<RowKeyType, DirectedEdge, MarkedEdge>( scope, shards, search.getOrder(), comparator, maxTimestamp,
- search.last().transform( TRANSFORM ) ) {
-
- @Override
- protected Serializer<DirectedEdge> getSerializer() {
- return serializer;
- }
-
-
- @Override
- protected RowKeyType generateRowKey( long shard ) {
- return new RowKeyType( targetId, type, targetType, shard );
- }
-
-
- @Override
- protected DirectedEdge createColumn( final MarkedEdge last ) {
- return new DirectedEdge( last.getTargetNode(), last.getTimestamp() );
- }
-
-
- @Override
- protected MarkedEdge createEdge( final DirectedEdge edge, final boolean marked ) {
- return new SimpleMarkedEdge( targetId, type, edge.id, edge.timestamp, marked );
- }
- };
-
- return new ShardsColumnIterator( searcher, columnFamily, keyspace, cassandraConfig.getReadCL(),
- graphFig.getScanPageSize() );
- }
-
-
- @Override
- public Iterator<MarkedEdge> getEdgesToTarget( final EdgeColumnFamilies columnFamilies, final ApplicationScope scope,
- final SearchByEdgeType search, final Collection<Shard> shards ) {
- ValidationUtils.validateApplicationScope( scope );
- GraphValidation.validateSearchByEdgeType( search );
-
- final Id targetId = search.getNode();
- final String type = search.getType();
- final long maxTimestamp = search.getMaxTimestamp();
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily =
- columnFamilies.getTargetNodeCfName();
- final Serializer<DirectedEdge> serializer = columnFamily.getColumnSerializer();
-
- final OrderedComparator<MarkedEdge> comparator = new OrderedComparator<>( SourceDirectedEdgeDescendingComparator.INSTANCE, search.getOrder());
-
- final EdgeSearcher<RowKey, DirectedEdge, MarkedEdge> searcher =
- new EdgeSearcher<RowKey, DirectedEdge, MarkedEdge>( scope, shards, search.getOrder(),comparator, maxTimestamp,
- search.last().transform( TRANSFORM ) ) {
-
- @Override
- protected Serializer<DirectedEdge> getSerializer() {
- return serializer;
- }
-
-
- @Override
- protected RowKey generateRowKey( long shard ) {
- return new RowKey( targetId, type, shard );
- }
-
-
- @Override
- protected DirectedEdge createColumn( final MarkedEdge last ) {
- return new DirectedEdge( last.getSourceNode(), last.getTimestamp() );
- }
-
-
- @Override
- protected MarkedEdge createEdge( final DirectedEdge edge, final boolean marked ) {
- return new SimpleMarkedEdge( edge.id, type, targetId, edge.timestamp, marked );
- }
- };
-
-
- return new ShardsColumnIterator<>( searcher, columnFamily, keyspace, cassandraConfig.getReadCL(),
- graphFig.getScanPageSize() );
- }
-
-
- @Override
- public Iterator<MarkedEdge> getEdgesToTargetBySourceType( final EdgeColumnFamilies columnFamilies,
- final ApplicationScope scope,
- final SearchByIdType search,
- final Collection<Shard> shards ) {
-
- ValidationUtils.validateApplicationScope( scope );
- GraphValidation.validateSearchByEdgeType( search );
-
- final Id targetId = search.getNode();
- final String sourceType = search.getIdType();
- final String type = search.getType();
- final long maxTimestamp = search.getMaxTimestamp();
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily =
- columnFamilies.getTargetNodeSourceTypeCfName();
- final Serializer<DirectedEdge> serializer = columnFamily.getColumnSerializer();
-
- final OrderedComparator<MarkedEdge> comparator = new OrderedComparator<>( SourceDirectedEdgeDescendingComparator.INSTANCE, search.getOrder());
-
-
- final EdgeSearcher<RowKeyType, DirectedEdge, MarkedEdge> searcher =
- new EdgeSearcher<RowKeyType, DirectedEdge, MarkedEdge>( scope, shards, search.getOrder(), comparator, maxTimestamp,
- search.last().transform( TRANSFORM ) ) {
- @Override
- protected Serializer<DirectedEdge> getSerializer() {
- return serializer;
- }
-
-
- @Override
- protected RowKeyType generateRowKey( final long shard ) {
- return new RowKeyType( targetId, type, sourceType, shard );
- }
-
-
- @Override
- protected DirectedEdge createColumn( final MarkedEdge last ) {
- return new DirectedEdge( last.getTargetNode(), last.getTimestamp() );
- }
-
-
- @Override
- protected MarkedEdge createEdge( final DirectedEdge edge, final boolean marked ) {
- return new SimpleMarkedEdge( edge.id, type, targetId, edge.timestamp, marked );
- }
- };
-
- return new ShardsColumnIterator<>( searcher, columnFamily, keyspace, cassandraConfig.getReadCL(),
- graphFig.getScanPageSize() );
- }
-
-
-
-
-
- /**
- * Simple callback to perform puts and deletes with a common row setup code
- *
- * @param <R> The row key type
- * @param <C> The column type
- */
- private abstract class RowOp<R, C> {
-
-
- /**
- * Return the column family used for the write
- */
- protected abstract MultiTennantColumnFamily<ScopedRowKey<R>, C> getColumnFamily();
-
- /**
- * Get the row key
- */
- public abstract R getRowKey( final Shard shard );
-
- /**
- * Get the column family value
- */
- protected abstract C getDirectedEdge();
-
- /**
- * Get the flag on if it's deleted
- */
- protected abstract boolean isDeleted();
-
-
- /**
- * Write the edge with the given data
- */
- abstract void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<R>, C> columnFamily,
- final ApplicationScope scope, final R rowKey, final C column, final Shard shard,
- final boolean isDeleted );
-
-
- /**
- * Create a mutation batch
- */
- public MutationBatch createBatch( final ApplicationScope scope, final Collection<Shard> shards,
- final UUID opTimestamp ) {
-
- final MutationBatch batch =
- keyspace.prepareMutationBatch().withConsistencyLevel( cassandraConfig.getWriteCL() )
- .withTimestamp( opTimestamp.timestamp() );
-
-
- final C column = getDirectedEdge();
- final MultiTennantColumnFamily<ScopedRowKey<R>, C> columnFamily = getColumnFamily();
- final boolean isDeleted = isDeleted();
-
-
- for ( Shard shard : shards ) {
- final R rowKey = getRowKey( shard );
- writeEdge( batch, columnFamily, scope, rowKey, column, shard, isDeleted );
- }
-
-
- return batch;
- }
- }
-
-
- /**
- * Perform a write of the source->target
- */
- private abstract class SourceWriteOp extends RowOp<RowKey, DirectedEdge> {
-
- private final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily;
- private final Id sourceNodeId;
-
-
- private final String type;
- private final boolean isDeleted;
- private final DirectedEdge directedEdge;
-
-
- /**
- * Write the source write operation
- */
- private SourceWriteOp( final EdgeColumnFamilies edgeColumnFamilies, final MarkedEdge markedEdge ) {
- this.columnFamily = edgeColumnFamilies.getSourceNodeCfName();
-
- this.sourceNodeId = markedEdge.getSourceNode();
-
- this.type = markedEdge.getType();
- this.isDeleted = markedEdge.isDeleted();
-
- this.directedEdge = new DirectedEdge( markedEdge.getTargetNode(), markedEdge.getTimestamp() );
- }
-
-
- @Override
- protected MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getColumnFamily() {
- return columnFamily;
- }
-
-
- @Override
- public RowKey getRowKey( final Shard shard ) {
- return new RowKey( sourceNodeId, type, shard.getShardIndex() );
- }
-
-
- @Override
- protected DirectedEdge getDirectedEdge() {
- return directedEdge;
- }
-
-
- @Override
- protected boolean isDeleted() {
- return isDeleted;
- }
- }
-
-
- /**
- * Perform a write of the source->target with target type
- */
- private abstract class SourceTargetTypeWriteOp extends RowOp<RowKeyType, DirectedEdge> {
-
- private final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily;
- private final Id sourceNodeId;
- private final String type;
- private Id targetId;
- private final boolean isDeleted;
- private final DirectedEdge directedEdge;
-
-
- /**
- * Write the source write operation
- */
- private SourceTargetTypeWriteOp( final EdgeColumnFamilies edgeColumnFamilies, final MarkedEdge markedEdge ) {
- this.columnFamily = edgeColumnFamilies.getSourceNodeTargetTypeCfName();
-
- this.sourceNodeId = markedEdge.getSourceNode();
-
- this.type = markedEdge.getType();
- this.targetId = markedEdge.getTargetNode();
- this.isDeleted = markedEdge.isDeleted();
-
- this.directedEdge = new DirectedEdge( targetId, markedEdge.getTimestamp() );
- }
-
-
- @Override
- protected MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getColumnFamily() {
- return columnFamily;
- }
-
-
- @Override
- public RowKeyType getRowKey( final Shard shard ) {
- return new RowKeyType( sourceNodeId, type, targetId, shard.getShardIndex() );
- }
-
-
- @Override
- protected DirectedEdge getDirectedEdge() {
- return directedEdge;
- }
-
-
- @Override
- protected boolean isDeleted() {
- return isDeleted;
- }
- }
-
-
- /**
- * Perform a write of the target <-- source
- */
- private abstract class TargetWriteOp extends RowOp<RowKey, DirectedEdge> {
-
- private final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily;
- private final Id targetNode;
-
-
- private final String type;
- private final boolean isDeleted;
- private final DirectedEdge directedEdge;
-
-
- /**
- * Write the source write operation
- */
- private TargetWriteOp( final EdgeColumnFamilies edgeColumnFamilies, final MarkedEdge markedEdge ) {
- this.columnFamily = edgeColumnFamilies.getTargetNodeCfName();
-
- this.targetNode = markedEdge.getTargetNode();
-
- this.type = markedEdge.getType();
- this.isDeleted = markedEdge.isDeleted();
-
- this.directedEdge = new DirectedEdge( markedEdge.getSourceNode(), markedEdge.getTimestamp() );
- }
-
-
- @Override
- protected MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getColumnFamily() {
- return columnFamily;
- }
-
-
- @Override
- public RowKey getRowKey( final Shard shard ) {
- return new RowKey( targetNode, type, shard.getShardIndex() );
- }
-
-
- @Override
- protected DirectedEdge getDirectedEdge() {
- return directedEdge;
- }
-
-
- @Override
- protected boolean isDeleted() {
- return isDeleted;
- }
- }
-
-
- /**
- * Perform a write of the target<--source with source type
- */
- private abstract class TargetSourceTypeWriteOp extends RowOp<RowKeyType, DirectedEdge> {
-
- private final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily;
- private final Id targetNode;
-
- private final Id sourceNode;
-
- final String type;
-
- final boolean isDeleted;
- final DirectedEdge directedEdge;
-
-
- /**
- * Write the source write operation
- */
- private TargetSourceTypeWriteOp( final EdgeColumnFamilies edgeColumnFamilies, final MarkedEdge markedEdge ) {
- this.columnFamily = edgeColumnFamilies.getSourceNodeTargetTypeCfName();
-
- this.targetNode = markedEdge.getTargetNode();
- this.sourceNode = markedEdge.getSourceNode();
-
- this.type = markedEdge.getType();
- this.isDeleted = markedEdge.isDeleted();
-
- this.directedEdge = new DirectedEdge( sourceNode, markedEdge.getTimestamp() );
- }
-
-
- @Override
- protected MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getColumnFamily() {
- return columnFamily;
- }
-
-
- @Override
- public RowKeyType getRowKey( final Shard shard ) {
- return new RowKeyType( targetNode, type, sourceNode, shard.getShardIndex() );
- }
-
-
- @Override
- protected DirectedEdge getDirectedEdge() {
- return directedEdge;
- }
-
-
- @Override
- protected boolean isDeleted() {
- return isDeleted;
- }
- }
-
-
- /**
- * Perform a write of the edge versions
- */
- private abstract class EdgeVersions extends RowOp<EdgeRowKey, Long> {
-
- private final MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily;
- private final Id targetNode;
-
- private final Id sourceNode;
-
- final String type;
-
- final boolean isDeleted;
- final Long edgeVersion;
-
-
- /**
- * Write the source write operation
- */
- private EdgeVersions( final EdgeColumnFamilies edgeColumnFamilies, final MarkedEdge markedEdge ) {
- this.columnFamily = edgeColumnFamilies.getGraphEdgeVersions();
-
- this.targetNode = markedEdge.getTargetNode();
- this.sourceNode = markedEdge.getSourceNode();
-
- this.type = markedEdge.getType();
- this.isDeleted = markedEdge.isDeleted();
-
- this.edgeVersion = markedEdge.getTimestamp();
- }
-
-
- @Override
- protected MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> getColumnFamily() {
- return columnFamily;
- }
-
-
- @Override
- public EdgeRowKey getRowKey( final Shard shard ) {
- return new EdgeRowKey( sourceNode, type, targetNode, shard.getShardIndex() );
- }
-
-
- @Override
- protected Long getDirectedEdge() {
- return edgeVersion;
- }
-
-
- @Override
- protected boolean isDeleted() {
- return isDeleted;
- }
- }
-
-
-
-
-
-
- private static final Function<Edge, MarkedEdge> TRANSFORM = new Function<Edge, MarkedEdge>() {
- @Nullable
- @Override
- public MarkedEdge apply( @Nullable final Edge input ) {
-
- if ( input == null ) {
- return null;
- }
-
- if ( input instanceof MarkedEdge ) {
- return ( MarkedEdge ) input;
- }
-
- return new SimpleMarkedEdge( input.getSourceNode(), input.getType(), input.getTargetNode(),
- input.getTimestamp(), false );
- }
- };
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9f3bf2b3/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
index 2fb08a4..fdb0952 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
@@ -109,24 +109,10 @@ public class GraphManagerShardConsistencyIT {
originalShardSize = ConfigurationManager.getConfigInstance().getProperty( GraphFig.SHARD_SIZE );
- originalShardTimeout = ConfigurationManager.getConfigInstance().getProperty( GraphFig.SHARD_CACHE_TIMEOUT );
-
- originalShardDelta = ConfigurationManager.getConfigInstance().getProperty( GraphFig.SHARD_MIN_DELTA );
-
ConfigurationManager.getConfigInstance().setProperty( GraphFig.SHARD_SIZE, 500 );
- final long cacheTimeout = 2000;
- //set our cache timeout to the above value
- ConfigurationManager.getConfigInstance().setProperty( GraphFig.SHARD_CACHE_TIMEOUT, cacheTimeout );
-
-
- final long minDelta = ( long ) ( cacheTimeout * 2.5 );
-
- ConfigurationManager.getConfigInstance().setProperty( GraphFig.SHARD_MIN_DELTA, minDelta );
-
-
//get the system property of the UUID to use. If one is not set, use the defualt
String uuidString = System.getProperty( "org.id", "80a42760-b699-11e3-a5e2-0800200c9a66" );
@@ -215,7 +201,7 @@ public class GraphManagerShardConsistencyIT {
//min stop time the min delta + 1 cache cycle timeout
- final long minExecutionTime = graphFig.getShardMinDelta() + graphFig.getShardCacheTimeout();
+ final long minExecutionTime = 10000;
log.info( "Writing {} edges per worker on {} workers in {} injectors", workerWriteLimit, numWorkersPerInjector,
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9f3bf2b3/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
index 2641ed7..22cc197 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
@@ -102,7 +102,7 @@ public class EdgeShardSerializationTest {
Iterator<Shard> results =
- edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
+ edgeShardSerialization.getShardMetaDataLocal( scope, Optional.<Shard>absent(), sourceEdgeMeta );
assertEquals( shard3, results.next() );
@@ -117,13 +117,13 @@ public class EdgeShardSerializationTest {
final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( now, "edgeType", "subType" );
//test we get nothing with the other node type
- results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), targetEdgeMeta );
+ results = edgeShardSerialization.getShardMetaDataLocal( scope, Optional.<Shard>absent(), targetEdgeMeta );
assertFalse( results.hasNext() );
//test paging and size
- results = edgeShardSerialization.getShardMetaData( scope, Optional.of( shard2 ), sourceEdgeMeta );
+ results = edgeShardSerialization.getShardMetaDataLocal( scope, Optional.of( shard2 ), sourceEdgeMeta );
assertEquals( shard2, results.next() );
@@ -163,7 +163,7 @@ public class EdgeShardSerializationTest {
Iterator<Shard> results =
- edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
+ edgeShardSerialization.getShardMetaDataLocal( scope, Optional.<Shard>absent(), sourceEdgeMeta );
assertEquals( shard3, results.next() );
@@ -177,7 +177,7 @@ public class EdgeShardSerializationTest {
final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( now, "edgeType", "subType" );
- results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), targetEdgeMeta );
+ results = edgeShardSerialization.getShardMetaDataLocal( scope, Optional.<Shard>absent(), targetEdgeMeta );
assertFalse( results.hasNext() );
@@ -185,7 +185,7 @@ public class EdgeShardSerializationTest {
//test paging and size
edgeShardSerialization.removeShardMeta( scope, shard1, sourceEdgeMeta ).execute();
- results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
+ results = edgeShardSerialization.getShardMetaDataLocal( scope, Optional.<Shard>absent(), sourceEdgeMeta );
assertEquals( shard3, results.next() );
@@ -198,7 +198,7 @@ public class EdgeShardSerializationTest {
edgeShardSerialization.removeShardMeta( scope, shard3, sourceEdgeMeta ).execute();
- results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
+ results = edgeShardSerialization.getShardMetaDataLocal( scope, Optional.<Shard>absent(), sourceEdgeMeta );
assertFalse( results.hasNext() );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9f3bf2b3/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
index ac965cd..265c997 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
@@ -79,45 +79,9 @@ public class NodeShardAllocationTest {
graphFig = mock( GraphFig.class );
- when( graphFig.getShardCacheSize() ).thenReturn( 10000l );
- when( graphFig.getShardSize() ).thenReturn( 20000l );
-
- final long timeout = 30000;
- when( graphFig.getShardCacheTimeout() ).thenReturn( timeout );
- when( graphFig.getShardMinDelta() ).thenReturn( timeout * 2 );
- }
-
-
- @Test
- public void minTime() {
- final ShardGroupCompaction shardGroupCompaction = mock( ShardGroupCompaction.class );
-
- final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
-
- final EdgeColumnFamilies edgeColumnFamilies = mock( EdgeColumnFamilies.class );
- final ShardedEdgeSerialization shardedEdgeSerialization = mock( ShardedEdgeSerialization.class );
-
- final NodeShardApproximation nodeShardCounterSerialization = mock( NodeShardApproximation.class );
-
-
- final TimeService timeService = mock( TimeService.class );
-
-
- NodeShardAllocation approximation =
- new NodeShardAllocationImpl( edgeShardSerialization, edgeColumnFamilies, shardedEdgeSerialization,
- nodeShardCounterSerialization, timeService, graphFig, shardGroupCompaction );
-
-
- final long timeservicetime = System.currentTimeMillis();
-
- when( timeService.getCurrentTime() ).thenReturn( timeservicetime );
-
- final long expected = timeservicetime - 2 * graphFig.getShardCacheTimeout();
-
- final long returned = approximation.getMinTime();
+ when( graphFig.getShardSize() ).thenReturn( 20000l );
- assertEquals( "Correct time was returned", expected, returned );
}
@@ -153,7 +117,7 @@ public class NodeShardAllocationTest {
final Shard firstShard = new Shard( 0l, 0l, true );
final Shard futureShard = new Shard( 10000l, timeservicetime, false );
- final ShardEntryGroup shardEntryGroup = new ShardEntryGroup( 1000l );
+ final ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
shardEntryGroup.addShard( futureShard );
shardEntryGroup.addShard( firstShard );
@@ -195,7 +159,7 @@ public class NodeShardAllocationTest {
final Shard futureShard = new Shard( 10000l, timeservicetime, true );
- final ShardEntryGroup shardEntryGroup = new ShardEntryGroup( 1000l );
+ final ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
shardEntryGroup.addShard( futureShard );
final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType( nodeId, type, subType );
@@ -243,7 +207,7 @@ public class NodeShardAllocationTest {
final Shard futureShard = new Shard( 0l, 0l, true );
- final ShardEntryGroup shardEntryGroup = new ShardEntryGroup( 1000l );
+ final ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
shardEntryGroup.addShard( futureShard );
final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType( nodeId, type, subType );
@@ -358,7 +322,7 @@ public class NodeShardAllocationTest {
final Shard futureShard = new Shard( 0l, 0l, true );
- final ShardEntryGroup shardEntryGroup = new ShardEntryGroup( 1000l );
+ final ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
shardEntryGroup.addShard( futureShard );
final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType( nodeId, type, subType );
@@ -449,7 +413,7 @@ public class NodeShardAllocationTest {
final Shard futureShard = new Shard( 0l, 0l, true );
- final ShardEntryGroup shardEntryGroup = new ShardEntryGroup( 1000l );
+ final ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
shardEntryGroup.addShard( futureShard );
final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType( nodeId, type, subType );
@@ -518,13 +482,6 @@ public class NodeShardAllocationTest {
when( timeService.getCurrentTime() ).thenReturn( timeservicetime );
- assertTrue( "Shard cache mocked", graphFig.getShardCacheTimeout() > 0 );
-
-
- /**
- * Simulates clock drift when 2 nodes create future shards near one another
- */
- final long minDelta = graphFig.getShardMinDelta();
final Shard minShard = new Shard( 0l, 0l, true );
@@ -541,13 +498,13 @@ public class NodeShardAllocationTest {
// should be removed
//this should get dropped, It's allocated after future shard2 even though the time is less
- final Shard futureShard1 = new Shard( 10000, minTime + minDelta, false );
+ final Shard futureShard1 = new Shard( 10000, minTime + 10000, false );
//should get kept.
final Shard futureShard2 = new Shard( 10005, minTime, false );
//should be removed
- final Shard futureShard3 = new Shard( 10010, minTime + minDelta / 2, false );
+ final Shard futureShard3 = new Shard( 10010, minTime + 1000, false );
final DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( nodeId, type, subType );
@@ -555,7 +512,7 @@ public class NodeShardAllocationTest {
* Mock up returning a min shard
*/
when( edgeShardSerialization
- .getShardMetaData( same( scope ), any( Optional.class ), same( directedEdgeMeta ) ) ).thenReturn(
+ .getShardMetaDataLocal( same( scope ), any( Optional.class ), same( directedEdgeMeta ) ) ).thenReturn(
Arrays.asList( futureShard3, futureShard2, futureShard1, compactedShard, minShard ).iterator() );
@@ -583,7 +540,7 @@ public class NodeShardAllocationTest {
//now verify all 4 are in this group. This is because the first shard (0,0) (n-1_ may be the only shard other
//nodes see while we're rolling our state. This means it should be read and merged from as well
- Collection<Shard> writeShards = shardEntryGroup.getWriteShards( minTime + minDelta );
+ Collection<Shard> writeShards = shardEntryGroup.getWriteShards( minTime );
assertEquals( "Shard size as expected", 1, writeShards.size() );
@@ -603,7 +560,7 @@ public class NodeShardAllocationTest {
shardEntryGroup = result.next();
- writeShards = shardEntryGroup.getWriteShards( minTime + minDelta );
+ writeShards = shardEntryGroup.getWriteShards( minTime );
assertTrue( "Previous shard present", writeShards.contains( minShard ) );
@@ -635,7 +592,7 @@ public class NodeShardAllocationTest {
final TimeService timeService = mock( TimeService.class );
- final long returnTime = System.currentTimeMillis() + graphFig.getShardCacheTimeout() * 2;
+ final long returnTime = System.currentTimeMillis();
when( timeService.getCurrentTime() ).thenReturn( returnTime );
@@ -656,7 +613,7 @@ public class NodeShardAllocationTest {
* Mock up returning an empty iterator, our audit shouldn't create a new shard
*/
when( edgeShardSerialization
- .getShardMetaData( same( scope ), any( Optional.class ), same( directedEdgeMeta ) ) )
+ .getShardMetaDataLocal( same( scope ), any( Optional.class ), same( directedEdgeMeta ) ) )
.thenReturn( Collections.<Shard>emptyList().iterator() );
@@ -699,77 +656,4 @@ public class NodeShardAllocationTest {
}
- @Test
- public void invalidConfiguration() {
-
- final ShardGroupCompaction shardGroupCompaction = mock( ShardGroupCompaction.class );
-
- final GraphFig graphFig = mock( GraphFig.class );
-
- final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
-
- final EdgeColumnFamilies edgeColumnFamilies = mock( EdgeColumnFamilies.class );
-
- final ShardedEdgeSerialization shardedEdgeSerialization = mock( ShardedEdgeSerialization.class );
-
- final NodeShardApproximation nodeShardApproximation = mock( NodeShardApproximation.class );
-
-
- /**
- * Return 100000 milliseconds
- */
- final TimeService timeService = mock( TimeService.class );
-
- final long time = 100000l;
-
- when( timeService.getCurrentTime() ).thenReturn( time );
-
-
- final long cacheTimeout = 30000l;
-
- when( graphFig.getShardCacheTimeout() ).thenReturn( 30000l );
-
-
- final long tooSmallDelta = ( long ) ( ( cacheTimeout * 2 ) * .99 );
-
- when( graphFig.getShardMinDelta() ).thenReturn( tooSmallDelta );
-
- NodeShardAllocation approximation =
- new NodeShardAllocationImpl( edgeShardSerialization, edgeColumnFamilies, shardedEdgeSerialization,
- nodeShardApproximation, timeService, graphFig, shardGroupCompaction );
-
-
- /**
- * Should throw an exception
- */
- try {
- approximation.getMinTime();
- fail( "Should have thrown a GraphRuntimeException" );
- }
- catch ( GraphRuntimeException gre ) {
- //swallow
- }
-
- //now test something that passes.
-
- final long minDelta = cacheTimeout * 2;
-
- when( graphFig.getShardMinDelta() ).thenReturn( minDelta );
-
- long returned = approximation.getMinTime();
-
- long expectedReturned = time - minDelta;
-
- assertEquals( expectedReturned, returned );
-
- final long delta = cacheTimeout * 4;
-
- when( graphFig.getShardMinDelta() ).thenReturn( delta );
-
- returned = approximation.getMinTime();
-
- expectedReturned = time - delta;
-
- assertEquals( expectedReturned, returned );
- }
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9f3bf2b3/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
index 3b717a4..57996ec 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
@@ -87,13 +87,13 @@ public class NodeShardCacheTest {
final long newTime = 10000l;
- NodeShardCache cache = new NodeShardCacheImpl( allocation, graphFig );
+ NodeShardCache cache = new NodeShardCacheImpl( allocation );
final Optional max = Optional.absent();
- final ShardEntryGroup group = new ShardEntryGroup( newTime );
+ final ShardEntryGroup group = new ShardEntryGroup( );
group.addShard( new Shard( 0, 0, true ) );
@@ -163,7 +163,7 @@ public class NodeShardCacheTest {
* Set our min mid and max
*/
- NodeShardCache cache = new NodeShardCacheImpl( allocation, graphFig );
+ NodeShardCache cache = new NodeShardCacheImpl( allocation );
final Shard minShard = new Shard( 0, 0, true );
@@ -174,14 +174,14 @@ public class NodeShardCacheTest {
/**
* Simulate returning all shards
*/
- final ShardEntryGroup minShardGroup = new ShardEntryGroup( 10000 );
+ final ShardEntryGroup minShardGroup = new ShardEntryGroup( );
minShardGroup.addShard( minShard );
- final ShardEntryGroup midShardGroup = new ShardEntryGroup( 10000 );
+ final ShardEntryGroup midShardGroup = new ShardEntryGroup( );
midShardGroup.addShard( midShard );
- final ShardEntryGroup maxShardGroup = new ShardEntryGroup( 10000 );
+ final ShardEntryGroup maxShardGroup = new ShardEntryGroup( );
maxShardGroup.addShard( maxShard );
@@ -302,8 +302,6 @@ public class NodeShardCacheTest {
private GraphFig getFigMock() {
final GraphFig graphFig = mock( GraphFig.class );
- when( graphFig.getShardCacheSize() ).thenReturn( 1000l );
- when( graphFig.getShardCacheTimeout() ).thenReturn( 30000l );
return graphFig;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9f3bf2b3/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardEntryGroupTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardEntryGroupTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardEntryGroupTest.java
index 9289340..240c3ff 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardEntryGroupTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardEntryGroupTest.java
@@ -37,11 +37,10 @@ public class ShardEntryGroupTest {
@Test
public void singleEntry() {
- final long delta = 10000;
Shard rootShard = new Shard( 0, 0, false );
- ShardEntryGroup shardEntryGroup = new ShardEntryGroup( delta );
+ ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
final boolean result = shardEntryGroup.addShard( rootShard );
@@ -58,14 +57,12 @@ public class ShardEntryGroupTest {
@Test
public void allocatedWithinDelta() {
- final long delta = 10000;
-
Shard firstShard = new Shard( 1000, 1000, false );
Shard secondShard = new Shard( 1000, 1001, false );
- ShardEntryGroup shardEntryGroup = new ShardEntryGroup( delta );
+ ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
boolean result = shardEntryGroup.addShard( secondShard );
@@ -94,8 +91,6 @@ public class ShardEntryGroupTest {
@Test
public void testShardTarget() {
- final long delta = 10000;
-
Shard compactedShard = new Shard( 0, 0, true );
Shard firstShard = new Shard( 1000, 1000, false );
@@ -103,7 +98,7 @@ public class ShardEntryGroupTest {
Shard secondShard = new Shard( 1000, 1001, false );
- ShardEntryGroup shardEntryGroup = new ShardEntryGroup( delta );
+ ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
boolean result = shardEntryGroup.addShard( secondShard );
@@ -129,27 +124,25 @@ public class ShardEntryGroupTest {
//shouldn't return true, since we haven't passed delta time in the second shard
assertFalse( "Merge cannot be run within min time",
- shardEntryGroup.shouldCompact( firstShard.getCreatedTime() + delta ) );
+ shardEntryGroup.shouldCompact( firstShard.getCreatedTime() ) );
//shouldn't return true, since we haven't passed delta time in the second shard
assertFalse( "Merge cannot be run within min time",
- shardEntryGroup.shouldCompact( secondShard.getCreatedTime() + delta ) );
+ shardEntryGroup.shouldCompact( secondShard.getCreatedTime() ) );
//we haven't passed the delta in the neighbor that would be our source, shard2, we shouldn't return true
//we read from shard2 and write to shard1
assertFalse( "Merge cannot be run with after min time",
- shardEntryGroup.shouldCompact( firstShard.getCreatedTime() + delta + 1 ) );
+ shardEntryGroup.shouldCompact( firstShard.getCreatedTime()) );
assertTrue( "Merge should be run with after min time",
- shardEntryGroup.shouldCompact( secondShard.getCreatedTime() + delta + 1 ) );
+ shardEntryGroup.shouldCompact( secondShard.getCreatedTime()) );
}
@Test
public void multipleShardGroups() {
- final long delta = 10000;
-
Shard firstShard = new Shard( 1000, 10000, false );
Shard secondShard = new Shard( 999, 9000, false );
@@ -159,7 +152,7 @@ public class ShardEntryGroupTest {
Shard compactedShard2 = new Shard( 800, 7000, true );
- ShardEntryGroup shardEntryGroup = new ShardEntryGroup( delta );
+ ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
boolean result = shardEntryGroup.addShard( firstShard );
@@ -177,7 +170,7 @@ public class ShardEntryGroupTest {
assertFalse( "Shouldn't add since it's compacted", result );
- ShardEntryGroup secondGroup = new ShardEntryGroup( delta );
+ ShardEntryGroup secondGroup = new ShardEntryGroup( );
result = secondGroup.addShard( compactedShard2 );
@@ -187,9 +180,6 @@ public class ShardEntryGroupTest {
@Test
public void boundShardGroup() {
-
- final long delta = 10000;
-
Shard firstShard = new Shard( 1000, 10000, false );
Shard secondShard = new Shard( 999, 9000, false );
@@ -197,7 +187,7 @@ public class ShardEntryGroupTest {
Shard compactedShard1 = new Shard( 900, 8000, true );
- ShardEntryGroup shardEntryGroup = new ShardEntryGroup( delta );
+ ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
boolean result = shardEntryGroup.addShard( firstShard );
@@ -220,18 +210,18 @@ public class ShardEntryGroupTest {
//shouldn't return true, since we haven't passed delta time in the second shard
assertFalse( "Merge cannot be run within min time",
- shardEntryGroup.shouldCompact( firstShard.getCreatedTime() + delta ) );
+ shardEntryGroup.shouldCompact( firstShard.getCreatedTime() ) );
//shouldn't return true, since we haven't passed delta time in the second shard
assertFalse( "Merge cannot be run within min time",
- shardEntryGroup.shouldCompact( secondShard.getCreatedTime() + delta ) );
+ shardEntryGroup.shouldCompact( secondShard.getCreatedTime() ) );
assertFalse( "Merge cannot be run within min time",
- shardEntryGroup.shouldCompact( secondShard.getCreatedTime() + delta + 1 ) );
+ shardEntryGroup.shouldCompact( secondShard.getCreatedTime() + 1 ) );
assertTrue( "Merge should be run with after min time",
- shardEntryGroup.shouldCompact( firstShard.getCreatedTime() + delta + 1 ) );
+ shardEntryGroup.shouldCompact( firstShard.getCreatedTime() + 1 ) );
}
@@ -241,8 +231,6 @@ public class ShardEntryGroupTest {
@Test
public void getAllReadShards() {
- final long delta = 10000;
-
Shard firstShard = new Shard( 1000, 10000, false );
Shard secondShard = new Shard( 999, 9000, false );
@@ -250,7 +238,7 @@ public class ShardEntryGroupTest {
Shard compactedShard1 = new Shard( 900, 8000, true );
- ShardEntryGroup shardEntryGroup = new ShardEntryGroup( delta );
+ ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
boolean result = shardEntryGroup.addShard( firstShard );
@@ -280,8 +268,6 @@ public class ShardEntryGroupTest {
@Test
public void getAllWriteShardsNotPastCompaction() {
- final long delta = 10000;
-
Shard firstShard = new Shard( 1000, 10000, false );
Shard secondShard = new Shard( 999, 9000, false );
@@ -289,7 +275,7 @@ public class ShardEntryGroupTest {
Shard compactedShard = new Shard( 900, 8000, true );
- ShardEntryGroup shardEntryGroup = new ShardEntryGroup( delta );
+ ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
boolean result = shardEntryGroup.addShard( firstShard );
@@ -304,14 +290,14 @@ public class ShardEntryGroupTest {
assertTrue( "Shard added", result );
- Collection<Shard> writeShards = shardEntryGroup.getWriteShards( firstShard.getCreatedTime() + delta );
+ Collection<Shard> writeShards = shardEntryGroup.getWriteShards( firstShard.getCreatedTime() );
assertEquals( "Shard size correct", 1, writeShards.size() );
assertTrue( "Root shard present", writeShards.contains( compactedShard ) );
- writeShards = shardEntryGroup.getWriteShards( secondShard.getCreatedTime() + delta );
+ writeShards = shardEntryGroup.getWriteShards( secondShard.getCreatedTime() );
assertEquals( "Shard size correct", 1, writeShards.size() );
@@ -321,7 +307,7 @@ public class ShardEntryGroupTest {
/**
* Not the max created timestamp, shouldn't return less than all shards
*/
- writeShards = shardEntryGroup.getWriteShards( secondShard.getCreatedTime() + 1 + delta );
+ writeShards = shardEntryGroup.getWriteShards( secondShard.getCreatedTime() + 1 );
assertEquals( "Shard size correct", 1, writeShards.size() );
@@ -331,7 +317,7 @@ public class ShardEntryGroupTest {
assertEquals( "Compaction target correct", secondShard, shardEntryGroup.getCompactionTarget() );
- writeShards = shardEntryGroup.getWriteShards( firstShard.getCreatedTime() + 1 + delta );
+ writeShards = shardEntryGroup.getWriteShards( firstShard.getCreatedTime() + 1 );
assertEquals( "Shard size correct", 1, writeShards.size() );
@@ -343,15 +329,13 @@ public class ShardEntryGroupTest {
@Test( expected = IllegalArgumentException.class )
public void failsInsertionOrder() {
- final long delta = 10000;
-
Shard secondShard = new Shard( 20000, 10000, false );
Shard firstShard = new Shard( 10000, 10000, false );
Shard rootShard = new Shard( 0, 0, false );
- ShardEntryGroup shardEntryGroup = new ShardEntryGroup( delta );
+ ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
boolean result = shardEntryGroup.addShard( secondShard );
@@ -370,15 +354,13 @@ public class ShardEntryGroupTest {
@Test
public void shardEntryAddList() {
- final long delta = 10000;
-
Shard highShard = new Shard( 30000, 1000, false );
Shard midShard = new Shard( 20000, 1000, true );
Shard lowShard = new Shard( 10000, 1000, false );
- ShardEntryGroup shardEntryGroup = new ShardEntryGroup( delta );
+ ShardEntryGroup shardEntryGroup = new ShardEntryGroup( );
boolean result = shardEntryGroup.addShard( highShard );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9f3bf2b3/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
index 7d4b7f6..ab457d3 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
@@ -84,7 +84,7 @@ public class ShardGroupCompactionTest {
//we shouldn't be able to compact, should throw an exception
final long timeNow = createTime + delta - 1;
- ShardEntryGroup group = new ShardEntryGroup( delta );
+ ShardEntryGroup group = new ShardEntryGroup( );
group.addShard( new Shard( 2000, createTime, false ) );
group.addShard( new Shard( 1000, 5000, true ) );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9f3bf2b3/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
index 32a0cda..71947f8 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
@@ -97,7 +97,6 @@ public class NodeShardApproximationTest {
graphFig = mock( GraphFig.class );
- when( graphFig.getShardCacheSize() ).thenReturn( 10000l );
when( graphFig.getShardSize() ).thenReturn( 250000l );
when( graphFig.getCounterFlushQueueSize() ).thenReturn( 10000 );
@@ -466,57 +465,53 @@ public class NodeShardApproximationTest {
}
- @Override
- public long getShardCacheTimeout() {
- return 0; //To change body of implemented methods use File | Settings | File Templates.
- }
@Override
- public long getShardMinDelta() {
- return 0; //To change body of implemented methods use File | Settings | File Templates.
+ public int getShardAuditWorkerCount() {
+ return 0;
}
@Override
- public long getShardCacheSize() {
- return 0; //To change body of implemented methods use File | Settings | File Templates.
+ public int getShardAuditWorkerQueueSize() {
+ return 0;
}
@Override
- public int getShardCacheRefreshWorkerCount() {
- return 0;
+ public long getCounterFlushCount() {
+ return 100000l;
}
@Override
- public int getShardAuditWorkerCount() {
- return 0;
+ public long getCounterFlushInterval() {
+ return 30000l;
}
@Override
- public int getShardAuditWorkerQueueSize() {
- return 0;
+ public int getCounterFlushQueueSize() {
+ return 10000;
}
@Override
- public long getCounterFlushCount() {
- return 100000l;
+ public String getShardWriteConsistency() {
+ return null;
}
@Override
- public long getCounterFlushInterval() {
- return 30000l;
+ public String getShardReadConsistency() {
+ return null;
}
@Override
- public int getCounterFlushQueueSize() {
- return 10000;
+ public String getShardAuditConsistency() {
+ return null;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9f3bf2b3/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
index 0eccc3e..238e238 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
@@ -56,11 +56,10 @@ public class ShardEntryGroupIteratorTest {
final ApplicationScope scope = new ApplicationScopeImpl( IdGenerator.createId( "application" ) );
final DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( IdGenerator.createId( "source" ), "test" );
final ShardGroupCompaction shardGroupCompaction = mock( ShardGroupCompaction.class );
- final long delta = 10000;
final Iterator<Shard> noShards = Collections.<Shard>emptyList().iterator();
//should blow up, our iterator is empty
- new ShardEntryGroupIterator( noShards, delta, shardGroupCompaction, scope, directedEdgeMeta );
+ new ShardEntryGroupIterator( noShards, shardGroupCompaction, scope, directedEdgeMeta );
}
@@ -74,11 +73,10 @@ public class ShardEntryGroupIteratorTest {
final ShardGroupCompaction shardGroupCompaction = mock( ShardGroupCompaction.class );
final Shard minShard = new Shard( 0, 0, true );
- final long delta = 10000;
final Iterator<Shard> noShards = Collections.singleton( minShard ).iterator();
ShardEntryGroupIterator entryGroupIterator =
- new ShardEntryGroupIterator( noShards, delta, shardGroupCompaction, scope, directedEdgeMeta );
+ new ShardEntryGroupIterator( noShards, shardGroupCompaction, scope, directedEdgeMeta );
assertTrue( "Root shard always present", entryGroupIterator.hasNext() );
@@ -163,7 +161,7 @@ public class ShardEntryGroupIteratorTest {
ShardEntryGroupIterator entryGroupIterator =
- new ShardEntryGroupIterator( noShards, delta, shardGroupCompaction, scope, directedEdgeMeta );
+ new ShardEntryGroupIterator( noShards, shardGroupCompaction, scope, directedEdgeMeta );
assertTrue( "max group present", entryGroupIterator.hasNext() );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9f3bf2b3/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/ElasticSearchQueryBuilder/SearchRequestBuilderStrategyV2.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/ElasticSearchQueryBuilder/SearchRequestBuilderStrategyV2.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/ElasticSearchQueryBuilder/SearchRequestBuilderStrategyV2.java
index 4d18cef..0562a6c 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/ElasticSearchQueryBuilder/SearchRequestBuilderStrategyV2.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/ElasticSearchQueryBuilder/SearchRequestBuilderStrategyV2.java
@@ -17,7 +17,7 @@
* * directory of this distribution.
*
*/
-package org.apache.usergrid.persistence.index.ElasticSearchQueryBuilder;
+package org.apache.usergrid.persistence.index.elasticsearchquerybuilder;
import org.elasticsearch.action.search.SearchRequestBuilder;
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9f3bf2b3/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 87e2dbd..fcfe39e 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -32,7 +32,7 @@ import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.util.Health;
import org.apache.usergrid.persistence.core.util.ValidationUtils;
import org.apache.usergrid.persistence.index.*;
-import org.apache.usergrid.persistence.index.ElasticSearchQueryBuilder.SearchRequestBuilderStrategyV2;
+import org.apache.usergrid.persistence.index.elasticsearchquerybuilder.SearchRequestBuilderStrategyV2;
import org.apache.usergrid.persistence.index.exceptions.IndexException;
import org.apache.usergrid.persistence.index.migration.IndexDataVersions;
import org.apache.usergrid.persistence.index.query.ParsedQuery;