You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/06/29 19:40:55 UTC

[43/50] [abbrv] incubator-usergrid git commit: don't increment unless you move something

don't increment unless you move something


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

Branch: refs/heads/USERGRID-703
Commit: 915bf95ef4b313dd29fe39a8dd06137c2208ff1b
Parents: fca5751
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Jun 24 19:00:15 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Jun 24 19:00:15 2015 -0600

----------------------------------------------------------------------
 .../corepersistence/migration/AppInfoMigrationPlugin.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/915bf95e/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
index a22bea6..2deb4f6 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
@@ -47,6 +47,8 @@ import rx.Observable;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 
 import static org.apache.usergrid.corepersistence.util.CpNamingUtils.getApplicationScope;
 import static org.apache.usergrid.persistence.Schema.*;
@@ -119,12 +121,14 @@ public class AppInfoMigrationPlugin implements MigrationPlugin {
         }
 
         observer.start();
+        AtomicInteger count = new AtomicInteger();
         //get old app infos to migrate
         final Observable<org.apache.usergrid.persistence.model.entity.Entity> oldAppInfos = getOldAppInfos();
         oldAppInfos
             .doOnNext(oldAppInfoEntity -> {
                 try {
                     migrateAppInfo( oldAppInfoEntity, observer);
+                    count.incrementAndGet();
                 }catch (Exception e){
                     logger.error("Failed to migrate app info"+oldAppInfoEntity.getId().getUuid(),e);
                     throw new RuntimeException(e);
@@ -132,7 +136,9 @@ public class AppInfoMigrationPlugin implements MigrationPlugin {
 
             })
             .doOnCompleted(() -> {
-                migrationInfoSerialization.setVersion(getName(), getMaxVersion());
+                if(count.get()>0) {
+                    migrationInfoSerialization.setVersion(getName(), getMaxVersion());
+                }
                 observer.complete();
             }).toBlocking().lastOrDefault(null);