Merge branch ignite-5024 of https://github.com/gridgain/apache-ignite into ignite-5024
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/14c52e2f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/14c52e2f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/14c52e2f Branch: refs/heads/ignite-5024 Commit: 14c52e2fcac45bc51ca6e8588a7d250a0e285a1b Parents: 67ba03b 83d913c Author: Alexey Goncharuk <[email protected]> Authored: Mon Apr 24 11:02:13 2017 +0300 Committer: Alexey Goncharuk <[email protected]> Committed: Mon Apr 24 11:02:13 2017 +0300 ---------------------------------------------------------------------- examples/pom.xml | 5 +- modules/aop/pom.xml | 2 +- modules/apache-license-gen/pom.xml | 2 +- modules/aws/pom.xml | 2 +- modules/benchmarks/pom.xml | 2 +- modules/camel/pom.xml | 2 +- modules/cassandra/pom.xml | 2 +- modules/cassandra/serializers/pom.xml | 4 +- modules/cassandra/store/pom.xml | 4 +- modules/clients/pom.xml | 2 +- modules/cloud/pom.xml | 2 +- modules/codegen/pom.xml | 2 +- modules/core/pom.xml | 2 +- .../configuration/MemoryConfiguration.java | 40 +++++++++- .../IgniteCacheDatabaseSharedManager.java | 37 ++++++++-- .../ignite/internal/util/IgniteUtils.java | 26 ++++++- .../core/src/main/resources/ignite.properties | 2 +- .../cache/MemoryPolicyConfigValidationTest.java | 77 +++++++++++++++++++- .../GridServiceProcessorMultiNodeSelfTest.java | 6 +- modules/extdata/p2p/pom.xml | 2 +- .../extdata/uri/modules/uri-dependency/pom.xml | 2 +- modules/extdata/uri/pom.xml | 2 +- modules/flink/pom.xml | 2 +- modules/flume/pom.xml | 2 +- modules/gce/pom.xml | 2 +- modules/geospatial/pom.xml | 2 +- modules/hadoop/pom.xml | 2 +- modules/hibernate/pom.xml | 2 +- modules/hibernate5/pom.xml | 2 +- modules/indexing/pom.xml | 2 +- ...teCacheJoinPartitionedAndReplicatedTest.java | 57 ++++++++++++--- modules/jcl/pom.xml | 2 +- modules/jms11/pom.xml | 2 +- modules/jta/pom.xml | 2 +- modules/kafka/pom.xml | 2 +- modules/kubernetes/pom.xml | 2 +- modules/log4j/pom.xml | 2 +- modules/log4j2/pom.xml | 2 +- modules/mesos/pom.xml | 2 +- modules/ml/pom.xml | 6 +- modules/mqtt/pom.xml | 2 +- modules/osgi-karaf/pom.xml | 2 +- modules/osgi-paxlogging/pom.xml | 2 +- modules/osgi/pom.xml | 2 +- modules/platforms/cpp/common/configure.ac | 2 +- modules/platforms/cpp/configure.ac | 2 +- modules/platforms/cpp/configure.acrel | 2 +- modules/platforms/cpp/core-test/configure.ac | 2 +- modules/platforms/cpp/core/configure.ac | 2 +- modules/platforms/cpp/examples/configure.ac | 2 +- modules/platforms/cpp/ignite/configure.ac | 2 +- .../cpp/odbc/install/ignite-odbc-amd64.wxs | 2 +- .../cpp/odbc/install/ignite-odbc-x86.wxs | 2 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Apache.Ignite/Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- modules/rest-http/pom.xml | 2 +- modules/scalar-2.10/pom.xml | 2 +- modules/scalar/pom.xml | 2 +- modules/schedule/pom.xml | 2 +- modules/slf4j/pom.xml | 2 +- modules/spark-2.10/pom.xml | 2 +- modules/spark/pom.xml | 2 +- modules/spring-data/pom.xml | 5 +- modules/spring/pom.xml | 2 +- modules/ssh/pom.xml | 2 +- modules/storm/pom.xml | 2 +- modules/tools/pom.xml | 2 +- modules/twitter/pom.xml | 2 +- modules/urideploy/pom.xml | 2 +- modules/visor-console-2.10/pom.xml | 2 +- modules/visor-console/pom.xml | 2 +- modules/visor-plugins/pom.xml | 2 +- modules/web-console/pom.xml | 2 +- modules/web-console/web-agent/pom.xml | 2 +- modules/web/ignite-appserver-test/pom.xml | 2 +- modules/web/ignite-websphere-test/pom.xml | 2 +- modules/web/pom.xml | 2 +- modules/yardstick/pom.xml | 2 +- modules/yarn/pom.xml | 2 +- modules/zeromq/pom.xml | 2 +- modules/zookeeper/pom.xml | 2 +- pom.xml | 43 +++++------ 95 files changed, 355 insertions(+), 181 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/14c52e2f/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java index a353eef,3cccb42..97f10b3 --- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java @@@ -62,11 -62,11 +62,14 @@@ public class MemoryConfiguration implem /** */ private static final long serialVersionUID = 0L; + /** Default memory policy start size (256 MB). */ + public static final long DFLT_MEMORY_POLICY_INITIAL_SIZE = 256 * 1024 * 1024; + - /** Default memory policy's size (1 GB). */ - public static final long DFLT_MEMORY_POLICY_MAX_SIZE = 1024 * 1024 * 1024; + /** Fraction of available memory to allocate for default MemoryPolicy. */ + private static final double DFLT_MEMORY_POLICY_FRACTION = 0.8; + + /** Default memory policy's size is 80% of physical memory available on current machine. */ - public static final long DFLT_MEMORY_POLICY_SIZE = (long) DFLT_MEMORY_POLICY_FRACTION * U.getTotalMemoryAvailable(); ++ public static final long DFLT_MEMORY_POLICY_MAX_SIZE = (long)DFLT_MEMORY_POLICY_FRACTION * U.getTotalMemoryAvailable(); /** Default size of a memory chunk for the system cache (100 MB). */ public static final long DFLT_SYS_CACHE_MEM_SIZE = 100 * 1024 * 1024; @@@ -167,8 -170,10 +173,10 @@@ public MemoryPolicyConfiguration createDefaultPolicyConfig() { MemoryPolicyConfiguration memPlc = new MemoryPolicyConfiguration(); - long size = (dfltMemPlcSize != null) ? dfltMemPlcSize : DFLT_MEMORY_POLICY_SIZE; ++ long maxSize = (dfltMemPlcSize != null) ? dfltMemPlcSize : DFLT_MEMORY_POLICY_MAX_SIZE; + memPlc.setName(null); - memPlc.setMaxSize(DFLT_MEMORY_POLICY_MAX_SIZE); - memPlc.setSize(size); ++ memPlc.setMaxSize(maxSize); return memPlc; } @@@ -195,9 -197,35 +203,35 @@@ } /** + * Gets a size for default memory policy overridden by user. + * + * @return default memory policy size overridden by user or -1 if nothing was specified. + */ + public long getDefaultMemoryPolicySize() { + return (dfltMemPlcSize != null) ? dfltMemPlcSize : -1; + } + + /** + * Overrides size of default memory policy which is created automatically. + * + * If user doesn't specify any memory policy configuration, a default one with default size + * (80% of available RAM) is created by Ignite. + * + * This property allows user to specify desired size of default memory policy + * without having to use more verbose syntax of MemoryPolicyConfiguration elements. + * + * @param dfltMemPlcSize Size of default memory policy overridden by user. + */ + public MemoryConfiguration setDefaultMemoryPolicySize(long dfltMemPlcSize) { + this.dfltMemPlcSize = dfltMemPlcSize; + + return this; + } + + /** * Gets a name of default memory policy. * - * @return A name of a custom memory policy configured with {@link MemoryConfiguration} or {@code null} of the + * @return A name of a custom memory policy configured with {@code MemoryConfiguration} or {@code null} of the * default policy is used. */ public String getDefaultMemoryPolicyName() { http://git-wip-us.apache.org/repos/asf/ignite/blob/14c52e2f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java index d7e1e17,de882da..d6c7faa --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java @@@ -305,14 -308,28 +309,30 @@@ public class IgniteCacheDatabaseSharedM * @param plcNames All MemoryPolicy names. * @throws IgniteCheckedException In case of validation violation. */ - private static void checkDefaultPolicyConfiguration(String dfltPlcName, Collection<String> plcNames) - throws IgniteCheckedException { - private static void checkDefaultPolicyConfiguration(String dfltPlcName, - long dfltPlcSize, - Set<String> plcNames) throws IgniteCheckedException { ++ private static void checkDefaultPolicyConfiguration( ++ String dfltPlcName, ++ long dfltPlcSize, ++ Collection<String> plcNames ++ ) throws IgniteCheckedException { + if (dfltPlcSize != -1) { + if (dfltPlcName != null) + throw new IgniteCheckedException("User-defined MemoryPolicy configuration " + - "and defaultMemoryPolicySize properties are set at the same time. " + - "Delete either MemoryConfiguration.defaultMemoryPolicySize property " + - "or configuration of user-defined default MemoryPolicy"); - ++ "and defaultMemoryPolicySize properties are set at the same time. " + ++ "Delete either MemoryConfiguration.defaultMemoryPolicySize property " + ++ "or user-defined default MemoryPolicy configuration"); + + if (dfltPlcSize < MIN_PAGE_MEMORY_SIZE) + throw new IgniteCheckedException("User-defined default MemoryPolicy size is less than 1MB. " + + "Use MemoryConfiguration.defaultMemoryPolicySize property to set correct size."); + } + if (dfltPlcName != null) { if (dfltPlcName.isEmpty()) throw new IgniteCheckedException("User-defined default MemoryPolicy name must be non-empty"); ++ if (!plcNames.contains(dfltPlcName)) - throw new IgniteCheckedException("User-defined default MemoryPolicy name must be presented " + - "among configured MemoryPolices: " + dfltPlcName); + throw new IgniteCheckedException("User-defined default MemoryPolicy name " + - "must be presented among configured MemoryPolices: " + dfltPlcName); ++ "must be presented among configured MemoryPolices: " + dfltPlcName); } } @@@ -321,12 -338,13 +341,15 @@@ * @throws IgniteCheckedException If config is invalid. */ private static void checkPolicySize(MemoryPolicyConfiguration plcCfg) throws IgniteCheckedException { - if (plcCfg.getMaxSize() < MIN_PAGE_MEMORY_SIZE) - throw new IgniteCheckedException("MemoryPolicy must have size more than 1MB: " + plcCfg.getName()); - if (plcCfg.getSize() < MIN_PAGE_MEMORY_SIZE) - throw new IgniteCheckedException("MemoryPolicy must have size more than 1MB: MemoryPolicy[name=" + - plcCfg.getName() + - "; size=" + - plcCfg.getSize() + - "]. Use MemoryPolicyConfiguration.size property to set correct size (in bytes)." ++ if (plcCfg.getInitialSize() < MIN_PAGE_MEMORY_SIZE) ++ throw new IgniteCheckedException("MemoryPolicy must have size more than 1MB (use " + ++ "MemoryPolicyConfiguration.size property to set correct size in bytes) " + ++ "[name=" + plcCfg.getName() + ", size=" + U.readableSize(plcCfg.getInitialSize(), true) + "]" + ); + + if (plcCfg.getMaxSize() > plcCfg.getInitialSize()) + throw new IgniteCheckedException("MemoryPolicy maxSize must not be smaller than " + + "initialSize: " + plcCfg.getName()); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/14c52e2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/14c52e2f/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java ---------------------------------------------------------------------- diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java index df7ddf1,32d1462..aa247fd --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java @@@ -299,13 -299,13 +299,15 @@@ public class GridServiceProcessorMultiN checkCount(name, g.services().serviceDescriptors(), nodeCount()); - latch = new CountDownLatch(1); - int extraNodes = 2; + - latch = new CountDownLatch(1); ++ ++ latch = new CountDownLatch(1); DummyService.exeLatch(name, latch); - int extraNodes = 2; - startExtraNodes(2); ++ int extraNodes =2; + + startExtraNodes(extraNodes); try { latch.await(); http://git-wip-us.apache.org/repos/asf/ignite/blob/14c52e2f/pom.xml ----------------------------------------------------------------------
