ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [4/4] ignite git commit: IGNITE-1770: Field info is written to the tail.
Date Fri, 23 Oct 2015 14:57:32 GMT
IGNITE-1770: Field info is written to the tail.


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

Branch: refs/heads/ignite-1770
Commit: c4ce99736e054f52696be8387aa91e8ec9ca0e23
Parents: 0a02401
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Fri Oct 23 17:58:13 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Fri Oct 23 17:58:13 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/PortableWriterExImpl.java | 21 ++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c4ce9973/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
index 5b77658..93350b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
@@ -71,6 +71,7 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.OBJ_ARR
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.OPTM_MARSH;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.PORTABLE_OBJ;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.RAW_DATA_OFF_POS;
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.SCHEMA_OFF_POS;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.SHORT;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.SHORT_ARR;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.STRING;
@@ -124,7 +125,7 @@ public class PortableWriterExImpl implements PortableWriter, PortableRawWriterEx
 
     /** Field infos. */
     // TODO: Optimize.
-    private List<Integer> fieldInfos = new ArrayList<>();
+    private List<Integer> fieldInfos;
 
     /**
      * @param ctx Context.
@@ -335,8 +336,21 @@ public class PortableWriterExImpl implements PortableWriter, PortableRawWriterEx
      * - writing schema to the tail.
      */
     public void postWrite() {
-        out.writeInt(start + TOTAL_LEN_POS, out.position() - start);
+        // 1. Write raw offset.
         out.writeInt(start + RAW_DATA_OFF_POS, (rawOffPos == 0 ? out.position() : rawOffPos)
- start);
+
+        if (fieldInfos != null) {
+            // 2. Write schema offset.
+            out.writeInt(start + SCHEMA_OFF_POS, out.position() - start);
+
+            // 3. Write the schema.
+            for (Integer val : fieldInfos)
+                out.writeInt(val);
+        }
+
+        // 4. Write length.
+        out.writeInt(start + TOTAL_LEN_POS, out.position() - start);
+
     }
 
     /**
@@ -1804,6 +1818,9 @@ public class PortableWriterExImpl implements PortableWriter, PortableRawWriterEx
       * @param off Offset starting from object head.
       */
     private void saveFieldInfo(int id, int off) {
+        if (fieldInfos == null)
+            fieldInfos = new ArrayList<>(2);
+
         fieldInfos.add(id);
         fieldInfos.add(off);
     }


Mime
View raw message