You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/03/20 00:26:23 UTC
[06/50] [abbrv] incubator-usergrid git commit: Temporary commit,
still refactoring modules and Guice configuration.
Temporary commit, still refactoring modules and Guice configuration.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/e96af464
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/e96af464
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/e96af464
Branch: refs/heads/USERGRID-480
Commit: e96af464bc345d0b718fb34e06774c053af9cb98
Parents: d3f8ee6
Author: Todd Nine <tn...@apigee.com>
Authored: Fri Feb 27 14:50:10 2015 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Fri Feb 27 14:50:10 2015 -0700
----------------------------------------------------------------------
.../collection/guice/CollectionModule.java | 4 +-
.../mvcc/stage/write/WriteCommit.java | 5 +-
.../impl/CollectionDataVersions.java | 44 ++
...vccEntitySerializationStrategyProxyImpl.java | 112 +++--
.../MvccEntitySerializationStrategyV1Impl.java | 6 +
.../MvccEntitySerializationStrategyV2Impl.java | 6 +
.../MvccEntitySerializationStrategyV3Impl.java | 6 +
.../serialization/impl/SerializationModule.java | 75 +++-
.../migration/CollectionMigrationPlugin.java | 9 +-
.../migration/MvccEntityDataMigrationImpl.java | 181 +++++---
.../collection/util/EntityUtils.java | 29 +-
.../collection/guice/TestCollectionModule.java | 12 +-
...ntitySerializationStrategyProxyV1_2Test.java | 82 ----
...ntitySerializationStrategyProxyV1_3Test.java | 28 +-
...cEntitySerializationStrategyProxyV2Test.java | 76 ----
...ntitySerializationStrategyProxyV2_3Test.java | 81 ++++
...ccEntitySerializationStrategyV1ImplTest.java | 10 +-
...ccEntitySerializationStrategyV2ImplTest.java | 8 +-
...ccEntitySerializationStrategyV3ImplTest.java | 4 +-
.../usergrid/persistence/core/guice/V1Impl.java | 37 --
.../persistence/core/guice/V1ProxyImpl.java | 35 --
.../usergrid/persistence/core/guice/V2Impl.java | 39 --
.../usergrid/persistence/core/guice/V3Impl.java | 39 --
.../data/ApplicationDataMigration.java | 32 --
.../migration/data/CollectionDataMigration.java | 30 --
.../migration/data/DataMigrationManager.java | 5 -
.../data/DataMigrationManagerImpl.java | 17 -
.../core/migration/data/MigrationInfoCache.java | 52 +++
.../migration/data/MigrationInfoCacheImpl.java | 84 ++++
.../data/newimpls/MigrationRelationship.java | 61 ++-
.../data/newimpls/VersionedMigrationSet.java | 153 +++++++
.../migration/data/newimpls/VersionedSet.java | 113 -----
.../core/rx/AllEntitiesInSystemObservable.java | 53 ---
.../core/rx/ApplicationObservable.java | 39 --
.../core/guice/MaxMigrationModule.java | 40 --
.../core/guice/MaxMigrationVersion.java | 49 --
.../core/guice/TestCommonModule.java | 8 -
.../persistence/core/guice/TestModule.java | 2 -
.../data/DataMigrationManagerImplTest.java | 443 +++++++++----------
.../data/MigrationInfoSerializationTest.java | 104 ++---
.../newimpls/VersionedMigrationSetTest.java | 194 ++++++++
.../rx/AllEntitiesInSystemTestObservable.java | 39 --
.../core/rx/ApplicationsTestObservable.java | 39 --
43 files changed, 1261 insertions(+), 1224 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
index 8fda6ca..af5c4cf 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
@@ -78,7 +78,7 @@ public class CollectionModule extends AbstractModule {
Multibinder.newSetBinder( binder(), EntityDeleted.class );
// create a guice factor for getting our collection manager
- bind(EntityCollectionManagerFactory.class).to(EntityCollectionManagerFactoryImpl.class);
+ bind(EntityCollectionManagerFactory.class).to(EntityCollectionManagerFactoryImpl.class);
//bind this to our factory
install( new GuicyFigModule( EntityCacheFig.class ) );
@@ -98,6 +98,8 @@ public class CollectionModule extends AbstractModule {
return writeStart;
}
+
+ //TODO USERGRID-405, remove this, it's no longer supported
@Provides
@Singleton
@Inject
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
index 1a90ed8..8889b2f 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
@@ -111,9 +111,7 @@ public class WriteCommit implements Func1<CollectionIoEvent<MvccEntity>, Entity>
logMutation.mergeShallow( entityMutation );
// re-write the unique values but this time with no TTL
- for ( Field field : mvccEntity.getEntity().get().getFields() ) {
-
- if ( field.isUnique() ) {
+ for ( Field field : EntityUtils.getUniqueFields(mvccEntity.getEntity().get()) ) {
UniqueValue written = new UniqueValueImpl( field,
entityId,version);
@@ -124,7 +122,6 @@ public class WriteCommit implements Func1<CollectionIoEvent<MvccEntity>, Entity>
// merge into our existing mutation batch
logMutation.mergeShallow( mb );
- }
}
try {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionDataVersions.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionDataVersions.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionDataVersions.java
new file mode 100644
index 0000000..ee84b1e
--- /dev/null
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionDataVersions.java
@@ -0,0 +1,44 @@
+/*
+ *
+ * *
+ * * 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.collection.serialization.impl;
+
+
+/**
+ * Versions of data as they exist across our system
+ */
+public enum CollectionDataVersions{
+ ONE(1),
+ TWO(2),
+ THREE(3);
+
+ private final int version;
+
+
+ private CollectionDataVersions( final int version ) {this.version = version;}
+
+
+ public int getVersion() {
+ return version;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyImpl.java
index 03271a2..02dfd9d 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyImpl.java
@@ -16,21 +16,27 @@
*/
package org.apache.usergrid.persistence.collection.serialization.impl;
-import com.google.common.base.Optional;
-import com.google.inject.Inject;
-import com.netflix.astyanax.Keyspace;
-import com.netflix.astyanax.MutationBatch;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.UUID;
+
import org.apache.usergrid.persistence.collection.CollectionScope;
import org.apache.usergrid.persistence.collection.EntitySet;
import org.apache.usergrid.persistence.collection.MvccEntity;
-import org.apache.usergrid.persistence.collection.mvcc.MvccEntityMigrationStrategy;
import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.impl.migration.CollectionMigrationPlugin;
import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
-import org.apache.usergrid.persistence.core.migration.data.DataMigrationManager;
-import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
+import org.apache.usergrid.persistence.core.migration.data.MigrationInfoCache;
+import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationRelationship;
+import org.apache.usergrid.persistence.core.migration.data.newimpls.VersionedMigrationSet;
import org.apache.usergrid.persistence.model.entity.Id;
-import java.util.*;
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.netflix.astyanax.Keyspace;
+import com.netflix.astyanax.MutationBatch;
/**
@@ -42,43 +48,49 @@ public class MvccEntitySerializationStrategyProxyImpl implements MvccEntitySeria
protected final Keyspace keyspace;
- private final MigrationInfoSerialization migrationInfoSerialization;
- private final
+ private final VersionedMigrationSet<MvccEntitySerializationStrategy> versions;
+ private final MigrationInfoCache migrationInfoCache;
@Inject
- public MvccEntitySerializationStrategyProxyImpl(final Keyspace keyspace,
- final Set<MvccEntitySerializationStrategy> allVersions,
- final MigrationInfoSerialization migrationInfoSerialization) {
+ public MvccEntitySerializationStrategyProxyImpl( final Keyspace keyspace,
+ final VersionedMigrationSet<MvccEntitySerializationStrategy> allVersions,
+ final MigrationInfoCache migrationInfoCache ) {
this.keyspace = keyspace;
-
- this.migrationInfoSerialization = migrationInfoSerialization;
+ this.migrationInfoCache = migrationInfoCache;
+ this.versions = allVersions;
}
@Override
public MutationBatch write( final CollectionScope context, final MvccEntity entity ) {
- if ( isOldVersion() ) {
+
+ final MigrationRelationship<MvccEntitySerializationStrategy> migration = getMigrationRelationShip();
+
+ if ( migration.needsMigration() ) {
final MutationBatch aggregateBatch = keyspace.prepareMutationBatch();
- aggregateBatch.mergeShallow( previous.write( context, entity ) );
- aggregateBatch.mergeShallow( current.write( context, entity ) );
+ aggregateBatch.mergeShallow( migration.from.write( context, entity ) );
+ aggregateBatch.mergeShallow( migration.to.write( context, entity ) );
return aggregateBatch;
}
- return current.write( context, entity );
+ return migration.to.write( context, entity );
}
@Override
public EntitySet load( final CollectionScope scope, final Collection<Id> entityIds, final UUID maxVersion ) {
- if ( isOldVersion() ) {
- return previous.load( scope, entityIds, maxVersion );
- }
- return current.load( scope, entityIds, maxVersion );
+ final MigrationRelationship<MvccEntitySerializationStrategy> migration = getMigrationRelationShip();
+
+ if ( migration.needsMigration() ) {
+ return migration.from.load( scope, entityIds, maxVersion );
+ }
+
+ return migration.to.load( scope, entityIds, maxVersion );
}
@@ -86,68 +98,84 @@ public class MvccEntitySerializationStrategyProxyImpl implements MvccEntitySeria
@Override
public Iterator<MvccEntity> loadDescendingHistory( final CollectionScope context, final Id entityId,
final UUID version, final int fetchSize ) {
- if ( isOldVersion() ) {
- return previous.loadDescendingHistory( context, entityId, version, fetchSize );
+
+ final MigrationRelationship<MvccEntitySerializationStrategy> migration = getMigrationRelationShip();
+
+ if ( migration.needsMigration()) {
+ return migration.from.loadDescendingHistory( context, entityId, version, fetchSize );
}
- return current.loadDescendingHistory( context, entityId, version, fetchSize );
+ return migration.to.loadDescendingHistory( context, entityId, version, fetchSize );
}
@Override
public Iterator<MvccEntity> loadAscendingHistory( final CollectionScope context, final Id entityId,
final UUID version, final int fetchSize ) {
- if ( isOldVersion() ) {
- return previous.loadAscendingHistory( context, entityId, version, fetchSize );
+
+ final MigrationRelationship<MvccEntitySerializationStrategy> migration = getMigrationRelationShip();
+
+ if ( migration.needsMigration() ) {
+ return migration.from.loadAscendingHistory( context, entityId, version, fetchSize );
}
- return current.loadAscendingHistory( context, entityId, version, fetchSize );
+ return migration.to.loadAscendingHistory( context, entityId, version, fetchSize );
}
@Override
public Optional<MvccEntity> load( final CollectionScope scope, final Id entityId ) {
- if ( isOldVersion() ) {
- return previous.load( scope, entityId );
+
+ final MigrationRelationship<MvccEntitySerializationStrategy> migration = getMigrationRelationShip();
+
+ if ( migration.needsMigration() ) {
+ return migration.from.load( scope, entityId );
}
- return current.load( scope, entityId );
+ return migration.to.load( scope, entityId );
}
@Override
public MutationBatch mark( final CollectionScope context, final Id entityId, final UUID version ) {
- if ( isOldVersion() ) {
+
+ final MigrationRelationship<MvccEntitySerializationStrategy> migration = getMigrationRelationShip();
+
+ if ( migration.needsMigration() ) {
final MutationBatch aggregateBatch = keyspace.prepareMutationBatch();
- aggregateBatch.mergeShallow( previous.mark( context, entityId, version ) );
- aggregateBatch.mergeShallow( current.mark( context, entityId, version ) );
+ aggregateBatch.mergeShallow( migration.from.mark( context, entityId, version ) );
+ aggregateBatch.mergeShallow( migration.to.mark( context, entityId, version ) );
return aggregateBatch;
}
- return current.mark( context, entityId, version );
+ return migration.to.mark( context, entityId, version );
}
@Override
public MutationBatch delete( final CollectionScope context, final Id entityId, final UUID version ) {
- if ( isOldVersion() ) {
+
+ final MigrationRelationship<MvccEntitySerializationStrategy> migration = getMigrationRelationShip();
+
+ if ( migration.needsMigration() ) {
final MutationBatch aggregateBatch = keyspace.prepareMutationBatch();
- aggregateBatch.mergeShallow( previous.delete( context, entityId, version ) );
- aggregateBatch.mergeShallow( current.delete( context, entityId, version ) );
+ aggregateBatch.mergeShallow( migration.from.delete( context, entityId, version ) );
+ aggregateBatch.mergeShallow( migration.to.delete( context, entityId, version ) );
return aggregateBatch;
}
- return current.delete( context, entityId, version );
+ return migration.to.delete( context, entityId, version );
}
/**
* Return true if we're on an old version
*/
- private boolean isOldVersion() {
- return migrationInfoSerialization.getCurrentVersion() < getVersion();
+ private MigrationRelationship<MvccEntitySerializationStrategy> getMigrationRelationShip() {
+ return this.versions.getMigrationRelationship(
+ migrationInfoCache.getVersion( CollectionMigrationPlugin.PLUGIN_NAME ) );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
index 119fb6d..a959508 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
@@ -88,6 +88,12 @@ public class MvccEntitySerializationStrategyV1Impl extends MvccEntitySerializati
}
+ @Override
+ public int getImplementationVersion() {
+ return CollectionDataVersions.ONE.getVersion();
+ }
+
+
public static class EntitySerializer extends AbstractSerializer<EntityWrapper> {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2Impl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2Impl.java
index cd46c1e..04a1fea 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2Impl.java
@@ -91,6 +91,12 @@ public class MvccEntitySerializationStrategyV2Impl extends MvccEntitySerializati
}
+ @Override
+ public int getImplementationVersion() {
+ return CollectionDataVersions.TWO.getVersion();
+ }
+
+
/**
* We should only ever create this once, since this impl is a singleton
*/
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
index 6b60c89..4e73119 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
@@ -381,6 +381,12 @@ public class MvccEntitySerializationStrategyV3Impl implements MvccEntitySerializ
}
+ @Override
+ public int getImplementationVersion() {
+ return CollectionDataVersions.THREE.getVersion();
+ }
+
+
/**
* Simple callback to perform puts and deletes with a common row setup code
*/
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/SerializationModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/SerializationModule.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/SerializationModule.java
index a9c493f..fe804f3 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/SerializationModule.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/SerializationModule.java
@@ -18,23 +18,25 @@
package org.apache.usergrid.persistence.collection.serialization.impl;
-import org.apache.usergrid.persistence.collection.mvcc.MvccEntityMigrationStrategy;
import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
import org.apache.usergrid.persistence.collection.serialization.impl.migration.CollectionMigrationPlugin;
+import org.apache.usergrid.persistence.collection.serialization.impl.migration.EntityIdScope;
import org.apache.usergrid.persistence.collection.serialization.impl.migration.MvccEntityDataMigrationImpl;
import org.apache.usergrid.persistence.core.guice.ProxyImpl;
-import org.apache.usergrid.persistence.core.guice.V1Impl;
-import org.apache.usergrid.persistence.core.guice.V1ProxyImpl;
-import org.apache.usergrid.persistence.core.guice.V2Impl;
-import org.apache.usergrid.persistence.core.guice.V3Impl;
import org.apache.usergrid.persistence.core.migration.data.newimpls.DataMigration2;
import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationPlugin;
+import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationRelationship;
+import org.apache.usergrid.persistence.core.migration.data.newimpls.VersionedMigrationSet;
import org.apache.usergrid.persistence.core.migration.schema.Migration;
import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
import com.google.inject.Key;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
@@ -50,25 +52,27 @@ public class SerializationModule extends AbstractModule {
// bind the serialization strategies
//We've migrated this one, so we need to set up the previous, current, and proxy
- bind( MvccEntitySerializationStrategy.class ).annotatedWith( V1Impl.class )
- .to( MvccEntitySerializationStrategyV1Impl.class );
- bind( MvccEntitySerializationStrategy.class ).annotatedWith( V2Impl.class )
- .to(MvccEntitySerializationStrategyV2Impl.class);
- bind( MvccEntitySerializationStrategy.class ).annotatedWith( V3Impl.class )
- .to(MvccEntitySerializationStrategyV3Impl.class);
- bind(MvccEntitySerializationStrategy.class).annotatedWith(V1ProxyImpl.class)
- .to(MvccEntitySerializationStrategyProxyV1Impl.class);
- bind(MvccEntitySerializationStrategy.class ).annotatedWith(ProxyImpl.class)
- .to(MvccEntitySerializationStrategyProxyV2Impl.class);
+ bind(MvccEntitySerializationStrategy.class).annotatedWith( ProxyImpl.class ).to( MvccEntitySerializationStrategyProxyImpl.class );
- Multibinder<DataMigration2> dataMigrationMultibinder = Multibinder.newSetBinder( binder(), DataMigration2.class );
+
+ //bind all 3 implementations
+ bind(MvccEntitySerializationStrategyV1Impl.class);
+ bind(MvccEntitySerializationStrategyV2Impl.class);
+ bind(MvccEntitySerializationStrategyV3Impl.class);
+
+
+
+ //migrations
+ //we want to make sure our generics are retained, so we use a typeliteral
+ Multibinder<DataMigration2<EntityIdScope>> dataMigrationMultibinder = Multibinder.newSetBinder( binder(), new TypeLiteral<DataMigration2<EntityIdScope>>(){});
dataMigrationMultibinder.addBinding().to( MvccEntityDataMigrationImpl.class );
+ //wire up the collection migration plugin
Multibinder.newSetBinder( binder(), MigrationPlugin.class).addBinding().to( CollectionMigrationPlugin.class );
@@ -78,9 +82,9 @@ public class SerializationModule extends AbstractModule {
//do multibindings for migrations
Multibinder<Migration> uriBinder = Multibinder.newSetBinder( binder(), Migration.class );
- uriBinder.addBinding().to( Key.get( MvccEntitySerializationStrategy.class, V1Impl.class ) );
- uriBinder.addBinding().to( Key.get( MvccEntitySerializationStrategy.class, V2Impl.class ) );
- uriBinder.addBinding().to( Key.get( MvccEntitySerializationStrategy.class, V3Impl.class ) );
+ uriBinder.addBinding().to( Key.get( MvccEntitySerializationStrategyV1Impl.class ) );
+ uriBinder.addBinding().to( Key.get( MvccEntitySerializationStrategyV2Impl.class ) );
+ uriBinder.addBinding().to( Key.get( MvccEntitySerializationStrategyV3Impl.class ) );
uriBinder.addBinding().to( Key.get( MvccLogEntrySerializationStrategy.class ) );
uriBinder.addBinding().to( Key.get( UniqueValueSerializationStrategy.class ) );
@@ -88,4 +92,37 @@ public class SerializationModule extends AbstractModule {
//bind our settings as an eager singleton so it's checked on startup
bind(SettingsValidation.class).asEagerSingleton();
}
+
+
+ /**
+ * Configure via explicit declaration the migration path we can follow
+ * @param v1
+ * @param v2
+ * @param v3
+ * @return
+ */
+ @Singleton
+ @Inject
+ @Provides
+ public VersionedMigrationSet<MvccEntitySerializationStrategy> getVersions(final MvccEntitySerializationStrategyV1Impl v1, final MvccEntitySerializationStrategyV2Impl v2, final MvccEntitySerializationStrategyV3Impl v3){
+
+
+ //we must perform a migration from v1 to v3 in order to maintain consistency
+ MigrationRelationship<MvccEntitySerializationStrategy> v1Tov3 = new MigrationRelationship<>( v1, v3 );
+
+ //we must migrate from 2 to 3, this is a bridge that must happen to maintain data consistency
+
+ MigrationRelationship<MvccEntitySerializationStrategy> v2Tov3 = new MigrationRelationship<>( v2, v3 );
+
+
+ //note that we MUST migrate to v3 before our next migration, if v4 and v5 is implemented we will need a v3->v5 and a v4->v5 set
+ MigrationRelationship<MvccEntitySerializationStrategy> current = new MigrationRelationship<MvccEntitySerializationStrategy>( v3, v3 );
+
+
+ //now create our set of versions
+ VersionedMigrationSet<MvccEntitySerializationStrategy> set = new VersionedMigrationSet<>( v1Tov3, v2Tov3, current );
+
+ return set;
+
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/CollectionMigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/CollectionMigrationPlugin.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/CollectionMigrationPlugin.java
index 5713af7..5d52a9f 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/CollectionMigrationPlugin.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/CollectionMigrationPlugin.java
@@ -31,17 +31,24 @@ import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationDat
import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationPlugin;
import org.apache.usergrid.persistence.core.migration.data.newimpls.ProgressObserver;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
/**
* Migration plugin for the collection module
*/
+@Singleton
public class CollectionMigrationPlugin implements MigrationPlugin {
+ public static final String PLUGIN_NAME = "collections-entity-data";
+
private final DataMigration2<EntityIdScope> entityDataMigration;
private final MigrationDataProvider<EntityIdScope> entityIdScopeDataMigrationProvider;
+ @Inject
public CollectionMigrationPlugin( final DataMigration2<EntityIdScope> entityDataMigration,
final MigrationDataProvider<EntityIdScope> entityIdScopeDataMigrationProvider ) {
this.entityDataMigration = entityDataMigration;
@@ -51,7 +58,7 @@ public class CollectionMigrationPlugin implements MigrationPlugin {
@Override
public String getName() {
- return "collections-entity-data";
+ return PLUGIN_NAME;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
index 73efcba..5250b5c 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
@@ -20,21 +20,28 @@
package org.apache.usergrid.persistence.collection.serialization.impl.migration;
-import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.EntitySet;
import org.apache.usergrid.persistence.collection.MvccEntity;
-import org.apache.usergrid.persistence.collection.mvcc.MvccEntityMigrationStrategy;
import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
+import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.impl.UniqueValueImpl;
+import org.apache.usergrid.persistence.collection.util.EntityUtils;
import org.apache.usergrid.persistence.core.migration.data.DataMigrationException;
+import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
import org.apache.usergrid.persistence.core.migration.data.newimpls.DataMigration2;
import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationDataProvider;
+import org.apache.usergrid.persistence.core.migration.data.newimpls.MigrationRelationship;
import org.apache.usergrid.persistence.core.migration.data.newimpls.ProgressObserver;
-import org.apache.usergrid.persistence.core.migration.schema.MigrationStrategy;
+import org.apache.usergrid.persistence.core.migration.data.newimpls.VersionedMigrationSet;
+import org.apache.usergrid.persistence.model.entity.Entity;
+import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.model.field.Field;
import org.apache.usergrid.persistence.model.util.UUIDGenerator;
import com.google.inject.Inject;
@@ -43,6 +50,7 @@ import com.netflix.astyanax.MutationBatch;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import rx.Observable;
+import rx.Subscriber;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.functions.Func2;
@@ -55,20 +63,28 @@ import rx.schedulers.Schedulers;
public class MvccEntityDataMigrationImpl implements DataMigration2<EntityIdScope> {
private final Keyspace keyspace;
- private final MvccEntityMigrationStrategy entityMigrationStrategy;
+ private final VersionedMigrationSet<MvccEntitySerializationStrategy> allVersions;
+ private final UniqueValueSerializationStrategy uniqueValueSerializationStrategy;
+ private final MigrationInfoSerialization migrationInfoSerialization;
@Inject
- public MvccEntityDataMigrationImpl( Keyspace keyspace, MvccEntityMigrationStrategy serializationStrategy ) {
+ public MvccEntityDataMigrationImpl( final Keyspace keyspace,
+ final VersionedMigrationSet<MvccEntitySerializationStrategy> allVersions,
+ final UniqueValueSerializationStrategy uniqueValueSerializationStrategy,
+ final MigrationInfoSerialization migrationInfoSerialization ) {
this.keyspace = keyspace;
- this.entityMigrationStrategy = serializationStrategy;
+ this.allVersions = allVersions;
+ this.uniqueValueSerializationStrategy = uniqueValueSerializationStrategy;
+ this.migrationInfoSerialization = migrationInfoSerialization;
}
@Override
public int getVersion() {
- return entityMigrationStrategy.getVersion();
+ //get the max implementation version, since that's what we're going to
+ return allVersions.getMaxVersion( migrationInfoSerialization.getVersion( CollectionMigrationPlugin.PLUGIN_NAME ) );
}
@@ -77,85 +93,115 @@ public class MvccEntityDataMigrationImpl implements DataMigration2<EntityIdScope
final AtomicLong atomicLong = new AtomicLong();
-
//capture the time the test starts
final UUID startTime = UUIDGenerator.newTimeUUID();
+ final MigrationRelationship<MvccEntitySerializationStrategy>
+ migration = allVersions.getMigrationRelationship( getCurrentSystemVersion() );
+
final long migrated = migrationDataProvider.getData().subscribeOn( Schedulers.io() )
.parallel( new Func1<Observable<EntityIdScope>, Observable<Long>>() {
//process the ids in parallel
@Override
- public Observable<Long> call(
- final Observable<EntityIdScope>
- entityIdScopeObservable ) {
+ public Observable<Long> call( final Observable<EntityIdScope> entityIdScopeObservable ) {
+
- final MutationBatch totalBatch =
- keyspace.prepareMutationBatch();
+ return entityIdScopeObservable
+ .flatMap( new Func1<EntityIdScope, Observable<EntityToSaveMessage>>() {
- return entityIdScopeObservable.doOnNext(
- new Action1<EntityIdScope>() {
- //load the entity and add it to the toal mutation
@Override
- public void call( final EntityIdScope idScope ) {
+ public Observable<EntityToSaveMessage> call(
+ final EntityIdScope entityIdScope ) {
//load the entity
- MigrationStrategy
- .MigrationRelationship<MvccEntitySerializationStrategy>
- migration = entityMigrationStrategy
- .getMigration();
+ final CollectionScope currentScope = entityIdScope.getCollectionScope();
+
+
+
+ //for each element in our history, we need to copy it to v2. Note that this migration
+ //won't support anything beyond V2
+
+ final Iterator<MvccEntity> allVersions = migration.from
+ .loadAscendingHistory( currentScope, entityIdScope.getId(),
+ startTime, 100 );
+
+ //emit all the entities
+ return Observable.create( new Observable.OnSubscribe<EntityToSaveMessage>() {
+ @Override
+ public void call(
+ final Subscriber<? super EntityToSaveMessage> subscriber ) {
+
+ while ( allVersions.hasNext() ) {
+ final EntityToSaveMessage message =
+ new EntityToSaveMessage( currentScope,
+ allVersions.next() );
+ subscriber.onNext( message );
+ }
+
+ subscriber.onCompleted();
+ }
+ } );
+ }
+ } ).buffer( 100 ).doOnNext( new Action1<List<EntityToSaveMessage>>() {
+ @Override
+ public void call( final List<EntityToSaveMessage> messages ) {
+ atomicLong.addAndGet( messages.size() );
+
+ final MutationBatch totalBatch = keyspace.prepareMutationBatch();
+
+
+ for ( EntityToSaveMessage message : messages ) {
+
+ final MutationBatch entityRewrite =
+ migration.to.write( message.scope, message.entity );
+
+ //add to the total batch
+ totalBatch.mergeShallow( entityRewrite );
+
+ //write the unique values
+ if ( message.entity.getEntity().isPresent() ) {
- CollectionScope currentScope =
- idScope.getCollectionScope();
+ final Entity entity = message.entity.getEntity().get();
- //for each element in the history in the
- // previous
- // version,
- // copy it to the CF in v2
+ final Id entityId = entity.getId();
+ final UUID version = message.entity.getVersion();
- EntitySet allVersions = migration.from()
- .load( currentScope,
- Collections
- .singleton(
- idScope.getId() ),
- startTime );
+ // re-write the unique values but this time with no TTL
+ for ( Field field : EntityUtils
+ .getUniqueFields( message.entity.getEntity().get() ) ) {
- final MvccEntity version = allVersions
- .getEntity( idScope.getId() );
+ UniqueValue written =
+ new UniqueValueImpl( field, entityId, version );
- final MutationBatch versionBatch =
- migration.to().write( currentScope,
- version );
+ MutationBatch mb =
+ uniqueValueSerializationStrategy.write( message.scope, written );
- totalBatch.mergeShallow( versionBatch );
+
+ // merge into our existing mutation batch
+ totalBatch.mergeShallow( mb );
+ }
+
+
+ }
+ }
+
+
+ executeBatch( totalBatch, observer, atomicLong );
}
} )
- //every 100 flush the mutation
- .buffer( 100 ).doOnNext(
- new Action1<List<EntityIdScope>>() {
- @Override
- public void call(
- final List<EntityIdScope> ids ) {
- atomicLong.addAndGet( 100 );
- executeBatch( totalBatch, observer,
- atomicLong );
- }
- } )
//count the results
- .reduce( 0l,
- new Func2<Long, List<EntityIdScope>, Long>
- () {
- @Override
- public Long call( final Long aLong,
- final List<EntityIdScope> ids ) {
- return aLong + ids.size();
- }
- } );
+ .reduce( 0l, new Func2<Long, List<EntityToSaveMessage>, Long>() {
+ @Override
+ public Long call( final Long aLong, final List<EntityToSaveMessage> ids ) {
+ return aLong + ids.size();
+ }
+ } );
}
} ).toBlocking().last();
@@ -176,4 +222,19 @@ public class MvccEntityDataMigrationImpl implements DataMigration2<EntityIdScope
throw new DataMigrationException( "Unable to migrate batches ", e );
}
}
+
+ private int getCurrentSystemVersion(){
+ return migrationInfoSerialization.getVersion( CollectionMigrationPlugin.PLUGIN_NAME );
+ }
+
+ private static final class EntityToSaveMessage{
+ private final CollectionScope scope;
+ private final MvccEntity entity;
+
+
+ private EntityToSaveMessage( final CollectionScope scope, final MvccEntity entity ) {
+ this.scope = scope;
+ this.entity = entity;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/util/EntityUtils.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/util/EntityUtils.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/util/EntityUtils.java
index 6233075..beff3bd 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/util/EntityUtils.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/util/EntityUtils.java
@@ -1,13 +1,16 @@
package org.apache.usergrid.persistence.collection.util;
-import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
import java.util.UUID;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.usergrid.persistence.model.entity.Entity;
import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.model.field.Field;
/**
@@ -16,9 +19,9 @@ import org.apache.usergrid.persistence.model.entity.Id;
public class EntityUtils {
- private static final Field VERSION = FieldUtils.getField( Entity.class, "version", true );
+ private static final java.lang.reflect.Field VERSION = FieldUtils.getField( Entity.class, "version", true );
- private static final Field ID = FieldUtils.getField( Entity.class, "id", true );
+ private static final java.lang.reflect.Field ID = FieldUtils.getField( Entity.class, "id", true );
/**
@@ -46,4 +49,24 @@ public class EntityUtils {
throw new RuntimeException( "Unable to set the field " + ID + " into the entity", e );
}
}
+
+
+ /**
+ * Get all unique fields on an entity
+ * @param entity
+ * @return
+ */
+ public static List<Field> getUniqueFields( Entity entity ) {
+ final Collection<Field> entityFields = entity.getFields();
+
+ //preallocate to max possible for more efficient runtime
+ final List<Field> possibleFields = new ArrayList<>( entityFields.size() );
+
+ for ( Field field : entity.getFields() ) {
+ if ( field.isUnique() ) {
+ possibleFields.add( field );
+ }
+ }
+ return possibleFields;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/guice/TestCollectionModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/guice/TestCollectionModule.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/guice/TestCollectionModule.java
index 06f4565..7e1f32b 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/guice/TestCollectionModule.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/guice/TestCollectionModule.java
@@ -21,23 +21,13 @@ package org.apache.usergrid.persistence.collection.guice;
import org.apache.usergrid.persistence.core.guice.CommonModule;
-import org.apache.usergrid.persistence.core.guice.MaxMigrationModule;
import org.apache.usergrid.persistence.core.guice.TestModule;
-import org.apache.usergrid.persistence.core.rx.AllEntitiesInSystemObservable;
-import org.apache.usergrid.persistence.core.rx.AllEntitiesInSystemTestObservable;
-import org.apache.usergrid.persistence.core.rx.ApplicationObservable;
-import org.apache.usergrid.persistence.core.rx.ApplicationsTestObservable;
public class TestCollectionModule extends TestModule {
@Override
protected void configure() {
- /**
- * Runtime modules
- */
- bind(AllEntitiesInSystemObservable.class).to(AllEntitiesInSystemTestObservable.class);
- bind(ApplicationObservable.class).to(ApplicationsTestObservable.class);
install( new CommonModule() );
install( new CollectionModule() );
@@ -45,7 +35,7 @@ public class TestCollectionModule extends TestModule {
/**
* Test modules
*/
- install(new MaxMigrationModule());
+// install(new MaxMigrationModule());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_2Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_2Test.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_2Test.java
deleted file mode 100644
index 6037317..0000000
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_2Test.java
+++ /dev/null
@@ -1,82 +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.collection.serialization.impl;
-
-
-import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.core.guice.V2Impl;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-
-import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
-import org.apache.usergrid.persistence.core.guice.ProxyImpl;
-import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
-import org.apache.usergrid.persistence.core.test.ITRunner;
-import org.apache.usergrid.persistence.core.test.UseModules;
-
-import com.google.inject.Inject;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-
-@RunWith( ITRunner.class )
-@UseModules( TestCollectionModule.class )
-public class MvccEntitySerializationStrategyProxyV1_2Test extends MvccEntitySerializationStrategyImplTest {
-
- @Inject
- @ProxyImpl
- private MvccEntitySerializationStrategy serializationStrategy;
-
- @Override
- protected MvccEntitySerializationStrategy getMvccEntitySerializationStrategy() {
- return serializationStrategy;
- }
-
- @Inject
- protected MigrationInfoSerialization migrationInfoSerialization;
-
- private int existingVersion;
-
-
- /**
- * We need to run our migration to ensure that we are on the current version, and everything still functions
- * correctly
- */
- @Before
- public void setMigrationVersion() {
- existingVersion = migrationInfoSerialization.getVersion();
-
- //set our version to 0 so it uses both impls of the proxy
- migrationInfoSerialization.setVersion( V2Impl.MIGRATION_VERSION-1 );
- }
-
-
-
-
- @After
- public void reSetMigrationVersion() {
- migrationInfoSerialization.setVersion( existingVersion );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_3Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_3Test.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_3Test.java
index edad4ce..81113b1 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_3Test.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_3Test.java
@@ -20,38 +20,41 @@
package org.apache.usergrid.persistence.collection.serialization.impl;
-import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.core.guice.V1ProxyImpl;
-import org.apache.usergrid.persistence.core.guice.V2Impl;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
+import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.impl.migration.CollectionMigrationPlugin;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
+import org.apache.usergrid.persistence.core.migration.data.newimpls.VersionedMigrationSet;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
import com.google.inject.Inject;
-import static org.junit.Assert.assertTrue;
-
@RunWith( ITRunner.class )
@UseModules( TestCollectionModule.class )
-public class MvccEntitySerializationStrategyProxyV1_3Test extends MvccEntitySerializationStrategyV2Test {
+public class MvccEntitySerializationStrategyProxyV1_3Test extends MvccEntitySerializationStrategyImplTest {
@Inject
- @V1ProxyImpl
+ @ProxyImpl
private MvccEntitySerializationStrategy serializationStrategy;
+ @Inject
+ private MvccEntitySerializationStrategyV1Impl mvccEntitySerializationStrategyV1;
+
+ @Inject
+ private VersionedMigrationSet<MvccEntitySerializationStrategy> migrationSet;
@Override
protected MvccEntitySerializationStrategy getMvccEntitySerializationStrategy() {
return serializationStrategy;
}
-
@Inject
protected MigrationInfoSerialization migrationInfoSerialization;
@@ -64,10 +67,10 @@ public class MvccEntitySerializationStrategyProxyV1_3Test extends MvccEntitySeri
*/
@Before
public void setMigrationVersion() {
- existingVersion = migrationInfoSerialization.getVersion();
+ existingVersion = migrationInfoSerialization.getVersion( CollectionMigrationPlugin.PLUGIN_NAME);
- //set our new version, so that is will run through the new code
- migrationInfoSerialization.setVersion( V2Impl.MIGRATION_VERSION );
+ //set our migration version to be v1
+ migrationInfoSerialization.setVersion( CollectionMigrationPlugin.PLUGIN_NAME, mvccEntitySerializationStrategyV1.getImplementationVersion() );
}
@@ -75,6 +78,7 @@ public class MvccEntitySerializationStrategyProxyV1_3Test extends MvccEntitySeri
@After
public void reSetMigrationVersion() {
- migrationInfoSerialization.setVersion( existingVersion );
+ migrationInfoSerialization.setVersion(CollectionMigrationPlugin.PLUGIN_NAME, existingVersion );
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2Test.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2Test.java
deleted file mode 100644
index 90c34c0..0000000
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2Test.java
+++ /dev/null
@@ -1,76 +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.collection.serialization.impl;
-
-import com.google.inject.Inject;
-import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
-import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.core.guice.ProxyImpl;
-import org.apache.usergrid.persistence.core.guice.V3Impl;
-import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
-import org.apache.usergrid.persistence.core.test.ITRunner;
-import org.apache.usergrid.persistence.core.test.UseModules;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-
-/**
- * Tests migration from 2 -> 3
- */
-
-
-@RunWith( ITRunner.class )
-@UseModules( TestCollectionModule.class )
-public class MvccEntitySerializationStrategyProxyV2Test extends MvccEntitySerializationStrategyV3Test {
-
- @Inject
- @ProxyImpl
- private MvccEntitySerializationStrategy serializationStrategy;
-
-
- @Override
- protected MvccEntitySerializationStrategy getMvccEntitySerializationStrategy() {
- return serializationStrategy;
- }
-
-
- @Inject
- protected MigrationInfoSerialization migrationInfoSerialization;
-
- private int existingVersion;
-
-
- /**
- * We need to run our migration to ensure that we are on the current version, and everything still functions
- * correctly
- */
- @Before
- public void setMigrationVersion() {
- existingVersion = migrationInfoSerialization.getVersion();
-
- //set our new version, so that is will run through the new code
- migrationInfoSerialization.setVersion( V3Impl.MIGRATION_VERSION );
- }
-
-
-
-
- @After
- public void reSetMigrationVersion() {
- migrationInfoSerialization.setVersion( existingVersion );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2_3Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2_3Test.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2_3Test.java
new file mode 100644
index 0000000..da496f7
--- /dev/null
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2_3Test.java
@@ -0,0 +1,81 @@
+/*
+ * 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.collection.serialization.impl;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+
+import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
+import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.impl.migration.CollectionMigrationPlugin;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
+import org.apache.usergrid.persistence.core.migration.data.MigrationInfoSerialization;
+import org.apache.usergrid.persistence.core.test.ITRunner;
+import org.apache.usergrid.persistence.core.test.UseModules;
+
+import com.google.inject.Inject;
+
+
+@RunWith( ITRunner.class )
+@UseModules( TestCollectionModule.class )
+public class MvccEntitySerializationStrategyProxyV2_3Test extends MvccEntitySerializationStrategyV2Test {
+
+ @Inject
+ @ProxyImpl
+ private MvccEntitySerializationStrategy serializationStrategy;
+
+ @Inject
+ private MvccEntitySerializationStrategyV2Impl v2Impl;
+
+
+ @Override
+ protected MvccEntitySerializationStrategy getMvccEntitySerializationStrategy() {
+ return serializationStrategy;
+ }
+
+
+ @Inject
+ protected MigrationInfoSerialization migrationInfoSerialization;
+
+ private int existingVersion;
+
+
+ /**
+ * We need to run our migration to ensure that we are on the current version, and everything still functions
+ * correctly
+ */
+ @Before
+ public void setMigrationVersion() {
+ existingVersion = migrationInfoSerialization.getVersion( CollectionMigrationPlugin.PLUGIN_NAME);
+
+ //set our new version, so that is will run through the new code
+ migrationInfoSerialization.setVersion( CollectionMigrationPlugin.PLUGIN_NAME, v2Impl.getImplementationVersion() );
+ }
+
+
+
+
+ @After
+ public void reSetMigrationVersion() {
+ migrationInfoSerialization.setVersion(CollectionMigrationPlugin.PLUGIN_NAME, existingVersion );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1ImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1ImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1ImplTest.java
index 1214e0e..d4d6fb5 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1ImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1ImplTest.java
@@ -20,28 +20,22 @@
package org.apache.usergrid.persistence.collection.serialization.impl;
-import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
import org.junit.runner.RunWith;
import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
-import org.apache.usergrid.persistence.core.guice.V1Impl;
+import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
import com.google.inject.Inject;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
@RunWith( ITRunner.class )
@UseModules( TestCollectionModule.class )
public class MvccEntitySerializationStrategyV1ImplTest extends MvccEntitySerializationStrategyImplTest {
@Inject
- @V1Impl
- private MvccEntitySerializationStrategy serializationStrategy;
+ private MvccEntitySerializationStrategyV1Impl serializationStrategy;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2ImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2ImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2ImplTest.java
index 6a70273..97bcb1f 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2ImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2ImplTest.java
@@ -20,26 +20,22 @@
package org.apache.usergrid.persistence.collection.serialization.impl;
-import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
import org.junit.runner.RunWith;
import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
-import org.apache.usergrid.persistence.core.guice.V2Impl;
+import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
import com.google.inject.Inject;
-import static org.junit.Assert.assertTrue;
-
@RunWith( ITRunner.class )
@UseModules( TestCollectionModule.class )
public class MvccEntitySerializationStrategyV2ImplTest extends MvccEntitySerializationStrategyV2Test {
@Inject
- @V2Impl
- private MvccEntitySerializationStrategy serializationStrategy;
+ private MvccEntitySerializationStrategyV2Impl serializationStrategy;
@Override
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3ImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3ImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3ImplTest.java
index 8ace3ff..b30e901 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3ImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3ImplTest.java
@@ -10,7 +10,6 @@ import org.apache.usergrid.persistence.collection.CollectionScope;
import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.core.guice.V3Impl;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.test.UseModules;
import org.apache.usergrid.persistence.model.entity.Id;
@@ -30,8 +29,7 @@ import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
@UseModules( TestCollectionModule.class )
public class MvccEntitySerializationStrategyV3ImplTest extends MvccEntitySerializationStrategyV3Test {
@Inject
- @V3Impl
- private MvccEntitySerializationStrategy serializationStrategy;
+ private MvccEntitySerializationStrategyV3Impl serializationStrategy;
@Override
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V1Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V1Impl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V1Impl.java
deleted file mode 100644
index 4fba781..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V1Impl.java
+++ /dev/null
@@ -1,37 +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.core.guice;
-
-import com.google.inject.BindingAnnotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * Represents 2 versions of an impl. Generally used for online migration. This represents the version that is the
- * current version of the implementation. I.E the "new" version.
- */
-@BindingAnnotation
-@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
-public @interface V1Impl {}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V1ProxyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V1ProxyImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V1ProxyImpl.java
deleted file mode 100644
index e1e7741..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V1ProxyImpl.java
+++ /dev/null
@@ -1,35 +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.core.guice;
-
-import com.google.inject.BindingAnnotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * V1 proxy annotation
- */
-@BindingAnnotation
-@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
-public @interface V1ProxyImpl {
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V2Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V2Impl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V2Impl.java
deleted file mode 100644
index 0ee87f0..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V2Impl.java
+++ /dev/null
@@ -1,39 +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.core.guice;
-
-import com.google.inject.BindingAnnotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * Represents 2 versions of an impl. Generally used for online migration. This represents the version that is the
- * current version of the implementation. I.E the "new" version.
- */
-@BindingAnnotation
-@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
-public @interface V2Impl {
- public static final int MIGRATION_VERSION = 3;
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V3Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V3Impl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V3Impl.java
deleted file mode 100644
index aef3a9a..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/V3Impl.java
+++ /dev/null
@@ -1,39 +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.core.guice;
-
-import com.google.inject.BindingAnnotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * Represents 2 versions of an impl. Generally used for online migration. This represents the version that is the
- * current version of the implementation. I.E the "new" version.
- */
-@BindingAnnotation
-@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
-public @interface V3Impl {
- public static final int MIGRATION_VERSION = 4;
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/ApplicationDataMigration.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/ApplicationDataMigration.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/ApplicationDataMigration.java
deleted file mode 100644
index bbff0b9..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/ApplicationDataMigration.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *
- * * Licensed to the Apache Software Foundation (ASF) under one or more
- * * contributor license agreements. 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. For additional information regarding
- * * copyright in this work, please see the NOTICE file in the top level
- * * directory of this distribution.
- *
- */
-package org.apache.usergrid.persistence.core.migration.data;
-
-import org.apache.usergrid.persistence.core.scope.ApplicationEntityGroup;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-
-
-/**
- * Migrate applications
- */
-public interface ApplicationDataMigration extends DataMigration<ApplicationScope> {
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/CollectionDataMigration.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/CollectionDataMigration.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/CollectionDataMigration.java
deleted file mode 100644
index df1af72..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/CollectionDataMigration.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * * Licensed to the Apache Software Foundation (ASF) under one or more
- * * contributor license agreements. 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. For additional information regarding
- * * copyright in this work, please see the NOTICE file in the top level
- * * directory of this distribution.
- *
- */
-package org.apache.usergrid.persistence.core.migration.data;
-
-import org.apache.usergrid.persistence.core.scope.ApplicationEntityGroup;
-
-
-/**
- * Migrate Collections
- */
-public interface CollectionDataMigration extends DataMigration<ApplicationEntityGroup> {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManager.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManager.java
index 1ca8d90..7ddc6e1 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManager.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManager.java
@@ -54,11 +54,6 @@ public interface DataMigrationManager {
*/
public void resetToVersion(final String pluginName, final int version);
- /**
- * Invalidate the cache for versions
- */
- public void invalidate();
-
/**
* Return that last status of the migration
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e96af464/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManagerImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManagerImpl.java
index ddb0a61..41e76e8 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManagerImpl.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/DataMigrationManagerImpl.java
@@ -51,18 +51,6 @@ public class DataMigrationManagerImpl implements DataMigrationManager {
private final MigrationInfoSerialization migrationInfoSerialization;
- /**
- * Cache to cache versions temporarily
- */
- private final LoadingCache<String, Integer> versionCache = CacheBuilder.newBuilder()
- //cache the local value for 1 minute
- .expireAfterWrite( 1, TimeUnit.MINUTES ).build( new CacheLoader<String, Integer>() {
- @Override
- public Integer load( final String key ) throws Exception {
- return migrationInfoSerialization.getVersion( key );
- }
- } );
-
@Inject
public DataMigrationManagerImpl( final Set<MigrationPlugin> plugins,
@@ -121,11 +109,6 @@ public class DataMigrationManagerImpl implements DataMigrationManager {
}
- @Override
- public void invalidate() {
- versionCache.invalidateAll();
- }
-
@Override
public int getCurrentVersion( final String pluginName ) {