You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/03/30 21:58:54 UTC

[50/50] incubator-usergrid git commit: Merge branch 'two-dot-o-dev' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o-dev

Merge branch 'two-dot-o-dev' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o-dev

Conflicts:
	stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
	stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java


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

Branch: refs/heads/two-dot-o-dev
Commit: 217e7dc13297e81e84eafdc6297fbcc1d2eb9bf3
Parents: d2be54b 07cb9df
Author: Dave Johnson <dm...@apigee.com>
Authored: Mon Mar 30 15:57:45 2015 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Mon Mar 30 15:57:45 2015 -0400

----------------------------------------------------------------------
 .../AllApplicationsObservable.java              |   8 +-
 .../usergrid/corepersistence/CoreModule.java    |   9 +-
 .../corepersistence/CpEntityManager.java        | 122 +++++-----
 .../corepersistence/CpEntityManagerFactory.java |  14 +-
 .../rx/impl/AbstractGraphVisitorImpl.java       |   2 +-
 .../rx/impl/AllApplicationsObservableImpl.java  |   2 +-
 .../rx/ApplicationObservableTestIT.java         |   2 +-
 .../core/metrics/MetricsFactory.java            |   2 +-
 .../data/DataMigrationManagerImpl.java          |   9 +-
 .../impl/migration/EdgeDataMigrationImpl.java   |   2 +-
 .../index/ApplicationEntityIndex.java           |  20 +-
 .../usergrid/persistence/index/EntityIndex.java |  12 +-
 .../usergrid/persistence/index/IndexAlias.java  |  38 ++++
 .../persistence/index/IndexBufferConsumer.java  |   2 +-
 .../persistence/index/IndexBufferProducer.java  |   2 +-
 .../usergrid/persistence/index/IndexCache.java  |  39 ++++
 .../persistence/index/IndexIdentifier.java      |  57 +----
 .../usergrid/persistence/index/SearchType.java  |  12 +-
 .../usergrid/persistence/index/SearchTypes.java |   3 +-
 .../persistence/index/guice/IndexModule.java    |  45 +++-
 .../persistence/index/impl/DeIndexRequest.java  |  42 ++--
 .../index/impl/EntityToMapConverter.java        | 173 ++++++++++++++
 .../impl/EsApplicationEntityIndexImpl.java      | 228 +++++++------------
 .../index/impl/EsEntityIndexBatchImpl.java      | 219 +-----------------
 .../index/impl/EsEntityIndexFactoryImpl.java    |   4 +-
 .../index/impl/EsEntityIndexImpl.java           |  32 ++-
 .../persistence/index/impl/EsIndexCache.java    | 142 ------------
 .../index/impl/EsIndexCacheImpl.java            | 141 ++++++++++++
 .../index/impl/IndexIdentifierImpl.java         |  68 ++++++
 .../persistence/index/impl/IndexRequest.java    |  24 +-
 .../persistence/index/impl/IndexingUtils.java   |  10 +-
 .../impl/SearchRequestBuilderStrategy.java      | 195 ++++++++++++++++
 .../migration/EsIndexDataMigrationImpl.java     | 105 +++++++++
 .../index/migration/EsIndexMigrationPlugin.java |  46 ++++
 .../index/migration/IndexDataVersions.java      |  39 ++++
 .../index/migration/IndexMigration.java         |  35 +++
 .../index/migration/LegacyIndexIdentifier.java  |  78 +++++++
 .../index/query/CandidateResults.java           |  24 +-
 .../usergrid/persistence/index/query/Query.java |  36 +--
 .../index/guice/TestIndexModule.java            |  51 ++++-
 .../index/impl/BufferQueueSQSImplTest.java      |  20 +-
 .../persistence/index/impl/EntityIndexTest.java |  60 +++--
 .../index/impl/IndexLoadTestsIT.java            |   4 -
 .../index/impl/IndexMigrationTest.java          | 106 +++++++++
 .../persistence/query/tree/GrammarTreeTest.java |  10 +-
 .../org/apache/usergrid/rest/RootResource.java  |   2 +-
 46 files changed, 1513 insertions(+), 783 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/217e7dc1/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
----------------------------------------------------------------------
diff --cc stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
index b62cdf8,d994419..62f2d1b
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
@@@ -16,7 -16,7 +16,8 @@@
  package org.apache.usergrid.corepersistence;
  
  
 +import org.apache.usergrid.corepersistence.migration.*;
+ import org.apache.usergrid.persistence.core.scope.ApplicationScope;
  import org.springframework.context.ApplicationContext;
  
  import org.apache.usergrid.corepersistence.events.EntityDeletedHandler;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/217e7dc1/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --cc stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index baac821,99204a8..c613e44
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@@ -156,11 -164,10 +156,9 @@@ public class CpEntityManagerFactory imp
                  em.getApplication();
              }
  
-             ApplicationScope appScope = new ApplicationScopeImpl(new SimpleId( CpNamingUtils.SYSTEM_APP_ID, "application" ) );
-             ApplicationEntityIndex applicationEntityIndex = entityIndexFactory.createApplicationEntityIndex(appScope);
-             applicationEntityIndex.initializeIndex();
+             entityIndex.initialize();
              entityIndex.refresh();
  
 -
          } catch (Exception ex) {
              throw new RuntimeException("Fatal error creating system application", ex);
          }
@@@ -259,14 -263,59 +257,10 @@@
              throw new ApplicationAlreadyExistsException( appName );
          }
  
-         ApplicationScope applicationScope = new ApplicationScopeImpl(new SimpleId( applicationId,"application"));
-         ApplicationEntityIndex applicationEntityIndex = entityIndexFactory.createApplicationEntityIndex(applicationScope);
-         applicationEntityIndex.initializeIndex();
- 
          getSetup().setupApplicationKeyspace( applicationId, appName );
  
 -        final Optional<UUID> cachedValue = orgApplicationCache.getOrganizationId( organizationName );
 -
 -
 -        UUID orgUuid;
 -
 -        if ( !cachedValue.isPresent() ) {
 -
 -
 -            // create new org because the specified one does not exist
 -            final String orgName = organizationName;
 -
 -
 -
 -            try {
 -                final Entity orgInfo = em.create( "organization", new HashMap<String, Object>() {{
 -                    put( PROPERTY_NAME, orgName );
 -                }} );
 -                orgUuid = orgInfo.getUuid();
 -                //evit so it's re-loaded later
 -                orgApplicationCache.evictOrgId( name );
 -            }
 -            catch ( DuplicateUniquePropertyExistsException e ) {
 -                //swallow, if it exists, just get it
 -                orgApplicationCache.evictOrgId( organizationName );
 -                orgUuid = orgApplicationCache.getOrganizationId( organizationName ).get();
 -            }
 -
 -        } else{
 -            orgUuid = cachedValue.get();
 -        }
 -
 -        // create appinfo entry in the system app
 -        final UUID appId = applicationId;
 -        final UUID orgId = orgUuid;
 -        Map<String, Object> appInfoMap = new HashMap<String, Object>() {{
 -            put( PROPERTY_NAME, appName );
 -            put( "applicationUuid", appId );
 -            put( "organizationUuid", orgId );
 -        }};
 -
 -        try {
 -            em.create( "appinfo", appInfoMap );
 -        }
 -        catch ( DuplicateUniquePropertyExistsException e ) {
 -            throw new ApplicationAlreadyExistsException( appName );
 -        }
 -        entityIndex.refresh();
 -
 -        // create application entity
          if ( properties == null ) {
 -            properties = new TreeMap<String, Object>( CASE_INSENSITIVE_ORDER );
 +            properties = new TreeMap<>( CASE_INSENSITIVE_ORDER );
          }
          properties.put( PROPERTY_NAME, appName );
          EntityManager appEm = getEntityManager( applicationId);
@@@ -722,15 -724,9 +716,9 @@@
      public void rebuildApplicationIndexes( UUID appId, ProgressObserver po ) throws Exception {
  
          EntityManager em = getEntityManager( appId );
-         ApplicationScope applicationScope = new ApplicationScopeImpl( new SimpleId( CpNamingUtils.SYSTEM_APP_ID, "application" ));
-         //explicitly invoke create index, we don't know if it exists or not in ES during a rebuild.
-         ApplicationEntityIndex applicationEntityIndex = entityIndexFactory.createApplicationEntityIndex(applicationScope);
-         applicationEntityIndex.initializeIndex();
-         em.reindex(po);
- 
          em.reindex( po );
  
 -        logger.info("\n\nRebuilt index for applicationId {} \n", appId );
 +        logger.info("\n\nRebuilt index for applicationId {} \n", appId);
      }
  
  

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/217e7dc1/stack/core/src/main/java/org/apache/usergrid/corepersistence/rx/impl/AllApplicationsObservableImpl.java
----------------------------------------------------------------------
diff --cc stack/core/src/main/java/org/apache/usergrid/corepersistence/rx/impl/AllApplicationsObservableImpl.java
index 8dbea19,b57f088..d872b71
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/rx/impl/AllApplicationsObservableImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/rx/impl/AllApplicationsObservableImpl.java
@@@ -71,20 -69,21 +71,20 @@@ public class AllApplicationsObservableI
  
  
      @Override
-     public Observable<ApplicationScope> getAllApplications() {
+     public Observable<ApplicationScope> getData() {
  
 -        //emit our 3 hard coded applications that are used the manage the system first.
 +        //emit our hard coded applications that are used the manage the system first.
          //this way consumers can perform whatever work they need to on the root system first
 -        final Observable<ApplicationScope> systemIds = Observable.from( Arrays
 -            .asList( getApplicationScope( CpNamingUtils.DEFAULT_APPLICATION_ID ),
 +        final Observable<ApplicationScope> systemIds = Observable.from(
 +            Arrays.asList(
                  getApplicationScope( CpNamingUtils.MANAGEMENT_APPLICATION_ID ),
 -                getApplicationScope( CpNamingUtils.SYSTEM_APP_ID ) ) );
 +                getApplicationScope( CpNamingUtils.SYSTEM_APP_ID ))); // still need deprecated system app here
  
 -
 -        final ApplicationScope appScope = getApplicationScope( CpNamingUtils.SYSTEM_APP_ID );
 +        final ApplicationScope appScope = getApplicationScope( CpNamingUtils.MANAGEMENT_APPLICATION_ID );
  
          final CollectionScope appInfoCollectionScope =
 -                new CollectionScopeImpl( appScope.getApplication(), appScope.getApplication(),
 -                        CpNamingUtils.getCollectionScopeNameFromCollectionName( CpNamingUtils.APPINFOS ) );
 +           new CollectionScopeImpl( appScope.getApplication(), appScope.getApplication(),
 +               CpNamingUtils.getCollectionScopeNameFromCollectionName( CpNamingUtils.APPLICATION_INFOS) );
  
          final EntityCollectionManager collectionManager =
                  entityCollectionManagerFactory.createCollectionManager( appInfoCollectionScope );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/217e7dc1/stack/core/src/test/java/org/apache/usergrid/corepersistence/rx/ApplicationObservableTestIT.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/217e7dc1/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 98640c3,ee28939..6b3a11d
--- 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
@@@ -29,8 -30,12 +30,9 @@@ import org.apache.usergrid.persistence.
  import org.apache.usergrid.persistence.core.util.Health;
  import org.apache.usergrid.persistence.index.*;
  import org.apache.usergrid.persistence.index.exceptions.IndexException;
 -
+ import org.apache.usergrid.persistence.index.migration.IndexDataVersions;
  import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 -
  import org.elasticsearch.action.ActionFuture;
 -
  import org.elasticsearch.action.ShardOperationFailedException;
  import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
  import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;