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/02/22 19:35:28 UTC

[4/5] incubator-usergrid git commit: Merge branch 'USERGRID-273' into app-rebuild-fix

Merge branch 'USERGRID-273' into app-rebuild-fix

Conflicts:
	stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
	stack/services/src/test/java/org/apache/usergrid/management/importer/ImportCollectionIT.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/fe8f4044
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/fe8f4044
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/fe8f4044

Branch: refs/heads/USERGRID-273
Commit: fe8f4044a55e6d43373aaba8e0ee9be312d2a2f1
Parents: 2f077f1 011a5e0
Author: Dave Johnson <dm...@apigee.com>
Authored: Fri Feb 20 15:31:35 2015 -0500
Committer: Dave Johnson <dm...@apigee.com>
Committed: Fri Feb 20 15:31:35 2015 -0500

----------------------------------------------------------------------
 .../src/main/groovy/configure_usergrid.groovy   |   2 +-
 .../main/resources/usergrid-default.properties  |  15 +-
 .../usergrid/corepersistence/CpSetup.java       |   3 +
 .../entities/FailedImportEntity.java            |  11 +-
 .../EntityCollectionManagerFactoryImpl.java     |  37 ++--
 .../collection/mvcc/stage/write/WriteStart.java |  31 ++--
 .../mvcc/stage/TestEntityGenerator.java         |  54 +++---
 .../mvcc/stage/write/WriteStartTest.java        |  51 +++++-
 .../persistence/model/entity/Entity.java        |   5 +
 .../datagenerators/EntityDataGenerator.scala    |  17 +-
 .../datagenerators/FeederGenerator.scala        |  24 ++-
 .../usergrid/scenarios/EntityScenarios.scala    |  20 +-
 .../org/apache/usergrid/settings/Settings.scala |   2 +
 .../PostCustomEntitySimulation.scala            |  27 ++-
 stack/mongo-emulator/pom.xml                    |  15 +-
 stack/pom.xml                                   |  63 ++-----
 stack/rest/README.md                            |  14 +-
 stack/rest/pom.xml                              |  20 +-
 .../org/apache/usergrid/rest/IndexResource.java |  50 +++++
 .../usergrid/rest/filters/MeteringFilter.java   |   2 +
 .../security/SecuredResourceFilterFactory.java  |   2 +
 .../security/shiro/filters/SecurityFilter.java  |   3 +
 .../apache/usergrid/rest/AbstractRestIT.java    |   9 +-
 .../usergrid/rest/DatabaseInitializer.java      | 146 ---------------
 .../rest/management/OrganizationsIT.java        |   2 +-
 .../test/resource2point0/AbstractRestIT.java    |  22 +++
 stack/rest/src/test/resources/arquillian.xml    |  24 ++-
 .../resources/usergrid-deployment.properties    |   2 -
 .../management/export/S3ExportImpl.java         |   6 +-
 .../management/importer/ImportServiceImpl.java  |   5 +-
 .../management/importer/S3ImportImpl.java       |  28 ++-
 .../services/assets/data/BinaryStore.java       |   3 +-
 .../services/assets/data/S3BinaryStore.java     |  18 +-
 .../org/apache/usergrid/ServiceITSetupImpl.java |   1 +
 .../usergrid/management/OrganizationIT.java     |  30 +--
 .../management/export/ExportServiceIT.java      | 183 ++++++++++++-------
 .../importer/FileImportTrackerTest.java         |  55 +++---
 .../management/importer/ImportCollectionIT.java |  73 +++++---
 .../usergrid/management/importer/S3Upload.java  |  18 +-
 .../services/ApplicationsServiceIT.java         |   8 +-
 .../usergrid/services/ServiceInvocationIT.java  |   7 +
 .../src/test/resources/project.properties       |   1 +
 .../usergrid/cassandra/ClearShiroSubject.java   |  18 ++
 43 files changed, 626 insertions(+), 501 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe8f4044/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
----------------------------------------------------------------------
diff --cc stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
index 251e25c,acce2d8..85f27ed
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
@@@ -193,9 -186,9 +193,59 @@@ public class IndexResource extends Abst
          response.setSuccess();
  
          return new JSONWithPadding( response, callback );
+     }
+ 
+     @RequireSystemAccess
++    @PUT
++    @Path( "rebuildinternal" )
++    public JSONWithPadding rebuildInternalIndexes(
++        @Context UriInfo ui,
++        @PathParam( "applicationId" ) String applicationIdStr,
++        @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback,
++        @QueryParam( "delay" ) @DefaultValue( "10" ) final long delay )  throws Exception {
++
++
++        final UUID appId = UUIDUtils.tryExtractUUID(applicationIdStr);
++        ApiResponse response = createApiResponse();
++        response.setAction( "rebuild indexes started" );
++
++        final EntityManagerFactory.ProgressObserver po = new EntityManagerFactory.ProgressObserver() {
++
++            @Override
++            public void onProgress( final EntityRef entity ) {
++                logger.info( "Indexing entity {}:{}", entity.getType(), entity.getUuid() );
++            }
++
++
++            @Override
++            public long getWriteDelayTime() {
++                return delay;
++            }
++        };
++
++        final Thread rebuild = new Thread() {
++
++            @Override
++            public void run() {
++                try {
++                    emf.rebuildInternalIndexes( po );
++                }
++                catch ( Exception e ) {
++                    logger.error( "Unable to re-index internals", e );
++                }
++            }
++        };
++
++        rebuild.setName( String.format( "Index rebuild for app %s", appId ) );
++        rebuild.setDaemon( true );
++        rebuild.start();
++
++        response.setSuccess();
++
++        return new JSONWithPadding( response, callback );
 +    }
 +
 +    @RequireSystemAccess
      @POST
      @Path( RootResource.APPLICATION_ID_PATH )
      public JSONWithPadding addIndex(@Context UriInfo ui,

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe8f4044/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportCollectionIT.java
----------------------------------------------------------------------
diff --cc stack/services/src/test/java/org/apache/usergrid/management/importer/ImportCollectionIT.java
index 7fcfc57,acd3077..d10b611
--- a/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportCollectionIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/importer/ImportCollectionIT.java
@@@ -110,8 -110,9 +110,9 @@@ public class ImportCollectionIT 
          bucketPrefix = System.getProperty( "bucketName" );
  
          // start the scheduler after we're all set up
 -        JobSchedulerService jobScheduler = ConcurrentProcessSingleton
 -            .getInstance().getSpringResource().getBean( JobSchedulerService.class );
 +        JobSchedulerService jobScheduler = ConcurrentProcessSingleton.getInstance()
 +            .getSpringResource().getBean( JobSchedulerService.class );
+ 
          if ( jobScheduler.state() != Service.State.RUNNING ) {
              jobScheduler.startAsync();
              jobScheduler.awaitRunning();
@@@ -480,14 -499,14 +499,14 @@@
  
          logger.debug("\n\nImport into new app {}\n", em.getApplication().getName() );
  
--        ImportService importService = setup.getImportService();
++        final ImportService importService = setup.getImportService();
  
--        Import importEntity = importService.schedule(em.getApplication().getUuid(),
++        final Import importEntity = importService.schedule(em.getApplication().getUuid(),
              new HashMap<String, Object>() {{
 -                put( "path", organization.getName() + em.getApplication().getName() );
 -                put( "organizationId", organization.getUuid() );
 -                put( "applicationId", em.getApplication().getUuid() );
 -                put( "properties", new HashMap<String, Object>() {{
 +            put( "path", organization.getName() + em.getApplication().getName() );
 +            put( "organizationId", organization.getUuid() );
 +            put( "applicationId", em.getApplication().getUuid() );
 +            put( "properties", new HashMap<String, Object>() {{
                  put( "storage_provider", "s3" );
                  put( "storage_info", new HashMap<String, Object>() {{
                      put( "s3_access_id",