usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject usergrid git commit: Ensure that bootstrap is not resetting versions and let each migration module be handled separately and versions set backwards manually.
Date Fri, 26 Feb 2016 17:29:41 GMT
Repository: usergrid
Updated Branches:
  refs/heads/release-2.1.1 2d1110250 -> f69e4f6ff


Ensure that bootstrap is not resetting versions and let each migration module be handled separately
and versions set backwards manually.


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

Branch: refs/heads/release-2.1.1
Commit: f69e4f6ff16527b9fea4f03f934417d0a6b6a3a7
Parents: 2d11102
Author: Michael Russo <mrusso@apigee.com>
Authored: Fri Feb 26 09:29:01 2016 -0800
Committer: Michael Russo <mrusso@apigee.com>
Committed: Fri Feb 26 09:29:01 2016 -0800

----------------------------------------------------------------------
 .../usergrid/corepersistence/CoreModule.java    |   2 -
 .../corepersistence/CpEntityManager.java        |  11 -
 .../migration/MigrationModuleVersionPlugin.java | 137 ----------
 .../MigrationModuleVersionPluginTest.java       | 259 -------------------
 .../applications/ApplicationResource.java       |   8 -
 5 files changed, 417 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/f69e4f6f/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
index e2d845f..5ac7faf 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
@@ -40,7 +40,6 @@ import org.apache.usergrid.corepersistence.index.ReIndexServiceImpl;
 import org.apache.usergrid.corepersistence.migration.CoreMigration;
 import org.apache.usergrid.corepersistence.migration.CoreMigrationPlugin;
 import org.apache.usergrid.corepersistence.migration.DeDupConnectionDataMigration;
-import org.apache.usergrid.corepersistence.migration.MigrationModuleVersionPlugin;
 import org.apache.usergrid.corepersistence.pipeline.PipelineModule;
 import org.apache.usergrid.corepersistence.rx.impl.AllApplicationsObservable;
 import org.apache.usergrid.corepersistence.rx.impl.AllApplicationsObservableImpl;
@@ -144,7 +143,6 @@ public class CoreModule extends AbstractModule {
         //wire up the collection migration plugin
         final Multibinder<MigrationPlugin> plugins = Multibinder.newSetBinder( binder(),
MigrationPlugin.class );
         plugins.addBinding().to( CoreMigrationPlugin.class );
-        plugins.addBinding().to( MigrationModuleVersionPlugin.class );
 
         bind( AllApplicationsObservable.class ).to( AllApplicationsObservableImpl.class );
         bind( AllEntityIdsObservable.class ).to( AllEntityIdsObservableImpl.class );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/f69e4f6f/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index 2cf8da6..3dbdb7d 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -747,17 +747,6 @@ public class CpEntityManager implements EntityManager {
 
         Set<String> existingCollections = getRelationManager( getApplication() ).getCollections();
 
-        //Handles reading custom collections.
-//        Set<String> dynamic_collections = cast( getDictionaryAsSet( getApplicationRef(),
Schema.DICTIONARY_COLLECTIONS ) );
-//        if ( dynamic_collections != null ) {
-//            for ( String collection : dynamic_collections ) {
-//                if ( !Schema.isAssociatedEntityType( collection ) ) {
-//                    if(!existingCollections.contains( collection )) {
-//                        existingCollections.add( collection );
-//                    }
-//                }
-//            }
-//        }
         Set<String> system_collections = Schema.getDefaultSchema().getCollectionNames(
Application.ENTITY_TYPE );
         if ( system_collections != null ) {
             for ( String collection : system_collections ) {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/f69e4f6f/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPlugin.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPlugin.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPlugin.java
deleted file mode 100644
index 145e76f..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPlugin.java
+++ /dev/null
@@ -1,137 +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.corepersistence.migration;
-
-
-import org.apache.usergrid.persistence.collection.serialization.impl.MvccEntitySerializationStrategyV2Impl;
-import org.apache.usergrid.persistence.collection.serialization.impl.migration.CollectionMigrationPlugin;
-import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
-import org.apache.usergrid.persistence.core.migration.data.MigrationPlugin;
-import org.apache.usergrid.persistence.core.migration.data.PluginPhase;
-import org.apache.usergrid.persistence.core.migration.data.ProgressObserver;
-import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV2Impl;
-import org.apache.usergrid.persistence.graph.serialization.impl.migration.GraphMigrationPlugin;
-
-import com.google.inject.Inject;
-
-
-/**
- * Migration to set our module versions now that we've refactor for sub modules Keeps the
EntityIdScope because it won't
- * subscribe to the data provider.
- */
-public class MigrationModuleVersionPlugin implements MigrationPlugin{
-
-    public static final String NAME = "migration-system";
-
-    private static final int INITIAL = 0;
-    /**
-     * The migration from 0 -> 1 that re-writes all the entity id's into the map module
-     */
-    private static final int ID_MIGRATION = 1;
-
-    /**
-     * The migration from 1-> 2 that shards our edge meta data
-     */
-    private static final int EDGE_SHARD_MIGRATION = 2;
-
-    /**
-     * The migration from 2-> 3 that fixed the short truncation bug
-     */
-    private static final int ENTITY_V2_MIGRATION = 3;
-
-
-    /**
-     * Get versions directly from impls so we know they're accurate
-     */
-    private final MigrationInfoSerialization migrationInfoSerialization;
-
-    private final MvccEntitySerializationStrategyV2Impl serializationStrategyV2;
-
-    private final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2;
-
-
-    @Inject
-    public MigrationModuleVersionPlugin( final MigrationInfoSerialization migrationInfoSerialization,
-                                         final MvccEntitySerializationStrategyV2Impl serializationStrategyV2,
-                                         final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2
) {
-        this.migrationInfoSerialization = migrationInfoSerialization;
-        this.serializationStrategyV2 = serializationStrategyV2;
-        this.edgeMetadataSerializationV2 = edgeMetadataSerializationV2;
-    }
-
-    @Override
-      public void run( final ProgressObserver observer ) {
-
-
-        observer.start();
-
-        //we ignore our current version, since it will always be 0
-        final int legacyVersion = migrationInfoSerialization.getSystemVersion();
-
-
-
-        //now we store versions for each of our modules
-
-        switch ( legacyVersion ) {
-
-            //we need to set the version of the entity data, and our edge shard migration.
 The fall through (no break) is deliberate
-            //if it's entity v2, set all, it's current
-            case ENTITY_V2_MIGRATION:
-               migrationInfoSerialization.setVersion(
-                   CollectionMigrationPlugin.PLUGIN_NAME, serializationStrategyV2.getImplementationVersion()
);
-
-            //if it's edge shard, we need to run the v2 migration
-            case EDGE_SHARD_MIGRATION:
-                //set our shard migration to the migrated version
-                migrationInfoSerialization.setVersion(
-                    GraphMigrationPlugin.PLUGIN_NAME, edgeMetadataSerializationV2.getImplementationVersion()
);
-
-            case ID_MIGRATION:
-                migrationInfoSerialization.setVersion(
-                    CoreMigrationPlugin.PLUGIN_NAME, CoreDataVersions.ID_MAP_FIX.getVersion()
);
-        }
-
-        //save the version
-        migrationInfoSerialization.setVersion( NAME, getMaxVersion() );
-
-        observer.complete();
-      }
-
-
-
-    @Override
-    public String getName() {
-        return NAME;
-    }
-
-
-
-
-    @Override
-    public int getMaxVersion() {
-        return MigrationSystemVersions.LEGACY_ID_MAPPED.getVersion();
-    }
-
-
-    @Override
-    public PluginPhase getPhase() {
-        return PluginPhase.BOOTSTRAP;
-    }
-}

http://git-wip-us.apache.org/repos/asf/usergrid/blob/f69e4f6f/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPluginTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPluginTest.java
b/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPluginTest.java
deleted file mode 100644
index 339e6cf..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/MigrationModuleVersionPluginTest.java
+++ /dev/null
@@ -1,259 +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.corepersistence.migration;
-
-
-import org.junit.Test;
-
-import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.serialization.impl.MvccEntitySerializationStrategyV2Impl;
-import org.apache.usergrid.persistence.collection.serialization.impl.migration.CollectionMigrationPlugin;
-import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
-import org.apache.usergrid.persistence.core.migration.data.TestProgressObserver;
-import org.apache.usergrid.persistence.graph.serialization.EdgeMetadataSerialization;
-import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV2Impl;
-import org.apache.usergrid.persistence.graph.serialization.impl.migration.GraphMigrationPlugin;
-
-import com.google.inject.Inject;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-
-/**
- * Tests the system sets itself up as wxpected
- */
-public class MigrationModuleVersionPluginTest {
-
-
-    @Test
-    public void testNewSystem(){
-
-        //mock up an initial system state
-        final int systemState = 3;
-
-        final MigrationInfoSerialization migrationInfoSerialization = mock(MigrationInfoSerialization.class);
-
-        when(migrationInfoSerialization.getSystemVersion()).thenReturn( systemState );
-
-
-
-
-        final int mvccVersion = 2;
-
-        final MvccEntitySerializationStrategyV2Impl serializationStrategyV2 = mock(MvccEntitySerializationStrategyV2Impl.class);
-        when(serializationStrategyV2.getImplementationVersion()).thenReturn( mvccVersion
);
-
-
-        final int edgeMetaVersion = 1;
-
-        final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2 = mock(EdgeMetadataSerializationV2Impl.class);
-        when(edgeMetadataSerializationV2.getImplementationVersion()).thenReturn(edgeMetaVersion);
-
-
-        final MigrationModuleVersionPlugin plugin = new MigrationModuleVersionPlugin(migrationInfoSerialization,
serializationStrategyV2,  edgeMetadataSerializationV2 );
-
-        final TestProgressObserver testProgressObserver = new TestProgressObserver();
-
-        plugin.run( testProgressObserver );
-
-
-
-        //first version that should be set
-        verify(migrationInfoSerialization).setVersion( CoreMigrationPlugin.PLUGIN_NAME, CoreDataVersions.ID_MAP_FIX.getVersion()
);
-
-        //second version that should be set
-
-        verify(migrationInfoSerialization).setVersion( GraphMigrationPlugin.PLUGIN_NAME,
edgeMetaVersion );
-
-        //last version that should be set
-        verify(migrationInfoSerialization).setVersion( CollectionMigrationPlugin.PLUGIN_NAME,
mvccVersion );
-
-
-        //set this plugin as run
-        verify(migrationInfoSerialization).setVersion( MigrationModuleVersionPlugin.NAME,
MigrationSystemVersions.LEGACY_ID_MAPPED.getVersion() );
-
-
-
-    }
-
-
-
-    @Test
-    public void testIdMapping(){
-
-           //mock up an initial system state
-        final int systemState = 1;
-
-        final MigrationInfoSerialization migrationInfoSerialization = mock(MigrationInfoSerialization.class);
-
-        when(migrationInfoSerialization.getSystemVersion()).thenReturn( systemState );
-
-
-
-
-        final int mvccVersion = 2;
-
-        final MvccEntitySerializationStrategyV2Impl serializationStrategyV2 = mock(MvccEntitySerializationStrategyV2Impl.class);
-        when(serializationStrategyV2.getImplementationVersion()).thenReturn( mvccVersion
);
-
-
-        final int edgeMetaVersion = 1;
-
-        final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2 = mock(EdgeMetadataSerializationV2Impl.class);
-        when(edgeMetadataSerializationV2.getImplementationVersion()).thenReturn(edgeMetaVersion);
-
-
-        final MigrationModuleVersionPlugin plugin = new MigrationModuleVersionPlugin(migrationInfoSerialization,
serializationStrategyV2,  edgeMetadataSerializationV2 );
-
-        final TestProgressObserver testProgressObserver = new TestProgressObserver();
-
-        plugin.run( testProgressObserver );
-
-
-        //first version that should be set
-        verify(migrationInfoSerialization).setVersion( CoreMigrationPlugin.PLUGIN_NAME, CoreDataVersions.ID_MAP_FIX.getVersion()
);
-
-        //second version that should be set
-
-        verify(migrationInfoSerialization, never()).setVersion( GraphMigrationPlugin.PLUGIN_NAME,
edgeMetaVersion );
-
-        //last version that should be set
-        verify(migrationInfoSerialization, never()).setVersion( CollectionMigrationPlugin.PLUGIN_NAME,
mvccVersion );
-
-
-        //set this plugin as run
-        verify(migrationInfoSerialization).setVersion( MigrationModuleVersionPlugin.NAME,
MigrationSystemVersions.LEGACY_ID_MAPPED.getVersion() );
-
-
-
-
-    }
-
-
-    @Test
-    public void testEdgeMigration(){
-
-           //mock up an initial system state
-        final int systemState = 2;
-
-        final MigrationInfoSerialization migrationInfoSerialization = mock(MigrationInfoSerialization.class);
-
-        when(migrationInfoSerialization.getSystemVersion()).thenReturn( systemState );
-
-
-
-
-        final int mvccVersion = 2;
-
-        final MvccEntitySerializationStrategyV2Impl serializationStrategyV2 = mock(MvccEntitySerializationStrategyV2Impl.class);
-        when(serializationStrategyV2.getImplementationVersion()).thenReturn( mvccVersion
);
-
-
-        final int edgeMetaVersion = 1;
-
-        final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2 = mock(EdgeMetadataSerializationV2Impl.class);
-        when(edgeMetadataSerializationV2.getImplementationVersion()).thenReturn(edgeMetaVersion);
-
-
-        final MigrationModuleVersionPlugin plugin = new MigrationModuleVersionPlugin(migrationInfoSerialization,
serializationStrategyV2,  edgeMetadataSerializationV2 );
-
-        final TestProgressObserver testProgressObserver = new TestProgressObserver();
-
-        plugin.run( testProgressObserver );
-
-
-        //first version that should be set
-        verify(migrationInfoSerialization).setVersion( CoreMigrationPlugin.PLUGIN_NAME, CoreDataVersions.ID_MAP_FIX.getVersion()
);
-
-        //second version that should be set
-
-        verify(migrationInfoSerialization).setVersion( GraphMigrationPlugin.PLUGIN_NAME,
edgeMetaVersion );
-
-        //last version that should be set
-        verify(migrationInfoSerialization, never()).setVersion( CollectionMigrationPlugin.PLUGIN_NAME,
mvccVersion );
-
-
-        //set this plugin as run
-        verify(migrationInfoSerialization).setVersion( MigrationModuleVersionPlugin.NAME,
MigrationSystemVersions.LEGACY_ID_MAPPED.getVersion() );
-
-
-
-
-    }
-
-
-
-
-    @Test
-    public void testEntityV2Migration(){
-
-           //mock up an initial system state
-        final int systemState = 3;
-
-        final MigrationInfoSerialization migrationInfoSerialization = mock(MigrationInfoSerialization.class);
-
-        when(migrationInfoSerialization.getSystemVersion()).thenReturn( systemState );
-
-
-
-
-        final int mvccVersion = 2;
-
-        final MvccEntitySerializationStrategyV2Impl serializationStrategyV2 = mock(MvccEntitySerializationStrategyV2Impl.class);
-        when(serializationStrategyV2.getImplementationVersion()).thenReturn( mvccVersion
);
-
-
-        final int edgeMetaVersion = 1;
-
-        final EdgeMetadataSerializationV2Impl edgeMetadataSerializationV2 = mock(EdgeMetadataSerializationV2Impl.class);
-        when(edgeMetadataSerializationV2.getImplementationVersion()).thenReturn(edgeMetaVersion);
-
-
-        final MigrationModuleVersionPlugin plugin = new MigrationModuleVersionPlugin(migrationInfoSerialization,
serializationStrategyV2,  edgeMetadataSerializationV2 );
-
-        final TestProgressObserver testProgressObserver = new TestProgressObserver();
-
-        plugin.run( testProgressObserver );
-
-
-        //first version that should be set
-        verify(migrationInfoSerialization).setVersion( CoreMigrationPlugin.PLUGIN_NAME, CoreDataVersions.ID_MAP_FIX.getVersion()
);
-
-        //second version that should be set
-
-        verify(migrationInfoSerialization).setVersion( GraphMigrationPlugin.PLUGIN_NAME,
edgeMetaVersion );
-
-        //last version that should be set
-        verify(migrationInfoSerialization).setVersion( CollectionMigrationPlugin.PLUGIN_NAME,
mvccVersion );
-
-
-        //set this plugin as run
-        verify(migrationInfoSerialization).setVersion( MigrationModuleVersionPlugin.NAME,
MigrationSystemVersions.LEGACY_ID_MAPPED.getVersion() );
-
-
-
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/usergrid/blob/f69e4f6f/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
index 61a7e0a..c353959 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
@@ -496,14 +496,6 @@ public class ApplicationResource extends AbstractContextResource {
                 "Cannot delete application without supplying correct application name");
         }
 
-//        Properties props = management.getProperties();
-//
-//         //for now, only works in test mode
-//        String testProp = ( String ) props.get( "usergrid.test" );
-//        if ( testProp == null || !Boolean.parseBoolean( testProp ) ) {
-//            throw new UnsupportedRestOperationException("Test props not not functioning
correctly.");
-//        }
-
         if ( applicationId == null ) {
             throw new IllegalArgumentException("Application ID not specified in request");
         }


Mime
View raw message