You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/09/13 10:02:10 UTC
[2/3] ignite git commit: IGNITE-6121 .NET: Propagate
SqlFieldsQuery.lazy property
IGNITE-6121 .NET: Propagate SqlFieldsQuery.lazy property
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0542c762
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0542c762
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0542c762
Branch: refs/heads/ignite-5896
Commit: 0542c762d0fafc1503d1bd83d2ac42719f38c5d5
Parents: 581d91b
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Sep 13 12:50:49 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Sep 13 12:50:49 2017 +0300
----------------------------------------------------------------------
.../Cache/Query/CacheQueriesTest.cs | 5 +++--
.../Query/Linq/CacheLinqTest.Introspection.cs | 17 ++++++++++-------
.../Cache/Query/SqlFieldsQuery.cs | 17 +++++++++++++++--
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 2 +-
.../Impl/CacheFieldsQueryExecutor.cs | 3 ++-
.../dotnet/Apache.Ignite.Linq/QueryOptions.cs | 13 +++++++++++++
6 files changed, 44 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index ae2fe8f..65ab18c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -369,7 +369,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// </summary>
[Test]
public void TestSqlFieldsQuery([Values(true, false)] bool loc, [Values(true, false)] bool distrJoin,
- [Values(true, false)] bool enforceJoinOrder)
+ [Values(true, false)] bool enforceJoinOrder, [Values(true, false)] bool lazy)
{
int cnt = MaxItemCnt;
@@ -386,7 +386,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
Colocated = !distrJoin,
ReplicatedOnly = false,
Local = loc,
- Timeout = TimeSpan.FromSeconds(2)
+ Timeout = TimeSpan.FromSeconds(2),
+ Lazy = lazy
};
using (IQueryCursor<IList> cursor = cache.QueryFields(qry))
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs
index 9430dd8..a13131b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs
@@ -53,7 +53,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
EnforceJoinOrder = true,
Timeout = TimeSpan.FromSeconds(2.5),
ReplicatedOnly = true,
- Colocated = true
+ Colocated = true,
+ Lazy = true
}).Where(x => x.Key > 10).ToCacheQueryable();
Assert.AreEqual(cache.Name, query.CacheName);
@@ -76,6 +77,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
Assert.IsTrue(fq.ReplicatedOnly);
Assert.IsTrue(fq.Colocated);
Assert.AreEqual(TimeSpan.FromSeconds(2.5), fq.Timeout);
+ Assert.IsTrue(fq.Lazy);
var str = query.ToString();
Assert.AreEqual(GetSqlEscapeAll()
@@ -83,12 +85,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
"[Sql=select _T0._KEY, _T0._VAL from \"person_org\".\"Person\" as _T0 where " +
"(_T0.\"_KEY\" > ?), Arguments=[10], " +
"Local=True, PageSize=999, EnableDistributedJoins=False, EnforceJoinOrder=True, " +
- "Timeout=00:00:02.5000000, ReplicatedOnly=True, Colocated=True, Schema=]]"
+ "Timeout=00:00:02.5000000, ReplicatedOnly=True, Colocated=True, Schema=, Lazy=True]]"
: "CacheQueryable [CacheName=person_org, TableName=Person, Query=SqlFieldsQuery " +
"[Sql=select _T0._KEY, _T0._VAL from \"person_org\".Person as _T0 where " +
"(_T0._KEY > ?), Arguments=[10], " +
"Local=True, PageSize=999, EnableDistributedJoins=False, EnforceJoinOrder=True, " +
- "Timeout=00:00:02.5000000, ReplicatedOnly=True, Colocated=True, Schema=]]", str);
+ "Timeout=00:00:02.5000000, ReplicatedOnly=True, Colocated=True, Schema=, Lazy=True]]", str);
// Check fields query
var fieldsQuery = (ICacheQueryable)cache.AsCacheQueryable().Select(x => x.Value.Name);
@@ -106,17 +108,18 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
Assert.AreEqual(SqlFieldsQuery.DefaultPageSize, fq.PageSize);
Assert.IsFalse(fq.EnableDistributedJoins);
Assert.IsFalse(fq.EnforceJoinOrder);
+ Assert.IsFalse(fq.Lazy);
str = fieldsQuery.ToString();
Assert.AreEqual(GetSqlEscapeAll()
? "CacheQueryable [CacheName=person_org, TableName=Person, Query=SqlFieldsQuery " +
"[Sql=select _T0.\"Name\" from \"person_org\".\"Person\" as _T0, Arguments=[], Local=False, " +
"PageSize=1024, EnableDistributedJoins=False, EnforceJoinOrder=False, " +
- "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=]]"
+ "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=, Lazy=False]]"
: "CacheQueryable [CacheName=person_org, TableName=Person, Query=SqlFieldsQuery " +
"[Sql=select _T0.NAME from \"person_org\".Person as _T0, Arguments=[], Local=False, " +
"PageSize=1024, EnableDistributedJoins=False, EnforceJoinOrder=False, " +
- "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=]]", str);
+ "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=, Lazy=False]]", str);
// Check distributed joins flag propagation
var distrQuery = cache.AsCacheQueryable(new QueryOptions { EnableDistributedJoins = true })
@@ -133,13 +136,13 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
"(((_T0.\"_KEY\" > ?) and (_T0.\"age1\" > ?)) " +
"and (_T0.\"Name\" like \'%\' || ? || \'%\') ), Arguments=[10, 20, x], Local=False, " +
"PageSize=1024, EnableDistributedJoins=True, EnforceJoinOrder=False, " +
- "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=]]"
+ "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=, Lazy=False]]"
: "CacheQueryable [CacheName=person_org, TableName=Person, Query=SqlFieldsQuery " +
"[Sql=select _T0._KEY, _T0._VAL from \"person_org\".Person as _T0 where " +
"(((_T0._KEY > ?) and (_T0.AGE1 > ?)) " +
"and (_T0.NAME like \'%\' || ? || \'%\') ), Arguments=[10, 20, x], Local=False, " +
"PageSize=1024, EnableDistributedJoins=True, EnforceJoinOrder=False, " +
- "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=]]", str);
+ "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=, Lazy=False]]", str);
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
index aa33415..a93e00d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
@@ -136,6 +136,19 @@ namespace Apache.Ignite.Core.Cache.Query
public string Schema { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether this <see cref="SqlFieldsQuery"/> is lazy.
+ /// <para />
+ /// By default Ignite attempts to fetch the whole query result set to memory and send it to the client.
+ /// For small and medium result sets this provides optimal performance and minimize duration of internal
+ /// database locks, thus increasing concurrency.
+ /// <para />
+ /// If result set is too big to fit in available memory this could lead to excessive GC pauses and even
+ /// OutOfMemoryError. Use this flag as a hint for Ignite to fetch result set lazily, thus minimizing memory
+ /// consumption at the cost of moderate performance hit.
+ /// </summary>
+ public bool Lazy { get; set; }
+
+ /// <summary>
/// Returns a <see cref="string" /> that represents this instance.
/// </summary>
/// <returns>
@@ -147,9 +160,9 @@ namespace Apache.Ignite.Core.Cache.Query
return string.Format("SqlFieldsQuery [Sql={0}, Arguments=[{1}], Local={2}, PageSize={3}, " +
"EnableDistributedJoins={4}, EnforceJoinOrder={5}, Timeout={6}, ReplicatedOnly={7}" +
- ", Colocated={8}, Schema={9}]", Sql, args, Local,
+ ", Colocated={8}, Schema={9}, Lazy={10}]", Sql, args, Local,
PageSize, EnableDistributedJoins, EnforceJoinOrder, Timeout, ReplicatedOnly,
- Colocated, Schema);
+ Colocated, Schema, Lazy);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index 05644cd..921b5e0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -1091,7 +1091,7 @@ namespace Apache.Ignite.Core.Impl.Cache
writer.WriteBoolean(qry.EnableDistributedJoins);
writer.WriteBoolean(qry.EnforceJoinOrder);
- writer.WriteBoolean(false); // Lazy flag.
+ writer.WriteBoolean(qry.Lazy); // Lazy flag.
writer.WriteInt((int) qry.Timeout.TotalMilliseconds);
writer.WriteBoolean(qry.ReplicatedOnly);
writer.WriteBoolean(qry.Colocated);
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs
index bc7251b..fb34270 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs
@@ -207,7 +207,8 @@ namespace Apache.Ignite.Linq.Impl
ReplicatedOnly = _options.ReplicatedOnly,
Colocated = _options.Colocated,
Local = _options.Local,
- Arguments = args
+ Arguments = args,
+ Lazy = _options.Lazy
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
index 17b3705..c727e1c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
@@ -110,5 +110,18 @@ namespace Apache.Ignite.Linq
/// performance and network optimizations by grouping data on remote nodes.
/// </summary>
public bool Colocated { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this query is lazy.
+ /// <para />
+ /// By default Ignite attempts to fetch the whole query result set to memory and send it to the client.
+ /// For small and medium result sets this provides optimal performance and minimize duration of internal
+ /// database locks, thus increasing concurrency.
+ /// <para />
+ /// If result set is too big to fit in available memory this could lead to excessive GC pauses and even
+ /// OutOfMemoryError. Use this flag as a hint for Ignite to fetch result set lazily, thus minimizing memory
+ /// consumption at the cost of moderate performance hit.
+ /// </summary>
+ public bool Lazy { get; set; }
}
}