ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject ignite git commit: Merge branch ignite-1282 into ignite-1945
Date Thu, 19 Nov 2015 14:12:03 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1945 a511fa178 -> 7b412ee3d


Merge branch ignite-1282 into ignite-1945


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

Branch: refs/heads/ignite-1945
Commit: 7b412ee3d2ff81622471a7364982cc700eb615b3
Parents: a511fa1
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Thu Nov 19 17:11:55 2015 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Thu Nov 19 17:11:55 2015 +0300

----------------------------------------------------------------------
 .../configuration/BinaryConfiguration.java      | 33 ++++++++++++++++++++
 .../apache/ignite/internal/IgniteKernal.java    |  7 +++--
 .../internal/portable/PortableContext.java      |  2 +-
 .../cpp/PlatformCppConfigurationClosure.java    | 18 ++++++++---
 .../PlatformDotNetConfigurationClosure.java     | 20 ++++++++----
 .../portable/BinaryMarshallerSelfTest.java      |  4 ---
 .../BinaryFieldsHeapNonCompactSelfTest.java     |  4 ---
 7 files changed, 65 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7b412ee3/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java
index 73f7dfa..641a41f 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java
@@ -27,6 +27,9 @@ import org.apache.ignite.binary.BinaryTypeConfiguration;
  *
  */
 public class BinaryConfiguration {
+    /** Default compact footer flag setting. */
+    public static final boolean DFLT_COMPACT_FOOTER = true;
+
     /** ID mapper. */
     private BinaryIdMapper idMapper;
 
@@ -36,6 +39,9 @@ public class BinaryConfiguration {
     /** Types. */
     private Collection<BinaryTypeConfiguration> typeCfgs;
 
+    /** Compact footer flag. */
+    private boolean compactFooter = DFLT_COMPACT_FOOTER;
+
     /**
      * Sets class names of portable objects explicitly.
      *
@@ -102,4 +108,31 @@ public class BinaryConfiguration {
     public void setTypeConfigurations(Collection<BinaryTypeConfiguration> typeCfgs)
{
         this.typeCfgs = typeCfgs;
     }
+
+    /**
+     * Get whether to write footers in compact form. When enabled, Ignite will not write
fields metadata
+     * when serializing objects, because internally {@code PortableMarshaller} already distribute
metadata inside
+     * cluster. This increases serialization performance.
+     * <p>
+     * <b>WARNING!</b> This mode should be disabled when already serialized data
can be taken from some external
+     * sources (e.g. cache store which stores data in binary form, data center replication,
etc.). Otherwise binary
+     * objects without any associated metadata could appear in the cluster and Ignite will
not be able to deserialize
+     * it.
+     * <p>
+     * Defaults to {@link #DFLT_COMPACT_FOOTER}.
+     *
+     * @return Whether to write footers in compact form.
+     */
+    public boolean isCompactFooter() {
+        return compactFooter;
+    }
+
+    /**
+     * Set whether to write footers in compact form. See {@link #isCompactFooter()} for more
info.
+     *
+     * @param compactFooter Whether to write footers in compact form.
+     */
+    public void setCompactFooter(boolean compactFooter) {
+        this.compactFooter = compactFooter;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7b412ee3/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 2b6eaad..7f63b9c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -76,6 +76,7 @@ import org.apache.ignite.cache.affinity.Affinity;
 import org.apache.ignite.cluster.ClusterGroup;
 import org.apache.ignite.cluster.ClusterMetrics;
 import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.BinaryConfiguration;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.CollectionConfiguration;
 import org.apache.ignite.configuration.ConnectorConfiguration;
@@ -157,7 +158,6 @@ import org.apache.ignite.lifecycle.LifecycleBean;
 import org.apache.ignite.lifecycle.LifecycleEventType;
 import org.apache.ignite.marshaller.MarshallerExclusions;
 import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
 import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
 import org.apache.ignite.mxbean.IgniteMXBean;
 import org.apache.ignite.mxbean.ThreadPoolMXBean;
@@ -1275,8 +1275,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
         add(ATTR_MARSHALLER_USE_DFLT_SUID,
             getBoolean(IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID, OptimizedMarshaller.USE_DFLT_SUID));
 
-        if (cfg.getMarshaller() instanceof PortableMarshaller)
-            add(ATTR_MARSHALLER_COMPACT_FOOTER, ((PortableMarshaller)cfg.getMarshaller()).isCompactFooter());
+        add(ATTR_MARSHALLER_COMPACT_FOOTER, cfg.getBinaryConfiguration() == null ?
+            BinaryConfiguration.DFLT_COMPACT_FOOTER :
+            cfg.getBinaryConfiguration().isCompactFooter());
 
         add(ATTR_USER_NAME, System.getProperty("user.name"));
         add(ATTR_GRID_NAME, gridName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7b412ee3/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index 62917b6..f133d7b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -264,7 +264,7 @@ public class PortableContext implements Externalizable {
             binaryCfg.getTypeConfigurations()
         );
 
-        compactFooter = marsh.isCompactFooter();
+        compactFooter = binaryCfg.isCompactFooter();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/7b412ee3/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
index 6cdf53b..b53cc46 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.platform.cpp;
 
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.BinaryConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.PlatformConfiguration;
 import org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure;
@@ -71,10 +72,6 @@ public class PlatformCppConfigurationClosure extends PlatformAbstractConfigurati
         Marshaller marsh = igniteCfg.getMarshaller();
 
         if (marsh == null) {
-            BinaryMarshaller marsh0 = new BinaryMarshaller();
-
-            marsh0.setCompactFooter(false);
-            
             igniteCfg.setMarshaller(new BinaryMarshaller());
 
             cppCfg0.warnings(Collections.singleton("Marshaller is automatically set to "
+
@@ -83,7 +80,18 @@ public class PlatformCppConfigurationClosure extends PlatformAbstractConfigurati
         else if (!(marsh instanceof BinaryMarshaller))
             throw new IgniteException("Unsupported marshaller (only " + BinaryMarshaller.class.getName()
+
                 " can be used when running Apache Ignite C++): " + marsh.getClass().getName());
-        else if (((BinaryMarshaller)marsh).isCompactFooter())
+
+        BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration();
+
+        if (bCfg == null) {
+            bCfg = new BinaryConfiguration();
+
+            bCfg.setCompactFooter(false);
+
+            igniteCfg.setBinaryConfiguration(bCfg);
+        }
+
+        if (bCfg.isCompactFooter())
             throw new IgniteException("Unsupported " + BinaryMarshaller.class.getName() +
                 " \"compactFooter\" flag: must be false when running Apache Ignite C++.");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7b412ee3/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
index 4289d4c..a0c5a0b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.platform.dotnet;
 
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.BinaryConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.PlatformConfiguration;
 import org.apache.ignite.internal.MarshallerContextImpl;
@@ -92,11 +93,7 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
         Marshaller marsh = igniteCfg.getMarshaller();
 
         if (marsh == null) {
-            BinaryMarshaller marsh0 = new BinaryMarshaller();
-
-            marsh0.setCompactFooter(false);
-
-            igniteCfg.setMarshaller(marsh0);
+            igniteCfg.setMarshaller(new BinaryMarshaller());
 
             dotNetCfg0.warnings(Collections.singleton("Marshaller is automatically set to
" +
                 BinaryMarshaller.class.getName() + " (other nodes must have the same marshaller
type)."));
@@ -104,7 +101,18 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
         else if (!(marsh instanceof BinaryMarshaller))
             throw new IgniteException("Unsupported marshaller (only " + BinaryMarshaller.class.getName()
+
                 " can be used when running Apache Ignite.NET): " + marsh.getClass().getName());
-        else if (((BinaryMarshaller)marsh).isCompactFooter())
+
+        BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration();
+
+        if (bCfg == null) {
+            bCfg = new BinaryConfiguration();
+
+            bCfg.setCompactFooter(false);
+
+            igniteCfg.setBinaryConfiguration(bCfg);
+        }
+
+        if (bCfg.isCompactFooter())
             throw new IgniteException("Unsupported " + BinaryMarshaller.class.getName() +
                 " \"compactFooter\" flag: must be false when running Apache Ignite.NET.");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7b412ee3/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
index 989b41b..1d3e294 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
@@ -878,8 +878,6 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
             new BinaryTypeConfiguration(DynamicObject.class.getName())
         ));
 
-        initializePortableContext(marsh);
-
         BinaryObject po1 = marshal(new DynamicObject(0, 10, 20, 30), marsh);
 
         assertEquals(new Integer(10), po1.field("val1"));
@@ -1266,8 +1264,6 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest
{
             new BinaryTypeConfiguration(SimpleObject.class.getName())
         ));
 
-        initializePortableContext(marsh);
-
         SimpleObject obj = simpleObject();
 
         final BinaryObject po = marshal(obj, marsh);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7b412ee3/modules/core/src/test/java/org/apache/ignite/internal/portable/noncompact/BinaryFieldsHeapNonCompactSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/noncompact/BinaryFieldsHeapNonCompactSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/portable/noncompact/BinaryFieldsHeapNonCompactSelfTest.java
index 9e7619f..6c11938 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/noncompact/BinaryFieldsHeapNonCompactSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/noncompact/BinaryFieldsHeapNonCompactSelfTest.java
@@ -17,11 +17,7 @@
 
 package org.apache.ignite.internal.portable.noncompact;
 
-import org.apache.ignite.internal.portable.BinaryFieldsAbstractSelfTest;
 import org.apache.ignite.internal.portable.BinaryFieldsHeapSelfTest;
-import org.apache.ignite.internal.portable.BinaryObjectEx;
-import org.apache.ignite.internal.portable.BinaryObjectImpl;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
 
 /**
  * Field tests for heap-based portables with non-compact footer.


Mime
View raw message