Repository: incubator-ignite Updated Branches: refs/heads/ignite-sql-tests e52bbb2bc -> b17af2743
ignite-sql-tests - replicated or local query always run only locally Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b17af274 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b17af274 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b17af274 Branch: refs/heads/ignite-sql-tests Commit: b17af274366f982aec01cd6a7848ff3343c97f93 Parents: e52bbb2 Author: S.Vladykin <svlady...@gridgain.com> Authored: Mon Feb 9 03:13:16 2015 +0300 Committer: S.Vladykin <svlady...@gridgain.com> Committed: Mon Feb 9 03:13:16 2015 +0300 ---------------------------------------------------------------------- .../internal/processors/cache/IgniteCacheProxy.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b17af274/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index 2afc4a3..42dbc52 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@ -316,6 +316,14 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V }); } + /** + * @param local Enforce local. + * @return Local node cluster group. + */ + private ClusterGroup projection(boolean local) { + return local || ctx.isLocal() || ctx.isReplicated() ? ctx.kernalContext().grid().forLocal() : null; + } + /** {@inheritDoc} */ @Override public QueryCursor<Entry<K,V>> query(Query qry) { A.notNull(qry, "qry"); @@ -326,13 +334,13 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V if (qry instanceof SqlQuery) { SqlQuery p = (SqlQuery)qry; - if (ctx.isReplicated()) + if (ctx.isReplicated() || ctx.isLocal()) return doLocalQuery(p); return ctx.kernalContext().query().queryTwoStep(ctx.name(), p.getType(), p.getSql(), p.getArgs()); } - return query(qry, null); + return query(qry, projection(false)); } catch (Exception e) { if (e instanceof CacheException) @@ -352,7 +360,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V GridCacheProjectionImpl<K, V> prev = gate.enter(prj); try { - if (ctx.isReplicated()) + if (ctx.isReplicated() || ctx.isLocal()) return doLocalFieldsQuery(qry); return ctx.kernalContext().query().queryTwoStep(ctx.name(), qry.getSql(), qry.getArgs()); @@ -396,7 +404,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V if (qry instanceof SqlQuery) return doLocalQuery((SqlQuery)qry); - return query(qry, ctx.kernalContext().grid().forLocal()); + return query(qry, projection(true)); } catch (Exception e) { if (e instanceof CacheException)