You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/06/02 11:12:32 UTC

[1/8] ignite git commit: Added RDBMS benchmarks

Repository: ignite
Updated Branches:
  refs/heads/ignite-5267 281d105f6 -> c7a7e6423


Added RDBMS benchmarks


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

Branch: refs/heads/ignite-5267
Commit: 409f6e5d049dd095f2f496dc3bc00717c1e03bba
Parents: 9589093
Author: oleg-ostanin <oo...@gridgain.com>
Authored: Thu Jun 1 15:46:03 2017 +0300
Committer: oleg-ostanin <oo...@gridgain.com>
Committed: Thu Jun 1 15:49:36 2017 +0300

----------------------------------------------------------------------
 .../yardstick/config/ignite-db-base-config.xml  | 118 ++++++++++
 .../config/ignite-db-localhost-config.xml       |  53 +++++
 .../yardstick/config/ignite-rdbms-config.xml    |  70 ++++++
 .../config/sql/benchmark-jdbc-ignite.properties |  64 ++++++
 .../sql/benchmark-mysql-ignite.properties       |  66 ++++++
 .../config/sql/benchmark-native.properties      |  62 ++++++
 .../sql/benchmark-pgsql-ignite.properties       |  66 ++++++
 modules/yardstick/config/sql/db-h2-queries.sql  |   9 +
 .../yardstick/config/sql/db-mysql-queries.sql   |  14 ++
 .../yardstick/config/sql/db-pgsql-queries.sql   |  14 ++
 .../yardstick/config/sql/h2-insert-query.sql    |   1 +
 .../yardstick/config/sql/rdbms-mysql-schema.sql |   5 +
 .../yardstick/config/sql/rdbms-pgsql-schema.sql |  10 +
 .../yardstick/IgniteBenchmarkArguments.java     |  46 +++-
 .../cache/jdbc/IgniteNativeTxBenchmark.java     | 169 ++++++++++++++
 .../cache/jdbc/JdbcAbstractBenchmark.java       |  51 ++++-
 .../yardstick/cache/jdbc/JdbcPutBenchmark.java  |   3 -
 .../yardstick/cache/jdbc/RdbmsBenchmark.java    | 220 +++++++++++++++++++
 .../ignite/yardstick/cache/model/Accounts.java  |  62 ++++++
 .../ignite/yardstick/cache/model/Branches.java  |  62 ++++++
 .../ignite/yardstick/cache/model/History.java   |  69 ++++++
 .../ignite/yardstick/cache/model/Tellers.java   |  62 ++++++
 22 files changed, 1285 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/ignite-db-base-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-db-base-config.xml b/modules/yardstick/config/ignite-db-base-config.xml
new file mode 100644
index 0000000..690edac
--- /dev/null
+++ b/modules/yardstick/config/ignite-db-base-config.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+    Ignite Spring configuration file to startup grid.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+    <bean id="base-ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" abstract="true">
+        <property name="peerClassLoadingEnabled" value="false"/>
+
+        <property name="metricsLogFrequency" value="5000"/>
+
+        <property name="memoryConfiguration">
+            <bean class="org.apache.ignite.configuration.MemoryConfiguration">
+                <property name="pageCacheSize" value="#{400L * 1024L * 1024L}"/>
+            </bean>
+        </property>
+
+        <property name="binaryConfiguration">
+            <bean class="org.apache.ignite.configuration.BinaryConfiguration">
+                <property name="compactFooter" value="false"/>
+            </bean>
+        </property>
+
+        <property name="cacheConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="Accounts"/>
+
+                    <property name="cacheMode" value="PARTITIONED"/>
+
+                    <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+                    <property name="indexedTypes">
+                        <list>
+                            <value>java.lang.Long</value>
+                            <value>org.apache.ignite.yardstick.cache.model.Accounts</value>
+                        </list>
+                    </property>
+                </bean>
+
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="Tellers"/>
+
+                    <property name="cacheMode" value="PARTITIONED"/>
+
+                    <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+                    <property name="indexedTypes">
+                        <list>
+                            <value>java.lang.Long</value>
+                            <value>org.apache.ignite.yardstick.cache.model.Tellers</value>
+                        </list>
+                    </property>
+                </bean>
+
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="Branches"/>
+
+                    <property name="cacheMode" value="PARTITIONED"/>
+
+                    <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+                    <property name="indexedTypes">
+                        <list>
+                            <value>java.lang.Long</value>
+                            <value>org.apache.ignite.yardstick.cache.model.Branches</value>
+                        </list>
+                    </property>
+                </bean>
+
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="History"/>
+
+                    <property name="cacheMode" value="PARTITIONED"/>
+
+                    <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+                    <property name="indexedTypes">
+                        <list>
+                            <value>java.lang.Long</value>
+                            <value>org.apache.ignite.yardstick.cache.model.History</value>
+                        </list>
+                    </property>
+                </bean>
+            </list>
+        </property>
+
+        <property name="includeEventTypes">
+            <list/>
+        </property>
+
+        <property name="loadBalancingSpi">
+            <bean class="org.apache.ignite.spi.loadbalancing.roundrobin.RoundRobinLoadBalancingSpi">
+                <property name="perTask" value="false"/>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/ignite-db-localhost-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-db-localhost-config.xml b/modules/yardstick/config/ignite-db-localhost-config.xml
new file mode 100644
index 0000000..15811a6
--- /dev/null
+++ b/modules/yardstick/config/ignite-db-localhost-config.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+    Ignite Spring configuration file to startup grid.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+    <import resource="ignite-db-base-config.xml"/>
+
+    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" parent="base-ignite.cfg">
+        <property name="localHost" value="127.0.0.1"/>
+
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <value>127.0.0.1:47500..47549</value>
+                                <value>127.0.0.1:47500..47549</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+
+        <property name="communicationSpi">
+            <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
+                <property name="sharedMemoryPort" value="-1"/>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/ignite-rdbms-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-rdbms-config.xml b/modules/yardstick/config/ignite-rdbms-config.xml
new file mode 100644
index 0000000..26e8016
--- /dev/null
+++ b/modules/yardstick/config/ignite-rdbms-config.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+    Ignite Spring configuration file.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="clientMode" value="true"/>
+
+        <property name="memoryConfiguration">
+            <bean class="org.apache.ignite.configuration.MemoryConfiguration">
+
+                <!-- Set page memory size to 8 GB. -->
+                <property name="defaultMemoryPolicyName" value="default"/>
+                <property name="memoryPolicies">
+                    <list>
+                        <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
+                            <property name="name" value="default"/>
+                            <property name="initialSize" value="#{1L * 1024 * 1024 * 1024}"/>
+                            <property name="maxSize" value="#{8L * 1024 * 1024 * 1024}"/>
+                        </bean>
+                    </list>
+                </property>
+            </bean>
+        </property>
+
+        <property name="binaryConfiguration">
+            <bean class="org.apache.ignite.configuration.BinaryConfiguration">
+                <property name="compactFooter" value="false"/>
+            </bean>
+        </property>
+
+        <property name="localHost" value="127.0.0.1"/> <!-- remove this line for remote running -->
+
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <value>127.0.0.1:47500..47549</value> <!-- change IP for actual host IP for remote running -->
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/sql/benchmark-jdbc-ignite.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/sql/benchmark-jdbc-ignite.properties b/modules/yardstick/config/sql/benchmark-jdbc-ignite.properties
new file mode 100644
index 0000000..11e9108
--- /dev/null
+++ b/modules/yardstick/config/sql/benchmark-jdbc-ignite.properties
@@ -0,0 +1,64 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Contains benchmarks for SQL queries.
+#
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false \
+-Xms6g \
+-Xmx6g \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+"
+
+IGNITE_PARAMS="-jdbcDrv org.apache.ignite.IgniteJdbcDriver -jdbc jdbc:ignite:cfg://cache=Accounts@${SCRIPT_DIR}/../config/ignite-rdbms-config.xml -ltqf ${SCRIPT_DIR}/../config/sql/db-h2-queries.sql"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
+SERVER_HOSTS=localhost
+
+# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
+DRIVER_HOSTS=localhost
+
+# Backups count.
+b=1
+
+# Warmup.
+w=60
+
+# Duration.
+d=300
+
+# Threads count.
+t=64
+
+# Scale factor
+sf=10
+
+# Run configuration.
+# Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-db-localhost-config.xml -b ${b} -w ${w} -d ${d} -t ${t} -sf ${sf} -plfreq 5000 ${IGNITE_PARAMS} -dn RdbmsBenchmark -sn IgniteNode -ds jdbc-ignite-put,\
+"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/sql/benchmark-mysql-ignite.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/sql/benchmark-mysql-ignite.properties b/modules/yardstick/config/sql/benchmark-mysql-ignite.properties
new file mode 100644
index 0000000..fcf1ae2
--- /dev/null
+++ b/modules/yardstick/config/sql/benchmark-mysql-ignite.properties
@@ -0,0 +1,66 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Contains benchmarks for SQL queries.
+#
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false \
+-Xms6g \
+-Xmx6g \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
+SERVER_HOSTS=localhost
+
+# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
+DRIVER_HOSTS=localhost
+
+# For running this benchmark on the remote host you need to add "\" in the URL like this: ignite\&password=pass\&useSSL=false
+MYSQL_PARAMS="-jdbcDrv com.mysql.jdbc.Driver -jdbc jdbc:mysql://${SERVER_HOSTS}/?user=ignite&password=pass&useSSL=false -tempDb -ltqf ${SCRIPT_DIR}/../config/sql/db-mysql-queries.sql -sch ${SCRIPT_DIR}/../config/sql/rdbms-mysql-schema.sql"
+
+
+# Backups count.
+b=1
+
+# Warmup.
+w=60
+
+# Duration.
+d=300
+
+# Threads count.
+t=64
+
+# Scale factor
+sf=10
+
+# Run configuration.
+# Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -b ${b} -w ${w} -d ${d} -t ${t} -sf ${sf} ${MYSQL_PARAMS} -dn RdbmsBenchmark -sn IgniteNode -ds jdbc-mysql-commit,\
+"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/sql/benchmark-native.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/sql/benchmark-native.properties b/modules/yardstick/config/sql/benchmark-native.properties
new file mode 100644
index 0000000..bc025b8
--- /dev/null
+++ b/modules/yardstick/config/sql/benchmark-native.properties
@@ -0,0 +1,62 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Contains benchmarks for SQL queries.
+#
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false \
+-Xms6g \
+-Xmx6g \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
+SERVER_HOSTS=localhost
+
+# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
+DRIVER_HOSTS=localhost
+
+# Backups count.
+b=1
+
+# Warmup.
+w=60
+
+# Duration.
+d=300
+
+# Threads count.
+t=64
+
+# Scale factor
+sf=10
+
+# Run configuration.
+# Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-db-localhost-config.xml -b ${b} -w ${w} -d ${d} -t ${t} -sf ${sf} -txc PESSIMISTIC -dn IgniteNativeTxBenchmark -sn IgniteNode -ds jdbc-ignite-put,\
+"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/sql/benchmark-pgsql-ignite.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/sql/benchmark-pgsql-ignite.properties b/modules/yardstick/config/sql/benchmark-pgsql-ignite.properties
new file mode 100644
index 0000000..e3bc216
--- /dev/null
+++ b/modules/yardstick/config/sql/benchmark-pgsql-ignite.properties
@@ -0,0 +1,66 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Contains benchmarks for SQL queries.
+#
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false \
+-Xms6g \
+-Xmx6g \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
+SERVER_HOSTS=localhost
+
+# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
+DRIVER_HOSTS=localhost
+
+# Warning: database must be created and specified in URL explicitly, and there's no other way around as long as driver does not support changing DB in runtime
+# For running this benchmark on the remote host you need to add "\" in the URL like this: ignite\&password=pass
+PGSQL_PARAMS="-jdbcDrv org.postgresql.Driver -jdbc jdbc:postgresql://${SERVER_HOSTS}/pgbenchmark?user=ignite&password=pass -ltqf ${SCRIPT_DIR}/../config/sql/db-mysql-queries.sql -sch ${SCRIPT_DIR}/../config/sql/rdbms-pgsql-schema.sql"
+
+# Backups count.
+b=1
+
+# Warmup.
+w=60
+
+# Duration.
+d=300
+
+# Threads count.
+t=64
+
+# Scale factor
+sf=10
+
+# Run configuration.
+# Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -b ${b} -w ${w} -d ${d} -t ${t} -sf ${sf} ${PGSQL_PARAMS} -dn RdbmsBenchmark -sn IgniteNode -ds jdbc-pgsql-commit,\
+"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/sql/db-h2-queries.sql
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/sql/db-h2-queries.sql b/modules/yardstick/config/sql/db-h2-queries.sql
new file mode 100644
index 0000000..9ce66a4
--- /dev/null
+++ b/modules/yardstick/config/sql/db-h2-queries.sql
@@ -0,0 +1,9 @@
+UPDATE "Accounts".Accounts SET val = val + :delta WHERE _key = :aid;
+
+SELECT val FROM "Accounts".Accounts WHERE _key = :aid;
+
+UPDATE "Tellers".Tellers SET val = val + :delta WHERE _key = :tid;
+
+UPDATE "Branches".Branches SET val = val + :delta WHERE _key = :bid;
+
+INSERT INTO "History".History (_key, tid, bid, aid, delta) VALUES (?, ?, ?, ? ,?);

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/sql/db-mysql-queries.sql
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/sql/db-mysql-queries.sql b/modules/yardstick/config/sql/db-mysql-queries.sql
new file mode 100644
index 0000000..2d11ad49
--- /dev/null
+++ b/modules/yardstick/config/sql/db-mysql-queries.sql
@@ -0,0 +1,14 @@
+BEGIN
+
+UPDATE Accounts SET val = val + :delta WHERE id = :aid;
+
+SELECT val FROM Accounts WHERE id = :aid;
+
+UPDATE Tellers SET val = val + :delta WHERE id = :tid;
+
+UPDATE Branches SET val = val + :delta WHERE id = :bid;
+
+INSERT INTO History (tid, bid, aid, delta) VALUES (:tid, :bid, :aid, :delta);
+
+COMMIT
+

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/sql/db-pgsql-queries.sql
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/sql/db-pgsql-queries.sql b/modules/yardstick/config/sql/db-pgsql-queries.sql
new file mode 100644
index 0000000..582daf6
--- /dev/null
+++ b/modules/yardstick/config/sql/db-pgsql-queries.sql
@@ -0,0 +1,14 @@
+BEGIN
+
+UPDATE Accounts SET val = val + :delta WHERE id = :aid;
+
+SELECT val FROM Accounts WHERE id = :aid;
+
+UPDATE Tellers SET val = val + :delta WHERE id = :tid;
+
+UPDATE Branches SET val = val + :delta WHERE id = :bid;
+
+INSERT INTO History (id, tid, bid, aid, delta) VALUES (:id, :tid, :bid, :aid, :delta);
+
+COMMIT
+

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/sql/h2-insert-query.sql
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/sql/h2-insert-query.sql b/modules/yardstick/config/sql/h2-insert-query.sql
new file mode 100644
index 0000000..c160a16
--- /dev/null
+++ b/modules/yardstick/config/sql/h2-insert-query.sql
@@ -0,0 +1 @@
+INSERT INTO "History".History (_key, tid, bid, aid, delta) VALUES (?, ?, ?, ? ,?);

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/sql/rdbms-mysql-schema.sql
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/sql/rdbms-mysql-schema.sql b/modules/yardstick/config/sql/rdbms-mysql-schema.sql
new file mode 100644
index 0000000..552852b
--- /dev/null
+++ b/modules/yardstick/config/sql/rdbms-mysql-schema.sql
@@ -0,0 +1,5 @@
+create table if not exists Accounts (`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, val BIGINT);
+create table if not exists Tellers (`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, val BIGINT);
+create table if not exists Branches (`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, val BIGINT);
+create table if not exists History (`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, aid BIGINT, tid BIGINT, bid BIGINT, delta BIGINT);
+create index v8_2 using btree on Accounts(`id`);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/config/sql/rdbms-pgsql-schema.sql
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/sql/rdbms-pgsql-schema.sql b/modules/yardstick/config/sql/rdbms-pgsql-schema.sql
new file mode 100644
index 0000000..d73204d
--- /dev/null
+++ b/modules/yardstick/config/sql/rdbms-pgsql-schema.sql
@@ -0,0 +1,10 @@
+DROP TABLE if exists Accounts;
+DROP TABLE if exists Tellers;
+DROP TABLE if exists Branches;
+DROP TABLE if exists History;
+create table if not exists Accounts (id BIGINT NOT NULL PRIMARY KEY, val BIGINT);
+create table if not exists Tellers (id BIGINT NOT NULL PRIMARY KEY, val BIGINT);
+create table if not exists Branches (id BIGINT NOT NULL PRIMARY KEY, val BIGINT);
+create table if not exists History (id BIGINT NOT NULL PRIMARY KEY, aid BIGINT, tid BIGINT, bid BIGINT, delta BIGINT);
+drop index if exists H_1;
+create index H_1 on History using btree (aid, tid, bid, delta);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index 74413f5..11f9472 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -85,12 +85,20 @@ public class IgniteBenchmarkArguments {
     public int range = 1_000_000;
 
     /** */
+    @Parameter(names = {"-sf", "--scaleFactor"}, description = "Scale factor")
+    private int scaleFactor = 1;
+
+    /** */
+    @Parameter(names = {"-ntv", "--native"}, description = "Native benchmarking flag")
+    private boolean ntv = false;
+
+    /** */
     @Parameter(names = {"-pa", "--preloadAmount"}, description = "Data pre-loading amount for load tests")
-    public int preloadAmount = 500_000;
+    private int preloadAmount = 500_000;
 
     /** */
     @Parameter(names = {"-plfreq", "--preloadLogFrequency"}, description = "Interval between printing logs")
-    public long preloadLogsInterval = 30_000;
+    private long preloadLogsInterval = 30_000;
 
     /** */
     @Parameter(names = {"-j", "--jobs"}, description = "Number of jobs for compute benchmarks")
@@ -139,6 +147,10 @@ public class IgniteBenchmarkArguments {
     private boolean createTempDatabase = false;
 
     /** */
+    @Parameter(names = {"-dbn", "--databaseName"}, description = "Name of database")
+    private String dbn = null;
+
+    /** */
     @Parameter(names = {"-rd", "--restartdelay"}, description = "Restart delay in seconds")
     private int restartDelay = 20;
 
@@ -203,19 +215,35 @@ public class IgniteBenchmarkArguments {
         return jdbcUrl;
     }
 
+    /**
+     * @return JDBC driver.
+     */
     public String jdbcDriver() {
         return jdbcDriver;
     }
 
+    /**
+     * @return schema definition.
+     */
     public String schemaDefinition() {
         return schemaDefinition;
     }
 
+    /**
+     * @return flag for creation temporary database.
+     */
     public boolean createTempDatabase() {
         return createTempDatabase;
     }
 
     /**
+     * @return existing database name defined in property file.
+     */
+    public String dbn() {
+        return dbn;
+    }
+
+    /**
      * @return Transaction concurrency.
      */
     public TransactionConcurrency txConcurrency() {
@@ -279,6 +307,13 @@ public class IgniteBenchmarkArguments {
     }
 
     /**
+     * @return {@code True} if flag for native benchmarking is set.
+     */
+    public boolean isNative(){
+        return ntv;
+    }
+
+    /**
      * @return Nodes.
      */
     public int nodes() {
@@ -293,6 +328,13 @@ public class IgniteBenchmarkArguments {
     }
 
     /**
+     * @return Scale factor.
+     */
+    public int scaleFactor() {
+        return scaleFactor;
+    }
+
+    /**
      * @return Preload key range, from {@code 0} to this number.
      */
     public int preloadAmount() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/IgniteNativeTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/IgniteNativeTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/IgniteNativeTxBenchmark.java
new file mode 100644
index 0000000..b331d6a
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/IgniteNativeTxBenchmark.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.jdbc;
+
+import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.IgniteTransactions;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
+import org.apache.ignite.yardstick.cache.model.Accounts;
+import org.apache.ignite.yardstick.cache.model.Branches;
+import org.apache.ignite.yardstick.cache.model.History;
+import org.apache.ignite.yardstick.cache.model.Tellers;
+import org.yardstickframework.BenchmarkConfiguration;
+
+/** JDBC benchmark that performs raw SQL insert */
+public class IgniteNativeTxBenchmark extends IgniteAbstractBenchmark {
+    /** Default number of rows in Accounts table. */
+    private long accRows;
+
+    /** Default number of rows in Tellers table. */
+    private long tellRows;
+
+    /** Default number of rows in Branches table. */
+    private long branchRows;
+
+    /** Cache for Accounts table. */
+    private IgniteCache<Long, Accounts> accounts;
+
+    /** Cache for Tellers table. */
+    private IgniteCache<Long, Tellers> tellers;
+
+    /** Cache for Branches table. */
+    private IgniteCache<Long, Branches> branches;
+
+    /** Cache for History table. */
+    private IgniteCache<Long, History> hist;
+
+    /** Id for History table */
+    private AtomicLong cnt;
+
+    /** {@inheritDoc} */
+    @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+        super.setUp(cfg);
+
+        cnt = new AtomicLong();
+
+        accRows = 1000L * args.scaleFactor();
+        tellRows = 10L * args.scaleFactor();
+        branchRows = 5L * args.scaleFactor();
+
+        accounts = ignite().cache("Accounts");
+        tellers = ignite().cache("Tellers");
+        branches = ignite().cache("Branches");
+        hist = ignite().cache("History");
+
+        clearCaches();
+
+        fillTables();
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("SimplifiableIfStatement")
+    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+        long aid = ThreadLocalRandom.current().nextLong(accRows);
+        long bid = ThreadLocalRandom.current().nextLong(branchRows);
+        long tid = ThreadLocalRandom.current().nextLong(tellRows);
+
+        final long delta = ThreadLocalRandom.current().nextLong(1000);
+
+        IgniteTransactions transactions = ignite().transactions();
+
+        try (Transaction tx = transactions.txStart(args.txConcurrency(), args.txIsolation())) {
+            accounts.invoke(aid, new EntryProcessor<Long, Accounts, Object>() {
+                @Override public Long process(MutableEntry<Long, Accounts> entry, Object... objects)
+                    throws EntryProcessorException {
+                    long newVal = entry.getValue().getVal() + delta;
+
+                    entry.setValue(entry.getValue().setVal(newVal));
+
+                    return newVal;
+                }
+            });
+
+            tellers.invoke(tid, new EntryProcessor<Long, Tellers, Object>() {
+                @Override public Long process(MutableEntry<Long, Tellers> entry, Object... objects)
+                    throws EntryProcessorException {
+                    long newVal = entry.getValue().getVal() + delta;
+
+                    entry.setValue(entry.getValue().setVal(newVal));
+
+                    return null;
+                }
+            });
+
+            branches.invoke(bid, new EntryProcessor<Long, Branches, Object>() {
+                @Override public Long process(MutableEntry<Long, Branches> entry,
+                    Object... objects) throws EntryProcessorException {
+                    long newVal = entry.getValue().getVal() + delta;
+
+                    entry.setValue(entry.getValue().setVal(newVal));
+
+                    return null;
+                }
+            });
+
+            hist.put(cnt.getAndIncrement(), new History(tid, bid, aid, delta));
+
+            tx.commit();
+        }
+
+        return true;
+    }
+
+    /**
+     * Fill tables using native Ignite API.
+     */
+    private void fillTables() throws Exception {
+        startPreloadLogging(args.preloadLogsInterval());
+
+        try (IgniteDataStreamer<Long, Accounts> dataLdr = ignite().dataStreamer(accounts.getName())) {
+            for (long i = 0; i < accRows; i++)
+                dataLdr.addData(i, new Accounts(nextRandom(args.range())));
+        }
+
+        try (IgniteDataStreamer<Long, Branches> dataLdr = ignite().dataStreamer(branches.getName())) {
+            for (long i = 0; i < branchRows; i++)
+                dataLdr.addData(i, new Branches(nextRandom(args.range())));
+        }
+
+        try (IgniteDataStreamer<Long, Tellers> dataLdr = ignite().dataStreamer(tellers.getName())) {
+            for (long i = 0; i < tellRows; i++)
+                dataLdr.addData(i, new Tellers(nextRandom(args.range())));
+        }
+
+        stopPreloadLogging();
+    }
+
+    /**
+     * Clear caches.
+     */
+    private void clearCaches() {
+        ignite().cache("Accounts").clear();
+        ignite().cache("Tellers").clear();
+        ignite().cache("Branches").clear();
+        ignite().cache("History").clear();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcAbstractBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcAbstractBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcAbstractBenchmark.java
index e9a6b1d..87c2cab 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcAbstractBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcAbstractBenchmark.java
@@ -30,27 +30,30 @@ import java.util.List;
 import java.util.UUID;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
 import org.apache.ignite.yardstick.IgniteBenchmarkArguments;
 import org.yardstickframework.BenchmarkConfiguration;
-import org.yardstickframework.BenchmarkDriverAdapter;
 
 import static org.yardstickframework.BenchmarkUtils.jcommander;
 
 /** Base class for benchmarks that measure raw performance of JDBC databases */
-public abstract class JdbcAbstractBenchmark extends BenchmarkDriverAdapter {
+public abstract class JdbcAbstractBenchmark extends IgniteAbstractBenchmark {
     /** Arguments. */
     protected final IgniteBenchmarkArguments args = new IgniteBenchmarkArguments();
 
     /** All {@link Connection}s associated with threads. */
     private final List<Connection> threadConnections = new ArrayList<>();
 
+    /** List of queries. */
+    private final List<String> dbqueries = new ArrayList<>();
+
     /** Each connection is also a transaction, so we better pin them to threads. */
     ThreadLocal<Connection> conn = new ThreadLocal<Connection>() {
         @Override protected Connection initialValue() {
             Connection conn;
             try {
                 conn = connection();
-                if (args.createTempDatabase()) {
+                if (args.createTempDatabase() || args.dbn() != null) {
                     assert dbName != null;
                     conn.setCatalog(dbName);
                 }
@@ -76,12 +79,18 @@ public abstract class JdbcAbstractBenchmark extends BenchmarkDriverAdapter {
         Class.forName(args.jdbcDriver());
         if (args.createTempDatabase())
             createTestDatabase();
+        else
+            dbName = (args.dbn() == null) ? null : args.dbn();
 
         try (Connection conn = connection()) {
             if (args.createTempDatabase())
                 conn.setCatalog(dbName);
+
             populateTestDatabase(conn);
         }
+
+        if (args.loadTestQueriesFile() != null)
+            setQueries();
     }
 
     /** {@inheritDoc} */
@@ -89,10 +98,13 @@ public abstract class JdbcAbstractBenchmark extends BenchmarkDriverAdapter {
         synchronized (threadConnections) {
             for (Connection conn : threadConnections)
                 U.closeQuiet(conn);
+
             threadConnections.clear();
         }
+
         if (args.createTempDatabase())
             dropTestDatabase();
+
         super.tearDown();
     }
 
@@ -111,7 +123,8 @@ public abstract class JdbcAbstractBenchmark extends BenchmarkDriverAdapter {
     private void dropTestDatabase() throws SQLException {
         try (Connection conn = connection()) {
             try (Statement stmt = conn.createStatement()) {
-                stmt.executeUpdate("drop database " + dbName);
+                if (!conn.getMetaData().getDatabaseProductName().equals("Ignite Cache"))
+                    stmt.executeUpdate("drop database " + dbName);
             }
         }
     }
@@ -141,14 +154,39 @@ public abstract class JdbcAbstractBenchmark extends BenchmarkDriverAdapter {
         }
     }
 
+    /** Set list of queries defined in file */
+    private void setQueries() throws IOException, SQLException {
+        if (args.loadTestQueriesFile() != null) {
+            try (FileReader fr = new FileReader(args.loadTestQueriesFile())) {
+                try (BufferedReader br = new BufferedReader(fr)) {
+                    String line;
+
+                    while ((line = br.readLine()) != null) {
+                        if (line.trim().isEmpty())
+                            continue;
+
+                        dbqueries.add(line.trim());
+                    }
+                }
+            }
+        }
+    }
+
     /** Create new {@link Connection} from {@link #args}. Intended for use by {@link #setUp} and {@link #tearDown}  */
-    private Connection connection() throws SQLException {
+    public Connection connection() throws SQLException {
         Connection conn = DriverManager.getConnection(args.jdbcUrl());
         conn.setAutoCommit(true);
         return conn;
     }
 
     /**
+     * @return List of queries.
+     */
+    public List<String> getDbqueries(){
+        return dbqueries;
+    }
+
+    /**
      * Delete all data from the table specified
      * @param tblName target table
      * @throws SQLException if failed
@@ -156,7 +194,8 @@ public abstract class JdbcAbstractBenchmark extends BenchmarkDriverAdapter {
     void clearTable(String tblName) throws SQLException {
         try (Connection conn = connection()) {
             try (PreparedStatement stmt = conn.prepareStatement("drop table " + tblName)) {
-                stmt.executeUpdate();
+                if (!conn.getMetaData().getDatabaseProductName().equals("Ignite Cache"))
+                    stmt.executeUpdate();
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcPutBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcPutBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcPutBenchmark.java
index 1b10088..47e4150 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcPutBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcPutBenchmark.java
@@ -21,11 +21,8 @@ import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.util.Map;
-
 import org.apache.ignite.IgniteException;
 
-import static org.apache.ignite.yardstick.IgniteAbstractBenchmark.nextRandom;
-
 /** JDBC benchmark that performs raw SQL insert */
 public class JdbcPutBenchmark extends JdbcAbstractBenchmark {
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/RdbmsBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/RdbmsBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/RdbmsBenchmark.java
new file mode 100644
index 0000000..341e5a7
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/RdbmsBenchmark.java
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.jdbc;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicLong;
+import org.apache.ignite.IgniteException;
+import org.yardstickframework.BenchmarkConfiguration;
+import org.yardstickframework.BenchmarkUtils;
+
+/** JDBC benchmark that performs raw SQL insert */
+public class RdbmsBenchmark extends JdbcAbstractBenchmark {
+    /** Default number of rows in Accounts table. */
+    private long accRows;
+
+    /** Default number of rows in Tellers table. */
+    private long tellRows;
+
+    /** Default number of rows in Branches table. */
+    private long branchRows;
+
+    /** Id for History table */
+    private AtomicLong cnt;
+
+    /** Flag for working with Ignite jdbc. */
+    private boolean isIgnite;
+
+    /** {@inheritDoc} */
+    @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+        super.setUp(cfg);
+
+        isIgnite = conn.get().getMetaData().getDatabaseProductName().equals("Ignite Cache");
+
+        if (isIgnite)
+            clearCaches();
+        else {
+            conn.get().createStatement().execute("DROP TABLE if exists History;");
+            conn.get().createStatement().execute("CREATE TABLE if not exists History (id BIGINT, aid BIGINT, tid BIGINT, bid BIGINT, delta BIGINT);");
+        }
+        cnt = new AtomicLong();
+
+        accRows = 1000L * args.scaleFactor();
+
+        tellRows = 10L * args.scaleFactor();
+
+        branchRows = 5L * args.scaleFactor();
+
+        fillTable("Accounts", accRows);
+
+        fillTable("Tellers", tellRows);
+
+        fillTable("Branches", branchRows);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("SimplifiableIfStatement")
+    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+        long aid = ThreadLocalRandom.current().nextLong(accRows);
+        long bid = ThreadLocalRandom.current().nextLong(branchRows);
+        long tid = ThreadLocalRandom.current().nextLong(tellRows);
+
+        long delta = ThreadLocalRandom.current().nextLong(1000);
+
+        for (String query : getDbqueries()) {
+            boolean done = false;
+
+            query = query.replaceAll(":aid", Long.toString(aid));
+            query = query.replaceAll(":bid", Long.toString(bid));
+            query = query.replaceAll(":tid", Long.toString(tid));
+            query = query.replaceAll(":delta", Long.toString(delta));
+            if (query.contains(":id"))
+                query = query.replaceAll(":id", Long.toString(cnt.getAndIncrement()));
+
+            try (PreparedStatement stmt = conn.get().prepareStatement(query)) {
+                if (isIgnite && query.startsWith("INSERT")) {
+                    stmt.setLong(1, cnt.getAndIncrement());
+                    stmt.setLong(2, tid);
+                    stmt.setLong(3, bid);
+                    stmt.setLong(4, aid);
+                    stmt.setLong(5, delta);
+                }
+                while (!done) {
+                    stmt.execute();
+                    done = true;
+                }
+            }
+            catch (Exception ignored) {
+                BenchmarkUtils.println("Failed to execute query " + query);
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Create upsert statement depending on the type of database
+     *
+     * @param conn {@link Connection} to get metadata from to determine storage type
+     * @param tblName Target table name.
+     * @return upsert statement with params set
+     * @throws SQLException if failed
+     */
+
+    private static PreparedStatement createUpsertStatement(Connection conn, String tblName) throws SQLException {
+        switch (conn.getMetaData().getDatabaseProductName()) {
+            case "H2":
+                return conn.prepareStatement("merge into " + tblName + " (id, val) values(?, ?)");
+
+            case "Ignite Cache":
+                return conn.prepareStatement("merge into " + '"' + tblName + '"' + '.' + tblName + " (_key, val) values(?, ?)");
+
+            case "MySQL":
+                return conn.prepareStatement("insert into " + tblName + " (id, val) values(?, ?) on duplicate key " +
+                    "update val = ?");
+
+            case "PostgreSQL":
+                return conn.prepareStatement("insert into " + tblName + " (id, val) values(?, ?) on conflict(id) do " +
+                    "update set val = ?");
+
+            default:
+                throw new IgniteException("Unexpected database type [databaseProductName=" +
+                    conn.getMetaData().getDatabaseProductName() + ']');
+        }
+    }
+
+    /**
+     * Set args to prepared upsert statement.
+     *
+     * @param stmt Statement.
+     * @param newKey Key.
+     * @param newVal Value.
+     * @throws SQLException if failed.
+     */
+    private static void setUpsertStatementArgs(PreparedStatement stmt, long newKey, long newVal)
+        throws SQLException {
+        switch (stmt.getConnection().getMetaData().getDatabaseProductName()) {
+            case "H2":
+                // No-op.
+                break;
+
+            case "Ignite Cache":
+                // No-op.
+                break;
+
+            case "MySQL":
+            case "PostgreSQL":
+                stmt.setLong(3, newVal);
+
+                break;
+
+            default:
+                throw new IgniteException("Unexpected database type [databaseProductName=" +
+                    stmt.getConnection().getMetaData().getDatabaseProductName() + ']');
+        }
+        stmt.setLong(1, newKey);
+        stmt.setLong(2, newVal);
+    }
+
+    /**
+     * Fill tables with random data.
+     *
+     * @param tblName name of the table to fill
+     * @param rows number of rows in the table
+     * @throws Exception if failed.
+     */
+    private void fillTable(String tblName, long rows) throws Exception {
+        if (!isIgnite && args.schemaDefinition() == null)
+            return;
+
+        if (isIgnite)
+            startPreloadLogging(args.preloadLogsInterval());
+
+        try (PreparedStatement stmt = createUpsertStatement(conn.get(), tblName)) {
+            for (long i = 0; i < rows; i++) {
+                int newVal = nextRandom(args.range());
+
+                setUpsertStatementArgs(stmt, i, newVal);
+
+                stmt.execute();
+
+                if(i % 1000 == 0)
+                    BenchmarkUtils.println("Inserting " + i + "th value into " + tblName);
+            }
+        }
+        stopPreloadLogging();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Clear caches.
+     */
+    private void clearCaches() {
+        ignite().cache("Accounts").clear();
+        ignite().cache("Tellers").clear();
+        ignite().cache("Branches").clear();
+        ignite().cache("History").clear();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Accounts.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Accounts.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Accounts.java
new file mode 100644
index 0000000..7cc26cf
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Accounts.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.model;
+
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+
+/**
+ * Entity class for benchmark.
+ */
+public class Accounts {
+    /** */
+    @QuerySqlField
+    private long val;
+
+    /** */
+    public Accounts() {
+        // No-op.
+    }
+
+    /**
+     * @param val Id.
+     */
+    public Accounts(long val) {
+        this.val = val;
+    }
+
+    /**
+     * @param val Val.
+     */
+    public Accounts setVal(long val) {
+        this.val = val;
+
+        return this;
+    }
+
+    /**
+     * @return Val.
+     */
+    public long getVal() {
+        return val;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Accounts [val=" + val + ']';
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Branches.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Branches.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Branches.java
new file mode 100644
index 0000000..ab7cf64
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Branches.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.model;
+
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+
+/**
+ * Entity class for benchmark.
+ */
+public class Branches {
+    /** */
+    @QuerySqlField
+    private long val;
+
+    /** */
+    public Branches() {
+        // No-op.
+    }
+
+    /**
+     * @param val Id.
+     */
+    public Branches(long val) {
+        this.val = val;
+    }
+
+    /**
+     * @param val Val.
+     */
+    public Branches setVal(long val) {
+        this.val = val;
+
+        return this;
+    }
+
+    /**
+     * @return Val.
+     */
+    public long getVal() {
+        return val;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Branches [val=" + val + ']';
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/History.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/History.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/History.java
new file mode 100644
index 0000000..751594e
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/History.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.model;
+
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+
+/**
+ * Value used for indexed put test.
+ */
+public class History {
+    /** Value 1. */
+    @QuerySqlField(index = true)
+    private long tid;
+
+    /** Value 2. */
+    @QuerySqlField(index = true)
+    private long bid;
+
+    /** Value 3. */
+    @QuerySqlField(index = true)
+    private long aid;
+
+    /** Value 4. */
+    @QuerySqlField(index = true)
+    private long delta;
+
+    /**
+     * Constructs.
+     *
+     * @param tid Indexed value.
+     */
+    public History(long tid, long bid, long aid, long delta) {
+        this.tid = tid;
+        this.bid = bid;
+        this.aid = aid;
+        this.delta = delta;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        Long result = tid;
+
+        result = 31 * result + bid;
+        result = 31 * result + aid;
+        result = 31 * result + delta;
+
+        return result.intValue();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "History [tid=" + tid + ", bid=" + bid + ", aid=" + aid + ", delta=" + delta +']';
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/409f6e5d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Tellers.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Tellers.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Tellers.java
new file mode 100644
index 0000000..f953b76
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Tellers.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.model;
+
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+
+/**
+ * Entity class for benchmark.
+ */
+public class Tellers {
+    /** */
+    @QuerySqlField
+    private long val;
+
+    /** */
+    public Tellers() {
+        // No-op.
+    }
+
+    /**
+     * @param val Id.
+     */
+    public Tellers(long val) {
+        this.val = val;
+    }
+
+    /**
+     * @param val Val.
+     */
+    public Tellers setVal(long val) {
+        this.val = val;
+
+        return this;
+    }
+
+    /**
+     * @return Val.
+     */
+    public long getVal() {
+        return val;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Tellers [val=" + val + ']';
+    }
+}
\ No newline at end of file


[8/8] ignite git commit: IGNITE-5267 - Fixed compilation after merge from master

Posted by ag...@apache.org.
IGNITE-5267 - Fixed compilation after merge from master


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

Branch: refs/heads/ignite-5267
Commit: c7a7e64237e8a2549d43e5e8ba6a3d77529cc150
Parents: 0d5231e
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Jun 2 14:12:17 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Jun 2 14:12:17 2017 +0300

----------------------------------------------------------------------
 .../processors/query/h2/H2IndexingAbstractGeoSelfTest.java         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c7a7e642/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
index fb6a104..e9f96e3 100644
--- a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
+++ b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
@@ -227,7 +227,7 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
         if (!dynamic)
             cache.destroy();
         else
-            grid.context().cache().dynamicDestroyCache(cache.getName(), true, true);
+            grid.context().cache().dynamicDestroyCache(cache.getName(), true, true, false);
     }
 
     /**


[5/8] ignite git commit: IGNITE-5391: CREATE INDEX and DROP INDEX are now allowed on non-sql caches again :-)

Posted by ag...@apache.org.
IGNITE-5391: CREATE INDEX and DROP INDEX are now allowed on non-sql caches again :-)


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

Branch: refs/heads/ignite-5267
Commit: c7638bc46c32234eb3a37c81a30f1cd1e5d9c984
Parents: fbcd474
Author: devozerov <vo...@gridgain.com>
Authored: Fri Jun 2 12:43:59 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jun 2 12:43:59 2017 +0300

----------------------------------------------------------------------
 .../processors/query/GridQueryProcessor.java    | 10 --------
 .../query/h2/ddl/DdlStatementsProcessor.java    | 26 +-------------------
 .../DynamicIndexAbstractBasicSelfTest.java      | 22 +++++------------
 3 files changed, 7 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c7638bc4/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index bfbfb6c..fef7d4c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -358,14 +358,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
                 msg.onError(new SchemaOperationException(SchemaOperationException.CODE_CACHE_NOT_FOUND, cacheName));
             }
-            else if (!cacheDesc.sql()) {
-                if (log.isDebugEnabled())
-                    log.debug("Received schema propose discovery message, but cache was not created through " +
-                        "CREATE TABLE command (will report error) [opId=" + opId + ", msg=" + msg + ']');;
-
-                msg.onError(new SchemaOperationException("CREATE INDEX and DROP INDEX operations are only allowed on " +
-                    "caches created with CREATE TABLE command [cacheName=" + cacheName + ']'));
-            }
             else {
                 CacheConfiguration ccfg = cacheDesc.cacheConfiguration();
 
@@ -601,8 +593,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         boolean nop = false;
 
         if (cacheExists) {
-            assert cacheDesc.sql();
-
             if (cacheRegistered) {
                 // If cache is started, we perform validation against real schema.
                 T3<QueryTypeDescriptorImpl, Boolean, SchemaOperationException> res = prepareChangeOnStartedCache(op);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7638bc4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index 7051f09..04a0c62 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -28,8 +28,6 @@ import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.cache.query.FieldsQueryCursor;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
 import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
 import org.apache.ignite.internal.processors.query.GridQueryProperty;
@@ -46,7 +44,6 @@ import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser;
 import org.apache.ignite.internal.processors.query.h2.sql.GridSqlStatement;
 import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
-import org.apache.ignite.internal.util.typedef.internal.A;
 import org.h2.command.Prepared;
 import org.h2.command.ddl.CreateIndex;
 import org.h2.command.ddl.CreateTable;
@@ -104,8 +101,6 @@ public class DdlStatementsProcessor {
                 if (tbl == null)
                     throw new SchemaOperationException(SchemaOperationException.CODE_TABLE_NOT_FOUND, cmd.tableName());
 
-                checkSqlCache(tbl.cache());
-
                 assert tbl.rowDescriptor() != null;
 
                 QueryIndex newIdx = new QueryIndex();
@@ -134,13 +129,11 @@ public class DdlStatementsProcessor {
                     newIdx, cmd.ifNotExists());
             }
             else if (stmt0 instanceof GridSqlDropIndex) {
-                GridSqlDropIndex cmd = (GridSqlDropIndex)stmt0;
+                GridSqlDropIndex cmd = (GridSqlDropIndex) stmt0;
 
                 GridH2Table tbl = idx.dataTableForIndex(cmd.schemaName(), cmd.indexName());
 
                 if (tbl != null) {
-                    checkSqlCache(tbl.cache());
-
                     fut = ctx.query().dynamicIndexDrop(tbl.cacheName(), cmd.schemaName(), cmd.indexName(),
                         cmd.ifExists());
                 }
@@ -280,23 +273,6 @@ public class DdlStatementsProcessor {
     }
 
     /**
-     * Check that given context corresponds to an SQL cache.
-     * @param cctx Cache context.
-     * @throws SchemaOperationException if given context does not correspond to an SQL cache.
-     */
-    private static void checkSqlCache(GridCacheContext cctx) throws SchemaOperationException {
-        A.notNull(cctx, "cctx");
-
-        DynamicCacheDescriptor desc = cctx.grid().context().cache().cacheDescriptor(cctx.cacheId());
-
-        assert desc != null;
-
-        if (!desc.sql())
-            throw new SchemaOperationException("CREATE INDEX and DROP INDEX operations are only allowed on caches " +
-                "created with CREATE TABLE command [cacheName=" + cctx.name() + ']');
-    }
-
-    /**
      * @param cmd Statement.
      * @return Whether {@code cmd} is a DDL statement we're able to handle.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7638bc4/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
index cf83319..0b6b0ca 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
@@ -897,28 +897,18 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
     }
 
     /**
-     * Test that operations fail on statically configured cache.
+     * Test that operations work on statically configured cache.
      *
      * @throws Exception If failed.
      */
-    public void testFailOnNonSqlCache() throws Exception {
+    public void testNonSqlCache() throws Exception {
         final QueryIndex idx = index(IDX_NAME_2, field(FIELD_NAME_1));
 
-        assertSchemaException(new RunnableX() {
-            @Override public void run() throws Exception {
-                dynamicIndexCreate(STATIC_CACHE_NAME, TBL_NAME, idx, true);
-            }
-        }, "CREATE INDEX and DROP INDEX operations are only allowed on caches created with CREATE TABLE command " +
-            "[cacheName=cache_static]", IgniteQueryErrorCode.UNKNOWN);
-
-        assertNoIndex(STATIC_CACHE_NAME, TBL_NAME, IDX_NAME_2);
+        dynamicIndexCreate(STATIC_CACHE_NAME, TBL_NAME, idx, true);
+        assertIndex(STATIC_CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
 
-        assertSchemaException(new RunnableX() {
-            @Override public void run() throws Exception {
-                dynamicIndexDrop(STATIC_CACHE_NAME, IDX_NAME_1, true);
-            }
-        }, "CREATE INDEX and DROP INDEX operations are only allowed on caches created with CREATE TABLE command " +
-            "[cacheName=cache_static]", IgniteQueryErrorCode.UNKNOWN);
+        dynamicIndexDrop(STATIC_CACHE_NAME, IDX_NAME_1, true);
+        assertNoIndex(STATIC_CACHE_NAME, TBL_NAME, IDX_NAME_1);
     }
 
     /**


[2/8] ignite git commit: IGNITE-5320: Removed unused parameter from IgniteH2Indexing.executeSqlQueryWithTimer method.

Posted by ag...@apache.org.
IGNITE-5320: Removed unused parameter from IgniteH2Indexing.executeSqlQueryWithTimer method.


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

Branch: refs/heads/ignite-5267
Commit: 802562ecad31e7c6dedc55327179a5aa4a390dc7
Parents: dc78026
Author: devozerov <vo...@gridgain.com>
Authored: Thu Jun 1 16:13:06 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jun 1 16:13:06 2017 +0300

----------------------------------------------------------------------
 .../processors/query/h2/IgniteH2Indexing.java   | 28 +++++++-------------
 .../query/h2/twostep/GridMapQueryExecutor.java  |  2 +-
 .../h2/twostep/GridReduceQueryExecutor.java     | 15 +++++------
 3 files changed, 16 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/802562ec/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index ca591c1..50c8e41 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -839,7 +839,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
                 runs.putIfAbsent(run.id(), run);
 
                 try {
-                    ResultSet rs = executeSqlQueryWithTimer(schemaName, stmt, conn, qry, params, timeout, cancel);
+                    ResultSet rs = executeSqlQueryWithTimer(stmt, conn, qry, params, timeout, cancel);
 
                     return new H2FieldsIterator(rs);
                 }
@@ -943,8 +943,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     /**
      * Executes sql query and prints warning if query is too slow..
      *
-     * @param schema Schema.
-     * @param conn Connection,.
+     * @param conn Connection,
      * @param sql Sql query.
      * @param params Parameters.
      * @param useStmtCache If {@code true} uses stmt cache.
@@ -952,21 +951,15 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @return Result.
      * @throws IgniteCheckedException If failed.
      */
-    public ResultSet executeSqlQueryWithTimer(String schema,
-        Connection conn,
-        String sql,
-        @Nullable Collection<Object> params,
-        boolean useStmtCache,
-        int timeoutMillis,
-        @Nullable GridQueryCancel cancel) throws IgniteCheckedException {
-        return executeSqlQueryWithTimer(schema, preparedStatementWithParams(conn, sql, params, useStmtCache),
+    public ResultSet executeSqlQueryWithTimer(Connection conn, String sql, @Nullable Collection<Object> params,
+        boolean useStmtCache, int timeoutMillis, @Nullable GridQueryCancel cancel) throws IgniteCheckedException {
+        return executeSqlQueryWithTimer(preparedStatementWithParams(conn, sql, params, useStmtCache),
             conn, sql, params, timeoutMillis, cancel);
     }
 
     /**
      * Executes sql query and prints warning if query is too slow.
      *
-     * @param schema Schema.
      * @param stmt Prepared statement for query.
      * @param conn Connection.
      * @param sql Sql query.
@@ -975,12 +968,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @return Result.
      * @throws IgniteCheckedException If failed.
      */
-    private ResultSet executeSqlQueryWithTimer(String schema, PreparedStatement stmt,
-        Connection conn,
-        String sql,
-        @Nullable Collection<Object> params,
-        int timeoutMillis,
-        @Nullable GridQueryCancel cancel) throws IgniteCheckedException {
+    private ResultSet executeSqlQueryWithTimer(PreparedStatement stmt, Connection conn, String sql,
+        @Nullable Collection<Object> params, int timeoutMillis, @Nullable GridQueryCancel cancel)
+        throws IgniteCheckedException {
         long start = U.currentTimeMillis();
 
         try {
@@ -1135,7 +1125,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         runs.put(run.id(), run);
 
         try {
-            ResultSet rs = executeSqlQueryWithTimer(schemaName, conn, sql, params, true, 0, cancel);
+            ResultSet rs = executeSqlQueryWithTimer(conn, sql, params, true, 0, cancel);
 
             return new H2KeyValueIterator(rs);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/802562ec/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index afaf68d..23504ad 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -610,7 +610,7 @@ public class GridMapQueryExecutor {
                     // If we are not the target node for this replicated query, just ignore it.
                     if (qry.node() == null ||
                         (segmentId == 0 && qry.node().equals(ctx.localNodeId()))) {
-                        rs = h2.executeSqlQueryWithTimer(h2.schema(mainCctx.name()), conn, qry.query(),
+                        rs = h2.executeSqlQueryWithTimer(conn, qry.query(),
                             F.asList(qry.parameters(params)), true,
                             timeout,
                             qr.cancels[qryIdx]);

http://git-wip-us.apache.org/repos/asf/ignite/blob/802562ec/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 5c8870e..2d12635 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -791,12 +791,11 @@ public class GridReduceQueryExecutor {
 
                         try {
                             if (qry.explain())
-                                return explainPlan(r.connection(), schemaName, qry, params);
+                                return explainPlan(r.connection(), qry, params);
 
                             GridCacheSqlQuery rdc = qry.reduceQuery();
 
-                            ResultSet res = h2.executeSqlQueryWithTimer(schemaName,
-                                r.connection(),
+                            ResultSet res = h2.executeSqlQueryWithTimer(r.connection(),
                                 rdc.query(),
                                 F.asList(rdc.parameters(params)),
                                 false, // The statement will cache some extra thread local objects.
@@ -1210,19 +1209,18 @@ public class GridReduceQueryExecutor {
 
     /**
      * @param c Connection.
-     * @param schema Schema.
      * @param qry Query.
      * @param params Query parameters.
      * @return Cursor for plans.
      * @throws IgniteCheckedException if failed.
      */
-    private Iterator<List<?>> explainPlan(JdbcConnection c, String schema, GridCacheTwoStepQuery qry, Object[] params)
+    private Iterator<List<?>> explainPlan(JdbcConnection c, GridCacheTwoStepQuery qry, Object[] params)
         throws IgniteCheckedException {
         List<List<?>> lists = new ArrayList<>();
 
         for (int i = 0, mapQrys = qry.mapQueries().size(); i < mapQrys; i++) {
-            ResultSet rs = h2.executeSqlQueryWithTimer(schema, c,
-                "SELECT PLAN FROM " + mergeTableIdentifier(i), null, false, 0, null);
+            ResultSet rs =
+                h2.executeSqlQueryWithTimer(c, "SELECT PLAN FROM " + mergeTableIdentifier(i), null, false, 0, null);
 
             lists.add(F.asList(getPlan(rs)));
         }
@@ -1237,8 +1235,7 @@ public class GridReduceQueryExecutor {
 
         GridCacheSqlQuery rdc = qry.reduceQuery();
 
-        ResultSet rs = h2.executeSqlQueryWithTimer(schema,
-            c,
+        ResultSet rs = h2.executeSqlQueryWithTimer(c,
             "EXPLAIN " + rdc.query(),
             F.asList(rdc.parameters(params)),
             false,


[3/8] ignite git commit: Merge remote-tracking branch 'origin/master'

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/ignite-5267
Commit: bc30dc7ccd09763c7e392d911fe62f529e36ae3b
Parents: 802562e 409f6e5
Author: devozerov <vo...@gridgain.com>
Authored: Thu Jun 1 16:13:33 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jun 1 16:13:33 2017 +0300

----------------------------------------------------------------------
 .../utils/PlatformConfigurationUtils.java       |  40 +---
 .../yardstick/config/ignite-db-base-config.xml  | 118 ++++++++++
 .../config/ignite-db-localhost-config.xml       |  53 +++++
 .../yardstick/config/ignite-rdbms-config.xml    |  70 ++++++
 .../config/sql/benchmark-jdbc-ignite.properties |  64 ++++++
 .../sql/benchmark-mysql-ignite.properties       |  66 ++++++
 .../config/sql/benchmark-native.properties      |  62 ++++++
 .../sql/benchmark-pgsql-ignite.properties       |  66 ++++++
 modules/yardstick/config/sql/db-h2-queries.sql  |   9 +
 .../yardstick/config/sql/db-mysql-queries.sql   |  14 ++
 .../yardstick/config/sql/db-pgsql-queries.sql   |  14 ++
 .../yardstick/config/sql/h2-insert-query.sql    |   1 +
 .../yardstick/config/sql/rdbms-mysql-schema.sql |   5 +
 .../yardstick/config/sql/rdbms-pgsql-schema.sql |  10 +
 .../yardstick/IgniteBenchmarkArguments.java     |  46 +++-
 .../cache/jdbc/IgniteNativeTxBenchmark.java     | 169 ++++++++++++++
 .../cache/jdbc/JdbcAbstractBenchmark.java       |  51 ++++-
 .../yardstick/cache/jdbc/JdbcPutBenchmark.java  |   3 -
 .../yardstick/cache/jdbc/RdbmsBenchmark.java    | 220 +++++++++++++++++++
 .../ignite/yardstick/cache/model/Accounts.java  |  62 ++++++
 .../ignite/yardstick/cache/model/Branches.java  |  62 ++++++
 .../ignite/yardstick/cache/model/History.java   |  69 ++++++
 .../ignite/yardstick/cache/model/Tellers.java   |  62 ++++++
 23 files changed, 1287 insertions(+), 49 deletions(-)
----------------------------------------------------------------------



[7/8] ignite git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-5267

Posted by ag...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-5267


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

Branch: refs/heads/ignite-5267
Commit: 0d5231e6428a83ba9b862be58d9978d44bd58ca6
Parents: 281d105 34409fd
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Jun 2 12:56:04 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Jun 2 12:56:04 2017 +0300

----------------------------------------------------------------------
 .../processors/query/GridQueryProcessor.java    |  10 -
 .../query/h2/H2IndexingAbstractGeoSelfTest.java |  27 +-
 .../processors/query/h2/IgniteH2Indexing.java   |  28 +-
 .../query/h2/ddl/DdlStatementsProcessor.java    |  26 +-
 .../query/h2/twostep/GridMapQueryExecutor.java  |   2 +-
 .../h2/twostep/GridReduceQueryExecutor.java     |  15 +-
 .../DynamicIndexAbstractBasicSelfTest.java      |  22 +-
 .../Apache.Ignite.Core.Tests.csproj             |   1 +
 .../Binary/BinarySelfTest.cs                    |   2 +-
 .../Binary/EnumsTest.cs                         | 299 ++++++++++++++++++-
 .../Binary/EnumsTestOnline.cs                   |  45 +++
 .../Impl/Binary/BinaryReader.cs                 |   9 +-
 .../Impl/Binary/BinaryReflectiveActions.cs      |  11 +-
 .../Impl/Binary/BinaryUtils.cs                  |   2 +
 .../Impl/Binary/BinaryWriter.cs                 |   4 +-
 .../yardstick/config/ignite-db-base-config.xml  | 118 ++++++++
 .../config/ignite-db-localhost-config.xml       |  53 ++++
 .../yardstick/config/ignite-rdbms-config.xml    |  70 +++++
 .../config/sql/benchmark-jdbc-ignite.properties |  64 ++++
 .../sql/benchmark-mysql-ignite.properties       |  66 ++++
 .../config/sql/benchmark-native.properties      |  62 ++++
 .../sql/benchmark-pgsql-ignite.properties       |  66 ++++
 modules/yardstick/config/sql/db-h2-queries.sql  |   9 +
 .../yardstick/config/sql/db-mysql-queries.sql   |  14 +
 .../yardstick/config/sql/db-pgsql-queries.sql   |  14 +
 .../yardstick/config/sql/h2-insert-query.sql    |   1 +
 .../yardstick/config/sql/rdbms-mysql-schema.sql |   5 +
 .../yardstick/config/sql/rdbms-pgsql-schema.sql |  10 +
 .../yardstick/IgniteBenchmarkArguments.java     |  46 ++-
 .../cache/jdbc/IgniteNativeTxBenchmark.java     | 169 +++++++++++
 .../cache/jdbc/JdbcAbstractBenchmark.java       |  51 +++-
 .../yardstick/cache/jdbc/JdbcPutBenchmark.java  |   3 -
 .../yardstick/cache/jdbc/RdbmsBenchmark.java    | 220 ++++++++++++++
 .../ignite/yardstick/cache/model/Accounts.java  |  62 ++++
 .../ignite/yardstick/cache/model/Branches.java  |  62 ++++
 .../ignite/yardstick/cache/model/History.java   |  69 +++++
 .../ignite/yardstick/cache/model/Tellers.java   |  62 ++++
 37 files changed, 1678 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0d5231e6/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d5231e6/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/0d5231e6/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
----------------------------------------------------------------------


[4/8] ignite git commit: IGNITE=5243: Fixed test failures for geo-spatial indexing.

Posted by ag...@apache.org.
IGNITE=5243: Fixed test failures for geo-spatial indexing.


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

Branch: refs/heads/ignite-5267
Commit: fbcd474303e434d8ffb46468f5a39f6c5ac0d9bb
Parents: bc30dc7
Author: devozerov <vo...@gridgain.com>
Authored: Thu Jun 1 19:57:51 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jun 1 19:57:51 2017 +0300

----------------------------------------------------------------------
 .../query/h2/H2IndexingAbstractGeoSelfTest.java | 27 ++++++++++++++++----
 1 file changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fbcd4743/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
index 7f135fd..fb6a104 100644
--- a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
+++ b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.cache.query.SqlQuery;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
 import org.apache.ignite.internal.processors.query.QueryUtils;
@@ -137,7 +138,9 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
 
             entity.setIndexes(null);
 
-            IgniteCache<K, V> cache = grid(0).getOrCreateCache(ccfg);
+            grid(0).context().cache().dynamicStartSqlCache(ccfg).get();
+
+            IgniteCache<K, V> cache = grid(0).cache(name);
 
             // Process indexes dynamically.
             for (QueryIndex idx : idxs) {
@@ -214,6 +217,20 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
     }
 
     /**
+     * Destroy cache.
+     *
+     * @param cache Cache.
+     * @param grid Node.
+     * @param dynamic Dynamic flag.
+     */
+    private static void destroy(IgniteCache cache, IgniteEx grid, boolean dynamic) {
+        if (!dynamic)
+            cache.destroy();
+        else
+            grid.context().cache().dynamicDestroyCache(cache.getName(), true, true);
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testPrimitiveGeometry() throws Exception {
@@ -323,7 +340,7 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
                 cache.query(new SqlFieldsQuery("DROP INDEX \"EnemyCamp_coords_idx\"")).getAll();
         }
         finally {
-            cache.destroy();
+            destroy(cache, grid(0), dynamic);
         }
     }
 
@@ -452,7 +469,7 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
                 throw err0;
         }
         finally {
-            cache1.destroy();
+            destroy(cache1, grid(0), dynamic);
         }
     }
 
@@ -540,8 +557,8 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
             checkLocalQuery();
         }
         finally {
-            c1.destroy();
-            c2.destroy();
+            destroy(c1, grid(0), dynamic);
+            destroy(c2, grid(0), dynamic);
         }
     }
 


[6/8] ignite git commit: IGNITE-5358 .NET: Fix nullable enum field handling in binary objects

Posted by ag...@apache.org.
IGNITE-5358 .NET: Fix nullable enum field handling in binary objects

This closes #2048


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

Branch: refs/heads/ignite-5267
Commit: 34409fd59374a8fad31c592a5517e8d80a032cff
Parents: c7638bc
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Jun 2 12:53:57 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Jun 2 12:53:57 2017 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.Tests.csproj             |   1 +
 .../Binary/BinarySelfTest.cs                    |   2 +-
 .../Binary/EnumsTest.cs                         | 299 ++++++++++++++++++-
 .../Binary/EnumsTestOnline.cs                   |  45 +++
 .../Impl/Binary/BinaryReader.cs                 |   9 +-
 .../Impl/Binary/BinaryReflectiveActions.cs      |  11 +-
 .../Impl/Binary/BinaryUtils.cs                  |   2 +
 .../Impl/Binary/BinaryWriter.cs                 |   4 +-
 8 files changed, 348 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/34409fd5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 6d4f34b..d459d2a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -75,6 +75,7 @@
     <Compile Include="Binary\BinaryNameMapperTest.cs" />
     <Compile Include="Binary\BinaryReaderWriterTest.cs" />
     <Compile Include="Binary\BinarySelfTestSimpleName.cs" />
+    <Compile Include="Binary\EnumsTestOnline.cs" />
     <Compile Include="Deployment\GetAddressFunc.cs" />
     <Compile Include="Deployment\PeerAssemblyLoadingAllApisTest.cs" />
     <Compile Include="Deployment\PeerAssemblyLoadingVersioningTest.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/34409fd5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
index bae126f..2b22d5a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
@@ -593,7 +593,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             Assert.AreEqual(marsh.Unmarshal<TestEnum>(data), val);
 
-            var binEnum = marsh.Unmarshal<IBinaryObject>(data, true);
+            var binEnum = marsh.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary);
 
             Assert.AreEqual(val, (TestEnum) binEnum.EnumValue);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/34409fd5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTest.cs
index ab54f16..18ef29a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTest.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Tests.Binary
     using System;
     using System.Runtime.Serialization;
     using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Impl;
     using Apache.Ignite.Core.Impl.Binary;
     using Apache.Ignite.Core.Impl.Common;
     using NUnit.Framework;
@@ -65,7 +66,9 @@ namespace Apache.Ignite.Core.Tests.Binary
         /// </summary>
         private static void CheckValue<T>(T val, bool isBinaryEnum = true)
         {
-            var marsh = new Marshaller(null) {CompactFooter = false};
+            var marsh = GetMarshaller();
+            var ignite = Ignition.TryGetIgnite();
+
             var bytes = marsh.Marshal(val);
             var res = marsh.Unmarshal<T>(bytes);
             var binRes = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
@@ -76,8 +79,17 @@ namespace Apache.Ignite.Core.Tests.Binary
             if (isBinaryEnum)
             {
                 Assert.AreEqual(TypeCaster<int>.Cast(val), binRes.EnumValue);
-                Assert.AreEqual(string.Format("BinaryEnum [typeId={0}, enumValue={1}]",
-                    BinaryUtils.GetStringHashCode(typeof(T).FullName), binRes.EnumValue), binRes.ToString());
+
+                if (ignite != null)
+                {
+                    Assert.AreEqual(string.Format("{0} [typeId={1}, enumValue={2}, enumValueName={3}]",
+                        typeof(T).FullName, binRes.GetBinaryType().TypeId, binRes.EnumValue, val), binRes.ToString());
+                }
+                else
+                {
+                    Assert.AreEqual(string.Format("BinaryEnum [typeId={0}, enumValue={1}]",
+                        BinaryUtils.GetStringHashCode(typeof(T).FullName), binRes.EnumValue), binRes.ToString());
+                }
             }
             else
             {
@@ -85,10 +97,73 @@ namespace Apache.Ignite.Core.Tests.Binary
             }
 
             // Check array.
-            var arr = new[] {val, val};
-            var arrRes = TestUtils.SerializeDeserialize(arr);
+            CheckSerializeDeserialize(new[] {val, val});
+
+            // Check caching.
+            if (ignite != null)
+            {
+                var cache = ignite.GetOrCreateCache<int, T>(typeof(T).FullName);
+                var binCache = cache.WithKeepBinary<int, IBinaryObject>();
+
+                cache[1] = val;
+                res = cache[1];
+                binRes = binCache[1];
+
+                Assert.AreEqual(val, res);
+                Assert.AreEqual(val, binRes.Deserialize<T>());
+
+                var arrCache = ignite.GetOrCreateCache<int, T[]>(typeof(T[]).FullName);
+                arrCache[1] = new[] {val, val};
+                Assert.AreEqual(new[] { val, val }, arrCache[1]);
+            }
+        }
+
+        /// <summary>
+        /// Gets the marshaller.
+        /// </summary>
+        private static Marshaller GetMarshaller()
+        {
+            var ignite = Ignition.TryGetIgnite();
+
+            return ignite != null
+                ? ((Ignite) ignite).Marshaller
+                : new Marshaller(null) {CompactFooter = false};
+        }
+
+        /// <summary>
+        /// Serializes and deserializes a value.
+        /// </summary>
+        private static void CheckSerializeDeserialize<T>(T val, bool cacheOnly = false)
+        {
+            if (!cacheOnly)
+            {
+                var marsh = GetMarshaller();
+
+                var res = marsh.Unmarshal<T>(marsh.Marshal(val));
+                Assert.AreEqual(val, res);
+            }
+
+            var ignite = Ignition.TryGetIgnite();
+
+            if (ignite != null)
+            {
+                var cache = ignite.GetOrCreateCache<int, T>(typeof(T).FullName);
+
+                cache.Put(1, val);
+                var res = cache.Get(1);
 
-            Assert.AreEqual(arr, arrRes);
+                Assert.AreEqual(val, res);
+            }
+        }
+
+        /// <summary>
+        /// Convert to IBinaryObject.
+        /// </summary>
+        private static IBinaryObject ToBinary<T>(T val)
+        {
+            var marsh = GetMarshaller();
+
+            return marsh.Unmarshal<IBinaryObject>(marsh.Marshal(val), BinaryMode.ForceBinary);
         }
 
         /// <summary>
@@ -100,8 +175,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             // Min values.
             var val = new EnumsBinarizable();
             
-            var res = TestUtils.SerializeDeserialize(val);
-            Assert.AreEqual(val, res);
+            CheckSerializeDeserialize(val);
 
             // Max values.
             val = new EnumsBinarizable
@@ -116,8 +190,61 @@ namespace Apache.Ignite.Core.Tests.Binary
                 UShort = UShortEnum.Bar
             };
 
-            res = TestUtils.SerializeDeserialize(val);
-            Assert.AreEqual(val, res);
+            CheckSerializeDeserialize(val);
+        }
+
+        /// <summary>
+        /// Tests enums as a BinaryObject field in binarizable object.
+        /// </summary>
+        [Test]
+        public void TestBinarizableFieldAsBinaryObject()
+        {
+            // Null values.
+            var val = new EnumsBinaryForm();
+            
+            CheckSerializeDeserialize(val);
+
+            // Max values.
+            val = new EnumsBinaryForm
+            {
+                Byte = ToBinary(ByteEnum.Bar),
+                Int = ToBinary(IntEnum.Bar),
+                Long = ToBinary(LongEnum.Bar),
+                SByte = ToBinary(SByteEnum.Bar),
+                Short = ToBinary(ShortEnum.Bar),
+                UInt = ToBinary(UIntEnum.Bar),
+                ULong = ToBinary(ULongEnum.Bar),
+                UShort = ToBinary(UShortEnum.Bar)
+            };
+
+            CheckSerializeDeserialize(val, true);
+        }
+
+        /// <summary>
+        /// Tests enums as a nullable field in binarizable object.
+        /// </summary>
+        [Test]
+        public void TestBinarizableNullableField()
+        {
+            // Default values.
+            var val = new EnumsBinarizableNullable();
+            
+            CheckSerializeDeserialize(val);
+
+            // Max values.
+            val = new EnumsBinarizableNullable
+            {
+                Byte = ByteEnum.Bar,
+                Int = IntEnum.Bar,
+                Long = LongEnum.Bar,
+                SByte = SByteEnum.Bar,
+                Short = ShortEnum.Bar,
+                UInt = UIntEnum.Bar,
+                ULong = ULongEnum.Bar,
+                UShort = UShortEnum.Bar
+            };
+
+            CheckSerializeDeserialize(val);
         }
 
         /// <summary>
@@ -129,8 +256,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             // Min values.
             var val = new EnumsSerializable();
 
-            var res = TestUtils.SerializeDeserialize(val);
-            Assert.AreEqual(val, res);
+            CheckSerializeDeserialize(val);
 
             // Max values.
             val = new EnumsSerializable
@@ -145,8 +271,34 @@ namespace Apache.Ignite.Core.Tests.Binary
                 UShort = UShortEnum.Bar
             };
 
-            res = TestUtils.SerializeDeserialize(val);
-            Assert.AreEqual(val, res);
+            CheckSerializeDeserialize(val);
+        }
+
+        /// <summary>
+        /// Tests enums as a nullable field in ISerializable object.
+        /// </summary>
+        [Test]
+        public void TestSerializableNullableField()
+        {
+            // Default values.
+            var val = new EnumsSerializableNullable();
+
+            CheckSerializeDeserialize(val);
+
+            // Max values.
+            val = new EnumsSerializableNullable
+            {
+                Byte = ByteEnum.Bar,
+                Int = IntEnum.Bar,
+                Long = LongEnum.Bar,
+                SByte = SByteEnum.Bar,
+                Short = ShortEnum.Bar,
+                UInt = UIntEnum.Bar,
+                ULong = ULongEnum.Bar,
+                UShort = UShortEnum.Bar
+            };
+
+            CheckSerializeDeserialize(val);
         }
 
         private enum ByteEnum : byte
@@ -240,6 +392,92 @@ namespace Apache.Ignite.Core.Tests.Binary
             }
         }
 
+        private class EnumsBinaryForm
+        {
+            public IBinaryObject Byte { get; set; }
+            public IBinaryObject SByte { get; set; }
+            public IBinaryObject Short { get; set; }
+            public IBinaryObject UShort { get; set; }
+            public IBinaryObject Int { get; set; }
+            public IBinaryObject UInt { get; set; }
+            public IBinaryObject Long { get; set; }
+            public IBinaryObject ULong { get; set; }
+
+            private bool Equals(EnumsBinaryForm other)
+            {
+                return Equals(Byte, other.Byte) && Equals(SByte, other.SByte) && Equals(Short, other.Short) &&
+                       Equals(UShort, other.UShort) && Equals(Int, other.Int) && Equals(UInt, other.UInt) &&
+                       Equals(Long, other.Long) && Equals(ULong, other.ULong);
+            }
+
+            public override bool Equals(object obj)
+            {
+                if (ReferenceEquals(null, obj)) return false;
+                if (ReferenceEquals(this, obj)) return true;
+                if (obj.GetType() != GetType()) return false;
+                return Equals((EnumsBinaryForm) obj);
+            }
+
+            public override int GetHashCode()
+            {
+                unchecked
+                {
+                    var hashCode = (Byte != null ? Byte.GetHashCode() : 0);
+                    hashCode = (hashCode*397) ^ (SByte != null ? SByte.GetHashCode() : 0);
+                    hashCode = (hashCode*397) ^ (Short != null ? Short.GetHashCode() : 0);
+                    hashCode = (hashCode*397) ^ (UShort != null ? UShort.GetHashCode() : 0);
+                    hashCode = (hashCode*397) ^ (Int != null ? Int.GetHashCode() : 0);
+                    hashCode = (hashCode*397) ^ (UInt != null ? UInt.GetHashCode() : 0);
+                    hashCode = (hashCode*397) ^ (Long != null ? Long.GetHashCode() : 0);
+                    hashCode = (hashCode*397) ^ (ULong != null ? ULong.GetHashCode() : 0);
+                    return hashCode;
+                }
+            }
+        }
+
+        private class EnumsBinarizableNullable
+        {
+            public ByteEnum? Byte { get; set; }
+            public SByteEnum? SByte { get; set; }
+            public ShortEnum? Short { get; set; }
+            public UShortEnum? UShort { get; set; }
+            public IntEnum? Int { get; set; }
+            public UIntEnum? UInt { get; set; }
+            public LongEnum? Long { get; set; }
+            public ULongEnum? ULong { get; set; }
+
+            private bool Equals(EnumsBinarizableNullable other)
+            {
+                return Byte == other.Byte && SByte == other.SByte && Short == other.Short 
+                    && UShort == other.UShort && Int == other.Int && UInt == other.UInt 
+                    && Long == other.Long && ULong == other.ULong;
+            }
+
+            public override bool Equals(object obj)
+            {
+                if (ReferenceEquals(null, obj)) return false;
+                if (ReferenceEquals(this, obj)) return true;
+                if (obj.GetType() != GetType()) return false;
+                return Equals((EnumsBinarizableNullable) obj);
+            }
+
+            public override int GetHashCode()
+            {
+                unchecked
+                {
+                    var hashCode = Byte.GetHashCode();
+                    hashCode = (hashCode*397) ^ SByte.GetHashCode();
+                    hashCode = (hashCode*397) ^ Short.GetHashCode();
+                    hashCode = (hashCode*397) ^ UShort.GetHashCode();
+                    hashCode = (hashCode*397) ^ Int.GetHashCode();
+                    hashCode = (hashCode*397) ^ UInt.GetHashCode();
+                    hashCode = (hashCode*397) ^ Long.GetHashCode();
+                    hashCode = (hashCode*397) ^ ULong.GetHashCode();
+                    return hashCode;
+                }
+            }
+        }
+
         [Serializable]
         private class EnumsSerializable : EnumsBinarizable, ISerializable
         {
@@ -272,5 +510,38 @@ namespace Apache.Ignite.Core.Tests.Binary
                 info.AddValue("ulong", ULong);
             }
         }
+
+        [Serializable]
+        private class EnumsSerializableNullable : EnumsBinarizableNullable, ISerializable
+        {
+            public EnumsSerializableNullable()
+            {
+                // No-op.
+            }
+
+            protected EnumsSerializableNullable(SerializationInfo info, StreamingContext context)
+            {
+                Byte = (ByteEnum?) info.GetValue("byte", typeof(ByteEnum));
+                SByte = (SByteEnum?) info.GetValue("sbyte", typeof(SByteEnum));
+                Short = (ShortEnum?) info.GetValue("short", typeof(ShortEnum));
+                UShort = (UShortEnum?) info.GetValue("ushort", typeof(UShortEnum));
+                Int = (IntEnum?) info.GetValue("int", typeof(IntEnum));
+                UInt = (UIntEnum?) info.GetValue("uint", typeof(UIntEnum));
+                Long = (LongEnum?) info.GetValue("long", typeof(LongEnum));
+                ULong = (ULongEnum?) info.GetValue("ulong", typeof(ULongEnum));
+            }
+
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                info.AddValue("byte", Byte);
+                info.AddValue("sbyte", SByte);
+                info.AddValue("short", Short);
+                info.AddValue("ushort", UShort);
+                info.AddValue("int", Int);
+                info.AddValue("uint", UInt);
+                info.AddValue("long", Long);
+                info.AddValue("ulong", ULong);
+            }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/34409fd5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTestOnline.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTestOnline.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTestOnline.cs
new file mode 100644
index 0000000..0c82696
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTestOnline.cs
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary
+{
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Enums test with Ignite running.
+    /// </summary>
+    public class EnumsTestOnline : EnumsTest
+    {
+        /// <summary>
+        /// Sets up the fixture.
+        /// </summary>
+        [TestFixtureSetUp]
+        public void FixtureSetUp()
+        {
+            Ignition.Start(TestUtils.GetTestConfiguration());
+        }
+
+        /// <summary>
+        /// Tears down the fixture.
+        /// </summary>
+        [TestFixtureTearDown]
+        public void FixtureTearDown()
+        {
+            Ignition.StopAll(true);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/34409fd5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
index e38085c..4b4b471 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -401,9 +401,10 @@ namespace Apache.Ignite.Core.Impl.Binary
                     return default(T);
 
                 case BinaryUtils.TypeEnum:
+                    return ReadEnum0<T>(this, _mode == BinaryMode.ForceBinary);
+
                 case BinaryUtils.TypeBinaryEnum:
-                    // Never read enums in binary mode when reading a field (we do not support half-binary objects)
-                    return ReadEnum0<T>(this, false);  
+                    return ReadEnum0<T>(this, _mode != BinaryMode.Deserialize);
 
                 case BinaryUtils.HdrFull:
                     // Unregistered enum written as serializable
@@ -583,6 +584,10 @@ namespace Apache.Ignite.Core.Impl.Binary
                     return true;
 
                 case BinaryUtils.TypeEnum:
+                    res = ReadEnum0<T>(this, _mode == BinaryMode.ForceBinary);
+
+                    return true;
+
                 case BinaryUtils.TypeBinaryEnum:
                     res = ReadEnum0<T>(this, _mode != BinaryMode.Deserialize);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/34409fd5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
index b061be2..97964cf 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
@@ -422,11 +422,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             var type = field.FieldType;
 
-            var genericDef = type.IsGenericType ? type.GetGenericTypeDefinition() : null;
-
-            bool nullable = genericDef == typeof (Nullable<>);
-
-            var nullableType = nullable ? type.GetGenericArguments()[0] : null;
+            var nullableType = Nullable.GetUnderlyingType(type);
 
             if (type == typeof (decimal))
             {
@@ -455,14 +451,15 @@ namespace Apache.Ignite.Core.Impl.Binary
                     ? GetRawReader(field, r => r.ReadObject<Guid>())
                     : GetReader(field, (f, r) => r.ReadObject<Guid>(f));
             }
-            else if (nullable && nullableType == typeof (Guid))
+            else if (nullableType == typeof (Guid))
             {
                 writeAction = raw
                     ? GetRawWriter<Guid?>(field, (w, o) => w.WriteGuid(o))
                     : GetWriter<Guid?>(field, (f, w, o) => w.WriteGuid(f, o));
                 readAction = raw ? GetRawReader(field, r => r.ReadGuid()) : GetReader(field, (f, r) => r.ReadGuid(f));
             }
-            else if (type.IsEnum && !new[] {typeof(long), typeof(ulong)}.Contains(Enum.GetUnderlyingType(type)))
+            else if ((nullableType ?? type).IsEnum && 
+                !new[] {typeof(long), typeof(ulong)}.Contains(Enum.GetUnderlyingType(nullableType ?? type)))
             {
                 writeAction = raw
                     ? GetRawWriter<object>(field, (w, o) => w.WriteEnum(o), true)

http://git-wip-us.apache.org/repos/asf/ignite/blob/34409fd5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index 2ac617e..91a536e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -1787,6 +1787,8 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             Debug.Assert(type != null);
 
+            type = Nullable.GetUnderlyingType(type) ?? type;
+
             if (!type.IsEnum)
                 return false;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/34409fd5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index da2b371..43a73912 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -861,7 +861,9 @@ namespace Apache.Ignite.Core.Impl.Binary
                 WriteNullField();
             else
             {
-                var type = val.GetType();
+                // Unwrap nullable.
+                var valType = val.GetType();
+                var type = Nullable.GetUnderlyingType(valType) ?? valType;
 
                 if (!type.IsEnum)
                 {