Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 472E8200B54 for ; Thu, 28 Jul 2016 13:06:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4606F160A63; Thu, 28 Jul 2016 11:06:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 06DA9160AB7 for ; Thu, 28 Jul 2016 13:06:28 +0200 (CEST) Received: (qmail 41388 invoked by uid 500); 28 Jul 2016 11:06:28 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 39878 invoked by uid 99); 28 Jul 2016 11:06:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2016 11:06:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 49DA1E00A7; Thu, 28 Jul 2016 11:06:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Thu, 28 Jul 2016 11:07:09 -0000 Message-Id: <519118c36c58411da568ee61bba8ceab@git.apache.org> In-Reply-To: <0d8c3e3a80e84a878afe226c18aa4223@git.apache.org> References: <0d8c3e3a80e84a878afe226c18aa4223@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [44/50] [abbrv] ignite git commit: ignite-1232 Added possibility to test distributedJoins in IgniteCacheRandomOperationBenchmark archived-at: Thu, 28 Jul 2016 11:06:31 -0000 ignite-1232 Added possibility to test distributedJoins in IgniteCacheRandomOperationBenchmark Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2f36ae55 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2f36ae55 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2f36ae55 Branch: refs/heads/ignite-3553 Commit: 2f36ae559a83dc9d294de100e11fb4bbf3bae248 Parents: 77781e9 Author: sboikov Authored: Wed Jul 27 14:56:31 2016 +0300 Committer: sboikov Committed: Wed Jul 27 14:56:31 2016 +0300 ---------------------------------------------------------------------- modules/yardstick/config/queries.sql | 1 + .../IgniteCacheRandomOperationBenchmark.java | 71 ++++++++++++++++---- 2 files changed, 60 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/2f36ae55/modules/yardstick/config/queries.sql ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/queries.sql b/modules/yardstick/config/queries.sql index 8271100..7326b31 100644 --- a/modules/yardstick/config/queries.sql +++ b/modules/yardstick/config/queries.sql @@ -1,2 +1,3 @@ SELECT Person.firstName FROM "query".Person, "orgCache".Organization WHERE Person.orgId = Organization.id AND lower(Organization.name) = lower('Organization 55') SELECT Organization.name FROM "orgCache".Organization WHERE lower(Organization.name) LIKE lower('%55%') +SELECT Person.firstName FROM "query".Person, "orgCache".Organization WHERE Person.orgId = Organization.id AND lower(Organization.name) = lower('Organization 55') #distributedJoins http://git-wip-us.apache.org/repos/asf/ignite/blob/2f36ae55/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java index e62df45..d37cdca 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java @@ -61,6 +61,7 @@ import org.apache.ignite.cache.query.SqlQuery; import org.apache.ignite.cluster.ClusterGroup; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.lang.IgniteRunnable; import org.apache.ignite.resources.IgniteInstanceResource; @@ -110,7 +111,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark private Map> cacheSqlDescriptors; /** List of SQL queries. */ - private List queries; + private List queries; /** List of allowed cache operations which will be executed. */ private List allowedLoadTestOps; @@ -237,7 +238,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark throw new IgniteException("Class is unknown for the load test. Make sure you " + "specified its full name [clsName=" + queryEntity.getKeyType() + ']'); - cofigureCacheSqlDescriptor(cacheName, queryEntity, valCls); + configureCacheSqlDescriptor(cacheName, queryEntity, valCls); } } catch (ClassNotFoundException e) { BenchmarkUtils.println(e.getMessage()); @@ -307,11 +308,13 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark */ private void loadAllowedOperations() { allowedLoadTestOps = new ArrayList<>(); + if (args.allowedLoadTestOps().isEmpty()) Collections.addAll(allowedLoadTestOps, Operation.values()); - else + else { for (String opName : args.allowedLoadTestOps()) allowedLoadTestOps.add(Operation.valueOf(opName.toUpperCase())); + } } /** @@ -330,7 +333,24 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark if (line.trim().isEmpty()) continue; - queries.add(line.trim()); + boolean distributedJoins = false; + + int commentIdx = line.lastIndexOf('#'); + + if (commentIdx >= 0) { + if (line.toUpperCase().indexOf("DISTRIBUTEDJOINS", commentIdx) > 0) + distributedJoins = true; + + line = line.substring(0, commentIdx); + } + + line = line.trim(); + + TestQuery qry = new TestQuery(line, distributedJoins); + + queries.add(qry); + + BenchmarkUtils.println("Loaded query: " + qry); } } } @@ -343,7 +363,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark * @param valCls Class of value. * @throws ClassNotFoundException If fail. */ - private void cofigureCacheSqlDescriptor(String cacheName, QueryEntity qryEntity, Class valCls) + private void configureCacheSqlDescriptor(String cacheName, QueryEntity qryEntity, Class valCls) throws ClassNotFoundException { List descs = cacheSqlDescriptors.get(cacheName); @@ -883,9 +903,13 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark } } else { - String sql = rendomizeSql(); + TestQuery qry = queries.get(nextRandom(queries.size())); + + String sql = randomizeSql(qry.sql); sq = new SqlFieldsQuery(sql); + + ((SqlFieldsQuery)sq).setDistributedJoins(qry.distributedJoin); } if (sq != null) @@ -900,14 +924,12 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark /** * @return SQL string. */ - private String rendomizeSql() { - String sql = queries.get(nextRandom(queries.size())); - - int count = StringUtils.countOccurrencesOf(sql, "%s"); + private String randomizeSql(String sql) { + int cnt = StringUtils.countOccurrencesOf(sql, "%s"); - Integer[] sub = new Integer[count]; + Integer[] sub = new Integer[cnt]; - for (int i=0; i