You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2015/06/10 18:45:51 UTC

[29/35] incubator-usergrid git commit: merge

merge


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

Branch: refs/heads/rest-test-framework-token-fix
Commit: aa1e481160cad565a599cdbf75d0431fb7a1e2d7
Parents: 7d354d9 aebab48
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Jun 9 19:07:47 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Jun 9 19:07:47 2015 -0600

----------------------------------------------------------------------
 .../batch/service/JobSchedulerService.java      |   8 +-
 .../corepersistence/CpEntityManager.java        |  70 ++++-----
 .../asyncevents/AmazonAsyncEventService.java    |  10 +-
 .../index/IndexProcessorFig.java                |   2 +-
 .../index/ReIndexRequestBuilderImpl.java        |   2 +-
 .../search/AbstractElasticSearchFilter.java     |   2 +-
 .../impl/EntityCollectionManagerImpl.java       |  22 +--
 .../mvcc/stage/delete/UniqueCleanup.java        |   2 +-
 .../mvcc/stage/delete/VersionCompact.java       |   2 +-
 .../core/metrics/MetricsFactoryImpl.java        |  46 +++---
 .../graph/impl/GraphManagerImpl.java            |  28 ++--
 .../index/impl/EsEntityIndexFactoryImpl.java    |   1 +
 .../index/impl/EsEntityIndexImpl.java           |  45 ++----
 .../index/impl/EsIndexBufferConsumerImpl.java   |  18 +--
 .../index/impl/IndexRefreshCommandImpl.java     |   3 +-
 .../index/impl/IndexLoadTestsIT.java            |   6 +-
 .../queue/impl/SNSQueueManagerImpl.java         | 148 +++++++++++--------
 .../queue/util/AmazonNotificationUtils.java     |  17 ++-
 .../org/apache/usergrid/rest/IndexResource.java |   7 +-
 .../rest/management/ManagementResource.java     |   8 +-
 .../security/SecuredResourceFilterFactory.java  |   2 +
 .../resources/usergrid-rest-deploy-context.xml  |   1 +
 .../java/org/apache/usergrid/rest/BasicIT.java  |  24 +--
 .../apache/usergrid/rest/IndexResourceIT.java   |  40 ++++-
 .../rest/management/ManagementResourceIT.java   |   2 +-
 .../test/resource2point0/AbstractRestIT.java    |   4 +-
 .../endpoints/NamedResource.java                |  37 ++++-
 .../notifications/NotificationsService.java     |   6 +-
 .../services/notifications/QueueJob.java        |   6 +-
 .../services/notifications/QueueListener.java   |   4 +-
 .../impl/ApplicationQueueManagerImpl.java       |  20 +--
 .../usergrid/services/queues/QueueListener.java |  14 +-
 32 files changed, 338 insertions(+), 269 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/aa1e4811/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/aa1e4811/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/AbstractElasticSearchFilter.java
----------------------------------------------------------------------
diff --cc stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/AbstractElasticSearchFilter.java
index 40a96cf,7ab9418..08a6f94
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/AbstractElasticSearchFilter.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/AbstractElasticSearchFilter.java
@@@ -57,13 -55,10 +57,13 @@@ public abstract class AbstractElasticSe
       * Create a new instance of our command
       */
      public AbstractElasticSearchFilter( final EntityIndexFactory entityIndexFactory,
 -                                        final MetricsFactory metricsFactory, final String query ) {
 +                                        final MetricsFactory metricsFactory,
 +                                        final IndexLocationStrategyFactory indexLocationStrategyFactory,
 +                                        final String query ) {
          this.entityIndexFactory = entityIndexFactory;
 +        this.indexLocationStrategyFactory = indexLocationStrategyFactory;
          this.query = query;
-         this.searchTimer = metricsFactory.getTimer( AbstractElasticSearchFilter.class, "query" );
+         this.searchTimer = metricsFactory.getTimer( AbstractElasticSearchFilter.class, "query.search" );
      }
  
  

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/aa1e4811/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
index 3910b22,b32fec4..a57c42a
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
@@@ -36,25 -38,20 +36,26 @@@ import com.google.inject.Inject
  public class EsEntityIndexFactoryImpl implements EntityIndexFactory{
  
      private final IndexFig config;
 +    private final IndexCache indexCache;
      private final EsProvider provider;
 -    private final IndexBufferConsumer indexBatchBufferProducer;
 +    private final IndexBufferConsumer indexBufferConsumer;
      private final MetricsFactory metricsFactory;
 -    private final MapManagerFactory mapManagerFactory;
 -    private final IndexFig indexFig;
 -    private final AliasedEntityIndex entityIndex;
 -    private final IndexIdentifier indexIdentifier;
 +    private final IndexRefreshCommand refreshCommand;
  
 -    private LoadingCache<ApplicationScope, ApplicationEntityIndex> eiCache =
 -        CacheBuilder.newBuilder().maximumSize( 1000 ).build( new CacheLoader<ApplicationScope, ApplicationEntityIndex>() {
 -            public ApplicationEntityIndex load( ApplicationScope scope ) {
 -                return new EsApplicationEntityIndexImpl(
 -                    scope,entityIndex,config, indexBatchBufferProducer, provider, metricsFactory, mapManagerFactory, indexFig, indexIdentifier
 +    private LoadingCache<IndexLocationStrategy, AliasedEntityIndex> eiCache =
 +        CacheBuilder.newBuilder().maximumSize( 1000 ).build( new CacheLoader<IndexLocationStrategy, AliasedEntityIndex>() {
 +            public AliasedEntityIndex load( IndexLocationStrategy locationStrategy ) {
 +                AliasedEntityIndex index =  new EsEntityIndexImpl(
 +                    provider,
 +                    indexCache,
 +                    config,
 +                    refreshCommand,
 +                    metricsFactory,
 +                    indexBufferConsumer,
 +                    locationStrategy
                  );
++                index.initialize();
 +                return index;
              }
          } );
  

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/aa1e4811/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 5cb002e,05ce866..2d84780
--- 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
@@@ -109,16 -83,7 +109,13 @@@ public class EsEntityIndexImpl implemen
              ImmutableMap.<String, Object>builder().put(IndexingUtils.ENTITY_ID_FIELDNAME, UUIDGenerator.newTimeUUID().toString()).build();
  
  
-     private final Timer deleteApplicationTimer;
-     private final Meter deleteApplicationMeter;
 -    private final IndexIdentifier indexIdentifier;
 +    private final ApplicationScope applicationScope;
 +    private final SearchRequestBuilderStrategy searchRequest;
 +    private final SearchRequestBuilderStrategyV2 searchRequestBuilderStrategyV2;
 +    private final int cursorTimeout;
 +    private final long queryTimeout;
 +    private final IndexBufferConsumer indexBatchBufferProducer;
 +    private final FailureMonitorImpl failureMonitor;
-     private final Timer searchTimer;
  
      private IndexCache aliasCache;
      private Timer mappingTimer;
@@@ -136,33 -100,17 +133,25 @@@
      ) {
  
          this.indexFig = indexFig;
 -        this.indexIdentifier = indexIdentifier;
 -
 +        this.indexLocationStrategy = indexLocationStrategy;
 +        this.indexBatchBufferProducer = indexBatchBufferProducer;
 +        this.failureMonitor = new FailureMonitorImpl( indexFig, provider );
          this.esProvider = provider;
          this.indexRefreshCommand = indexRefreshCommand;
 -        this.alias = indexIdentifier.getAlias();
 +        this.alias = indexLocationStrategy.getAlias();
          this.aliasCache = indexCache;
 +        this.applicationScope = indexLocationStrategy.getApplicationScope();
 +        this.cursorTimeout = indexFig.getQueryCursorTimeout();
 +        this.queryTimeout = indexFig.getWriteTimeout();
 +        this.searchRequest
-             = new SearchRequestBuilderStrategy( esProvider, applicationScope, alias, cursorTimeout );
++            = new SearchRequestBuilderStrategy(esProvider, applicationScope, alias, cursorTimeout );
 +        this.searchRequestBuilderStrategyV2 = new SearchRequestBuilderStrategyV2( esProvider, applicationScope, alias, cursorTimeout  );
 +
-         this.addTimer = metricsFactory
-             .getTimer(EsEntityIndexImpl.class, "add.timer");
-         this.updateAliasTimer = metricsFactory
-             .getTimer(EsEntityIndexImpl.class, "update.alias.timer");
-         this.mappingTimer = metricsFactory
-             .getTimer(EsEntityIndexImpl.class, "create.mapping.timer");
-         this.deleteApplicationTimer =
-             metricsFactory.getTimer( EsEntityIndexImpl.class, "delete.application" );
-         this.deleteApplicationMeter =
-             metricsFactory.getMeter( EsEntityIndexImpl.class, "delete.application.meter" );
-         this.refreshIndexMeter = metricsFactory.getMeter(EsEntityIndexImpl.class,"refresh.meter");
-         this.searchTimer = metricsFactory.getTimer( EsEntityIndexImpl.class, "search.timer" );
-         initialize();
+         this.addTimer = metricsFactory.getTimer(EsEntityIndexImpl.class, "index.add");
+         this.updateAliasTimer = metricsFactory.getTimer(EsEntityIndexImpl.class, "index.update_alias");
+         this.mappingTimer = metricsFactory.getTimer(EsEntityIndexImpl.class, "index.create_mapping");
+         this.refreshIndexMeter = metricsFactory.getMeter(EsEntityIndexImpl.class, "index.refresh_index");
+ 
      }
  
      @Override
@@@ -381,306 -330,6 +370,298 @@@
          return indexSet.toArray(new String[0]);
      }
  
 +    @Override
 +    public EntityIndexBatch createBatch() {
 +        EntityIndexBatch batch =
 +            new EsEntityIndexBatchImpl(indexLocationStrategy , indexBatchBufferProducer, this );
 +        return batch;
 +    }
 +
 +    public CandidateResults search( final SearchEdge searchEdge, final SearchTypes searchTypes, final String query,
 +                                    final int limit, final int offset ) {
 +
 +        IndexValidationUtils.validateSearchEdge(searchEdge);
 +        Preconditions.checkNotNull(searchTypes, "searchTypes cannot be null");
 +        Preconditions.checkNotNull( query, "query cannot be null" );
 +        Preconditions.checkArgument( limit > 0, "limit must be > 0" );
 +
 +
 +        SearchResponse searchResponse;
 +
 +        final ParsedQuery parsedQuery = ParsedQueryBuilder.build(query);
 +
 +        final SearchRequestBuilder srb = searchRequest.getBuilder( searchEdge, searchTypes, parsedQuery, limit, offset )
 +            .setTimeout( TimeValue.timeValueMillis(queryTimeout) );
 +
 +        if ( logger.isDebugEnabled() ) {
 +            logger.debug( "Searching index (read alias): {}\n  nodeId: {}, edgeType: {},  \n type: {}\n   query: {} ",
 +                this.alias.getReadAlias(), searchEdge.getNodeId(), searchEdge.getEdgeName(),
 +                searchTypes.getTypeNames( applicationScope ), srb );
 +        }
 +
 +        try {
 +            //Added For Graphite Metrics
-             Timer.Context timeSearch = searchTimer.time();
 +            searchResponse = srb.execute().actionGet();
-             timeSearch.stop();
 +        }
 +        catch ( Throwable t ) {
 +            logger.error( "Unable to communicate with Elasticsearch", t );
 +            failureMonitor.fail( "Unable to execute batch", t );
 +            throw t;
 +        }
 +        failureMonitor.success();
 +
 +        return parseResults(searchResponse, parsedQuery, limit, offset);
 +    }
 +
 +
 +    @Override
 +    public CandidateResults getAllEdgeDocuments( final IndexEdge edge, final Id entityId ) {
 +        /**
 +         * Take a list of IndexEdge, with an entityId
 +         and query Es directly for matches
 +
 +         */
 +        IndexValidationUtils.validateSearchEdge( edge );
 +        Preconditions.checkNotNull( entityId, "entityId cannot be null" );
 +
 +        SearchResponse searchResponse;
 +
 +        List<CandidateResult> candidates = new ArrayList<>();
 +
 +        final ParsedQuery parsedQuery = ParsedQueryBuilder.build( "select *" );
 +
 +        final SearchRequestBuilder srb = searchRequestBuilderStrategyV2.getBuilder();
 +
 +        //I can't just search on the entity Id.
 +
 +        FilterBuilder entityEdgeFilter = FilterBuilders.termFilter(IndexingUtils.EDGE_NODE_ID_FIELDNAME,
 +            IndexingUtils.nodeId(edge.getNodeId()));
 +
 +        srb.setPostFilter(entityEdgeFilter);
 +
 +        if ( logger.isDebugEnabled() ) {
 +            logger.debug( "Searching for marked versions in index (read alias): {}\n  nodeId: {},\n   query: {} ",
 +                this.alias.getReadAlias(),entityId, srb );
 +        }
 +
 +        try {
 +            //Added For Graphite Metrics
-             Timer.Context timeSearch = searchTimer.time();
 +
 +            //set the timeout on the scroll cursor to 6 seconds and set the number of values returned per shard to 100.
 +            //The settings for the scroll aren't tested and so we aren't sure what vlaues would be best in a production enviroment
 +            //TODO: review this and make them not magic numbers when acking this PR.
 +            searchResponse = srb.setScroll( new TimeValue( 6000 ) ).setSize( 100 ).execute().actionGet();
 +
 +
 +            while(true){
 +                //add search result hits to some sort of running tally of hits.
 +                candidates = aggregateScrollResults( candidates, searchResponse );
 +
 +                SearchScrollRequestBuilder ssrb = searchRequestBuilderStrategyV2
 +                    .getScrollBuilder( searchResponse.getScrollId() )
 +                    .setScroll( new TimeValue( 6000 ) );
 +
 +                //TODO: figure out how to log exactly what we're putting into elasticsearch
 +                //                if ( logger.isDebugEnabled() ) {
 +                //                    logger.debug( "Scroll search using query: {} ",
 +                //                        ssrb.toString() );
 +                //                }
 +
 +                searchResponse = ssrb.execute().actionGet();
 +
 +                if (searchResponse.getHits().getHits().length == 0) {
 +                    break;
 +                }
 +
 +
 +            }
-             timeSearch.stop();
 +        }
 +        catch ( Throwable t ) {
 +            logger.error( "Unable to communicate with Elasticsearch", t );
 +            failureMonitor.fail( "Unable to execute batch", t );
 +            throw t;
 +        }
 +        failureMonitor.success();
 +
 +        return new CandidateResults( candidates, parsedQuery.getSelectFieldMappings());
 +    }
 +
 +
 +    @Override
 +    public CandidateResults getAllEntityVersionsBeforeMarkedVersion( final Id entityId, final UUID markedVersion ) {
 +
 +        Preconditions.checkNotNull( entityId, "entityId cannot be null" );
 +        Preconditions.checkNotNull( markedVersion, "markedVersion cannot be null" );
 +        ValidationUtils.verifyVersion(markedVersion);
 +
 +        SearchResponse searchResponse;
 +
 +        List<CandidateResult> candidates = new ArrayList<>();
 +
 +        final ParsedQuery parsedQuery = ParsedQueryBuilder.build( "select *" );
 +
 +        final SearchRequestBuilder srb = searchRequestBuilderStrategyV2.getBuilder();
 +
 +        FilterBuilder entityIdFilter = FilterBuilders.termFilter( IndexingUtils.ENTITY_ID_FIELDNAME,
 +            IndexingUtils.entityId( entityId ) );
 +
 +        FilterBuilder entityVersionFilter = FilterBuilders.rangeFilter( IndexingUtils.ENTITY_VERSION_FIELDNAME ).lte( markedVersion );
 +
 +        FilterBuilder andFilter = FilterBuilders.andFilter(entityIdFilter,entityVersionFilter  );
 +
 +        srb.setPostFilter(andFilter);
 +
 +
 +
 +        if ( logger.isDebugEnabled() ) {
 +            logger.debug( "Searching for marked versions in index (read alias): {}\n  nodeId: {},\n   query: {} ",
 +                this.alias.getReadAlias(),entityId, srb );
 +        }
 +
 +        try {
 +            //Added For Graphite Metrics
-             Timer.Context timeSearch = searchTimer.time();
 +
 +            //set the timeout on the scroll cursor to 6 seconds and set the number of values returned per shard to 100.
 +            //The settings for the scroll aren't tested and so we aren't sure what vlaues would be best in a production enviroment
 +            //TODO: review this and make them not magic numbers when acking this PR.
 +            searchResponse = srb.setScroll( new TimeValue( 6000 ) ).setSize( 100 ).execute().actionGet();
 +
 +            //list that will hold all of the search hits
 +
 +
 +            while(true){
 +                //add search result hits to some sort of running tally of hits.
 +                candidates = aggregateScrollResults( candidates, searchResponse );
 +
 +                SearchScrollRequestBuilder ssrb = searchRequestBuilderStrategyV2
 +                    .getScrollBuilder( searchResponse.getScrollId() )
 +                    .setScroll( new TimeValue( 6000 ) );
 +
 +                //TODO: figure out how to log exactly what we're putting into elasticsearch
 +//                if ( logger.isDebugEnabled() ) {
 +//                    logger.debug( "Scroll search using query: {} ",
 +//                        ssrb.toString() );
 +//                }
 +
 +                searchResponse = ssrb.execute().actionGet();
 +
 +                if (searchResponse.getHits().getHits().length == 0) {
 +                    break;
 +                }
 +
 +
 +            }
-             timeSearch.stop();
 +        }
 +        catch ( Throwable t ) {
 +            logger.error( "Unable to communicate with Elasticsearch", t );
 +            failureMonitor.fail( "Unable to execute batch", t );
 +            throw t;
 +        }
 +        failureMonitor.success();
 +
 +        return new CandidateResults( candidates, parsedQuery.getSelectFieldMappings());
 +    }
 +
 +
 +    /**
 +     * Completely delete an index.
 +     */
 +    public Observable deleteApplication() {
-         deleteApplicationMeter.mark();
 +        String idString = applicationId( applicationScope.getApplication() );
 +        final TermQueryBuilder tqb = QueryBuilders.termQuery(APPLICATION_ID_FIELDNAME, idString);
 +        final String[] indexes = getUniqueIndexes();
-         Timer.Context timer = deleteApplicationTimer.time();
 +        //Added For Graphite Metrics
 +        return Observable.from( indexes ).flatMap( index -> {
 +
 +            final ListenableActionFuture<DeleteByQueryResponse> response =
 +                esProvider.getClient().prepareDeleteByQuery( alias.getWriteAlias() ).setQuery( tqb ).execute();
 +
 +            response.addListener( new ActionListener<DeleteByQueryResponse>() {
 +
 +                @Override
 +                public void onResponse( DeleteByQueryResponse response ) {
 +                    checkDeleteByQueryResponse( tqb, response );
 +                }
 +
 +
 +                @Override
 +                public void onFailure( Throwable e ) {
 +                    logger.error( "failed on delete index", e );
 +                }
 +            } );
 +            return Observable.from( response );
-         } ).doOnError( t -> logger.error( "Failed on delete application", t ) ).doOnCompleted( () -> timer.stop() );
++        } ).doOnError( t -> logger.error( "Failed on delete application", t ) );
 +    }
 +
 +
 +    /**
 +     * Validate the response doesn't contain errors, if it does, fail fast at the first error we encounter
 +     */
 +    private void checkDeleteByQueryResponse( final QueryBuilder query, final DeleteByQueryResponse response ) {
 +
 +        for ( IndexDeleteByQueryResponse indexDeleteByQueryResponse : response ) {
 +            final ShardOperationFailedException[] failures = indexDeleteByQueryResponse.getFailures();
 +
 +            for ( ShardOperationFailedException failedException : failures ) {
 +                logger.error( String.format( "Unable to delete by query %s. "
 +                        + "Failed with code %d and reason %s on shard %s in index %s", query.toString(),
 +                    failedException.status().getStatus(), failedException.reason(),
 +                    failedException.shardId(), failedException.index() ) );
 +            }
 +        }
 +    }
 +
 +
 +    /**
 +     * Parse the results and return the canddiate results
 +     */
 +    private CandidateResults parseResults( final SearchResponse searchResponse, final ParsedQuery query,
 +                                           final int limit, final int from ) {
 +
 +        final SearchHits searchHits = searchResponse.getHits();
 +        final SearchHit[] hits = searchHits.getHits();
 +
 +        logger.debug( "   Hit count: {} Total hits: {}", hits.length, searchHits.getTotalHits() );
 +
 +        List<CandidateResult> candidates = new ArrayList<>( hits.length );
 +
 +        for ( SearchHit hit : hits ) {
 +
 +            final CandidateResult candidateResult = parseIndexDocId( hit.getId() );
 +
 +            candidates.add( candidateResult );
 +        }
 +
 +        final CandidateResults candidateResults = new CandidateResults( candidates, query.getSelectFieldMappings());
 +
 +        // >= seems odd.  However if we get an overflow, we need to account for it.
 +        if (  hits.length >= limit ) {
 +
 +            candidateResults.initializeOffset( from + limit );
 +
 +        }
 +
 +        return candidateResults;
 +    }
 +
 +    private List<CandidateResult> aggregateScrollResults( List<CandidateResult> candidates,
 +                                                          final SearchResponse searchResponse ){
 +
 +        final SearchHits searchHits = searchResponse.getHits();
 +        final SearchHit[] hits = searchHits.getHits();
 +
 +        for ( SearchHit hit : hits ) {
 +
 +            final CandidateResult candidateResult = parseIndexDocId( hit.getId() );
 +
 +            candidates.add( candidateResult );
 +        }
 +
 +        logger.debug( "Aggregated {} out of {} hits ",candidates.size(),searchHits.getTotalHits() );
 +
 +        return  candidates;
 +
 +    }
  
      /**
       * Do the retry operation

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/aa1e4811/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
index 0515a64,5092afd..337477f
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
@@@ -71,7 -69,8 +71,8 @@@ public class IndexRefreshCommandImpl im
                                      final IndexCache indexCache ) {
  
  
-         this.timer = metricsFactory.getTimer( IndexRefreshCommandImpl.class, "index.refresh.timer" );
+         this.timer = metricsFactory.getTimer( IndexRefreshCommandImpl.class, "index.refresh" );
 -        this.alias = indexIdentifier.getAlias();
++
          this.esProvider = esProvider;
          this.producer = producer;
          this.indexFig = indexFig;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/aa1e4811/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexLoadTestsIT.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/aa1e4811/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/aa1e4811/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
----------------------------------------------------------------------
diff --cc stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
index 6378096,c0580d4..8cf1863
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
@@@ -34,52 -32,92 +34,90 @@@ import java.util.HashMap
  import java.util.Map;
  import java.util.UUID;
  
 +import static org.junit.Assert.assertNotNull;
 +import static org.junit.Assert.fail;
+ import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
+ import org.apache.usergrid.rest.test.resource2point0.model.*;
+ import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
+ 
+ import static org.junit.Assert.assertNotNull;
+ 
  
  /**
   * test index creation
   */
 -public class IndexResourceIT extends AbstractRestIT {
 +public class IndexResourceIT extends org.apache.usergrid.rest.test.resource2point0.AbstractRestIT {
  
  
- 
 -//    @Rule
 -//    public TestContextSetup context = new TestContextSetup( this );
++    @Rule
++    public TestContextSetup context = new TestContextSetup( this );
      //Used for all MUUserResourceITTests
      private Logger LOG = LoggerFactory.getLogger(IndexResourceIT.class);
  
      public IndexResourceIT(){
  
      }
 -
 -//    @Ignore( "will finish when tests are working from rest" )
 -//    @Test
 -//    public void TestAddIndex() throws Exception{
 -//
 -//        String superToken = superAdminToken();
 -//
 -//        Map<String, Object> data = new HashMap<String, Object>();
 -//        data.put( "replicas", 0 );
 -//        data.put( "shards", 1 );
 -//        data.put( "writeConsistency", "one" );
 -//
 -//        UUID appId = this.context.getAppUuid();
 -//
 -//        // change the password as admin. The old password isn't required
 -//        JsonNode node = null;
 -//        try {
 -//            node = mapper.readTree(resource().path("/system/index/" + appId)
 -//                    .queryParam("access_token", superToken)
 -//                    .accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON_TYPE)
 -//                    .post(String.class, data));
 -//        } catch (Exception e) {
 -//            LOG.error("failed", e);
 -//            fail(e.toString());
 -//        }
 -//        assertNull( getError( node ) );
 -//
 -//        refreshIndex("test-organization", "test-app");
 -//
 -//    }
 -
 -
 -    /**
 -     * checks that reindex endpoint is case insensitive
 -     */
+     @Test
+     public void testCaseReindexEndpoint() {
+ 
+         //Create Collection
+         Map payload = new HashMap<>(  );
+         payload.put( "name","wazer wifle!!" );
+         ApiResponse collectionResponse = clientSetup.getRestClient()
+             .pathResource( getOrgAppPath( "storelatlons" ) ).post( payload );
  
+         assertNotNull( collectionResponse );
+ 
+         //try reindex endpoint with ALl mixed case characters
+         Token superUserToken = clientSetup.getRestClient().management().token().get(clientSetup.getSuperuserName(),clientSetup.getSuperuserPassword());
+ 
+         QueryParameters queryParameters = new QueryParameters();
+         queryParameters.addParam( "access_token",superUserToken.getAccessToken());
+         ApiResponse result = clientSetup.getRestClient()
 -                                   .pathResource( "system/index/rebuild/"+clientSetup.getAppUuid()+"/StOrElaTloNs" )
 -                                   .post( false, ApiResponse.class, null, queryParameters, true );
++            .pathResource( "system/index/rebuild/"+clientSetup.getAppUuid()+"/StOrElaTloNs" )
++            .post( false, ApiResponse.class, null, queryParameters, true );
+ 
+         assertNotNull(result);
+ 
+         //try the reindex endpoint with all lowercase Characters
+         queryParameters = new QueryParameters();
+         queryParameters.addParam( "access_token",clientSetup.getSuperuserToken().getAccessToken() );
+         result = clientSetup.getRestClient()
 -                                        .pathResource( "system/index/rebuild/"+clientSetup.getAppUuid()+"/storelatlons" )
 -                                        .post( false, ApiResponse.class,null,queryParameters,true);
++            .pathResource( "system/index/rebuild/"+clientSetup.getAppUuid()+"/storelatlons" )
++            .post( false, ApiResponse.class,null,queryParameters,true);
+ 
+         assertNotNull( result );
+ 
+     }
 +    @Test
 +    @Ignore
 +    public void TestAddIndex() throws Exception{
 +
 +
 +        Map<String, Object> data = new HashMap<String, Object>();
 +        data.put( "replicas", 0 );
 +        data.put( "shards", 1 );
 +        data.put( "writeConsistency", "one" );
 +
 +        String appId = this.clientSetup.getAppUuid();
 +
 +        // change the password as admin. The old password isn't required
 +        org.apache.usergrid.rest.test.resource2point0.model.ApiResponse node = null;
 +        try {
 +
 +            WebResource resource = this.clientSetup.getRestClient().pathResource("/system/index/" + appId).getResource();
 +
 +            //added httpBasicauth filter to all setup calls because they all do verification this way.
 +            HTTPBasicAuthFilter httpBasicAuthFilter = new HTTPBasicAuthFilter( clientSetup.getSuperuserName(),clientSetup.getSuperuserPassword() );
 +            resource.addFilter( httpBasicAuthFilter );
 +
 +            node = resource.type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
 +                .get( org.apache.usergrid.rest.test.resource2point0.model.ApiResponse.class);
 +        } catch (Exception e) {
 +            LOG.error("failed", e);
 +            fail(e.toString());
 +        }
 +        assertNotNull( node );
 +
 +    }
  }