gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alfonsonishik...@apache.org
Subject [1/4] gora git commit: adding fix for GORA-401
Date Thu, 22 Sep 2016 23:18:14 GMT
Repository: gora
Updated Branches:
  refs/heads/master 0f11da5cb -> 3796843b0


adding fix for GORA-401


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

Branch: refs/heads/master
Commit: ac6c42b37385fd05fa9776e53d6de41320a202c4
Parents: 882fac9
Author: Kevin <djkevincr@yahoo.com>
Authored: Sun Sep 18 22:01:12 2016 +0530
Committer: Kevin <djkevincr@yahoo.com>
Committed: Sun Sep 18 22:01:12 2016 +0530

----------------------------------------------------------------------
 .../java/org/apache/gora/mapreduce/PersistentDeserializer.java | 6 +++++-
 .../java/org/apache/gora/mapreduce/PersistentSerializer.java   | 2 +-
 gora-core/src/test/java/org/apache/gora/util/TestIOUtils.java  | 5 +++++
 3 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/ac6c42b3/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentDeserializer.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentDeserializer.java
b/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentDeserializer.java
index 79eee42..8a957b9 100644
--- a/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentDeserializer.java
+++ b/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentDeserializer.java
@@ -68,6 +68,10 @@ public class PersistentDeserializer
 
   @Override
   public PersistentBase deserialize(PersistentBase persistent) throws IOException {
-    return datumReader.read(reuseObjects ? persistent : null, decoder);
+    persistent = datumReader.read(reuseObjects ? persistent : null, decoder);
+    byte[] __g__dirty = new byte[persistent.getFieldsCount()];
+    decoder.readFixed(__g__dirty);
+    persistent.setDirtyBytes(java.nio.ByteBuffer.wrap(__g__dirty));
+    return persistent;
   }
 }

http://git-wip-us.apache.org/repos/asf/gora/blob/ac6c42b3/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentSerializer.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentSerializer.java b/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentSerializer.java
index b75d1dd..1851ff5 100644
--- a/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentSerializer.java
+++ b/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentSerializer.java
@@ -63,7 +63,7 @@ public class PersistentSerializer implements Serializer<PersistentBase>
{
   @Override
   public void serialize(PersistentBase persistent) throws IOException {
     datumWriter.setSchema(persistent.getSchema());
-        
     datumWriter.write(persistent, encoder);
+    encoder.writeFixed(persistent.getDirtyBytes().array());
   }
 }

http://git-wip-us.apache.org/repos/asf/gora/blob/ac6c42b3/gora-core/src/test/java/org/apache/gora/util/TestIOUtils.java
----------------------------------------------------------------------
diff --git a/gora-core/src/test/java/org/apache/gora/util/TestIOUtils.java b/gora-core/src/test/java/org/apache/gora/util/TestIOUtils.java
index d0f3e1c..ec2a791 100644
--- a/gora-core/src/test/java/org/apache/gora/util/TestIOUtils.java
+++ b/gora-core/src/test/java/org/apache/gora/util/TestIOUtils.java
@@ -30,6 +30,7 @@ import java.util.Arrays;
 import org.apache.avro.util.ByteBufferInputStream;
 import org.apache.avro.util.ByteBufferOutputStream;
 import org.apache.gora.mapreduce.GoraMapReduceUtils;
+import org.apache.gora.persistency.impl.PersistentBase;
 import org.apache.gora.util.IOUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.DataInputBuffer;
@@ -135,6 +136,10 @@ public class TestIOUtils {
           log.info("After : " + before);
         }
         assertEquals(before, after);
+        if ((before instanceof PersistentBase) && (after instanceof PersistentBase))
{
+          assertEquals(Arrays.equals(((PersistentBase) before).getDirtyBytes().array(),
+                  ((PersistentBase) after).getDirtyBytes().array()), true);
+        }
       }
       
       //assert that the end of input is reached


Mime
View raw message