You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/08/28 00:15:57 UTC

[02/10] usergrid git commit: fix mappings, equality

fix mappings, equality


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

Branch: refs/heads/two-dot-o-dev
Commit: 81e0fbafde4dcf3c39530eb476f79e079bf66a33
Parents: 5e56f1b
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Aug 20 13:28:49 2015 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Aug 20 13:28:49 2015 -0700

----------------------------------------------------------------------
 .../mvcc/entity/impl/MvccEntityImpl.java        | 28 +++++++-------------
 .../MvccEntitySerializationStrategyV3Impl.java  |  6 +++--
 .../persistence/index/usergrid-mappings.json    |  5 ++++
 3 files changed, 19 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/81e0fbaf/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccEntityImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccEntityImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccEntityImpl.java
index e0066ba..74074d4 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccEntityImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccEntityImpl.java
@@ -38,28 +38,24 @@ public class MvccEntityImpl implements MvccEntity {
     private final UUID version;
     private final Optional<Entity> entity;
     private final Status status;
-    private final long size;
+    private long size;
 
 
     public MvccEntityImpl( final Id entityId, final UUID version, final Status status, final Entity entity ) {
-        this( entityId, version, status, entity, 0 );
+        this(entityId, version, status, Optional.of(entity));
     }
 
-    public MvccEntityImpl( final Id entityId, final UUID version, final Status status, final Entity entity, final long size ) {
-        this( entityId, version, status, Optional.of( entity ), size);
-    }
     public MvccEntityImpl(
-        final Id entityId, final UUID version, final Status status, final Optional<Entity> entity ) {
-        this( entityId, version, status,   entity , 0);
+        final Id entityId, final UUID version, final Status status, final Optional<Entity> entity) {
+        this(entityId,version,status,entity,0);
     }
 
-        public MvccEntityImpl(
-            final Id entityId, final UUID version, final Status status, final Optional<Entity> entity, final long size ) {
-        Preconditions.checkNotNull( entityId, "entity id is required" );
-        Preconditions.checkNotNull( version, "version id is required" );
-        Preconditions.checkNotNull( status, "status  is required" );
-        Preconditions.checkNotNull( entity, "entity  is required" );
-        Preconditions.checkNotNull( size, "size  is required" );
+    public MvccEntityImpl(
+            final Id entityId, final UUID version, final Status status, final Optional<Entity> entity, final long size) {
+        Preconditions.checkNotNull(entityId, "entity id is required");
+        Preconditions.checkNotNull(version, "version id is required");
+        Preconditions.checkNotNull(status, "status  is required");
+        Preconditions.checkNotNull(entity, "entity  is required");
 
         this.entityId = entityId;
         this.version = version;
@@ -119,10 +115,6 @@ public class MvccEntityImpl implements MvccEntity {
             return false;
         }
 
-        if( size != that.size){
-            return false;
-        }
-
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/81e0fbaf/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 2f4c625..df268af 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
@@ -355,7 +355,7 @@ public class MvccEntitySerializationStrategyV3Impl implements MvccEntitySerializ
                 //return an empty entity, we can never load this one, and we don't want it to bring the system
                 //to a grinding halt
                 //TODO fix this
-                return new MvccEntityImpl( id, UUIDGenerator.newTimeUUID(), MvccEntity.Status.DELETED, Optional.<Entity>absent(),0 );
+                return new MvccEntityImpl( id, UUIDGenerator.newTimeUUID(), MvccEntity.Status.DELETED, Optional.<Entity>absent() );
             }
             Optional<Entity> entity = deSerialized.getOptionalEntity() ;
             return new MvccEntityImpl( id, deSerialized.getVersion(), deSerialized.getStatus(), entity, deSerialized.getSize());
@@ -529,7 +529,9 @@ public class MvccEntitySerializationStrategyV3Impl implements MvccEntitySerializ
         @JsonIgnore
         public Optional<Entity> getOptionalEntity() {
             Entity entity = Entity.fromMap(getEntityMap());
-            entity.setSize(getSize());
+            if(entity!=null){
+                entity.setSize(getSize());
+            }
             Optional<Entity> entityReturn = Optional.fromNullable(entity);
             //Inject the id into it.
             if (entityReturn.isPresent()) {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/81e0fbaf/stack/corepersistence/queryindex/src/main/resources/org/apache/usergrid/persistence/index/usergrid-mappings.json
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/resources/org/apache/usergrid/persistence/index/usergrid-mappings.json b/stack/corepersistence/queryindex/src/main/resources/org/apache/usergrid/persistence/index/usergrid-mappings.json
index da8e5d2..1b6a7f3 100644
--- a/stack/corepersistence/queryindex/src/main/resources/org/apache/usergrid/persistence/index/usergrid-mappings.json
+++ b/stack/corepersistence/queryindex/src/main/resources/org/apache/usergrid/persistence/index/usergrid-mappings.json
@@ -7,6 +7,11 @@
                 "index": "not_analyzed",
                 "doc_values": true
             },
+            "entitySize": {
+                "type": "long",
+                "index": "not_analyzed",
+                "doc_values": true
+            },
             "entityVersion": {
                 "type": "string",
                 "index": "not_analyzed",