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 2015/11/20 12:31:45 UTC

ignite git commit: IGNITE-1966 .Net: Fixed handle leak during partitioned scan query.

Repository: ignite
Updated Branches:
  refs/heads/ignite-1282 911ca9dc8 -> 9c7178557


IGNITE-1966 .Net: Fixed handle leak during partitioned scan query.


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

Branch: refs/heads/ignite-1282
Commit: 9c7178557a7dde74fec0a709e8a574ecae0c6930
Parents: 911ca9d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 20 14:32:27 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 20 14:32:27 2015 +0300

----------------------------------------------------------------------
 .../processors/platform/cache/PlatformCache.java     |  9 ++++-----
 .../Cache/CacheTestAsyncWrapper.cs                   |  1 -
 .../Cache/Query/CacheQueriesTest.cs                  |  2 --
 .../Apache.Ignite.Core/Cache/Query/ScanQuery.cs      | 14 +-------------
 .../Impl/Cache/CacheEntryFilterHolder.cs             | 15 ---------------
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs       | 15 ++-------------
 .../Impl/Unmanaged/UnmanagedCallbacks.cs             |  2 +-
 7 files changed, 8 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9c717855/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index 6ec52d6..5943440 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -36,15 +36,14 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
 import org.apache.ignite.internal.processors.cache.query.QueryCursorEx;
 import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
 import org.apache.ignite.internal.processors.platform.PlatformContext;
+import org.apache.ignite.internal.processors.platform.PlatformNativeException;
 import org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQuery;
 import org.apache.ignite.internal.processors.platform.cache.query.PlatformFieldsQueryCursor;
 import org.apache.ignite.internal.processors.platform.cache.query.PlatformQueryCursor;
-import org.apache.ignite.internal.processors.platform.PlatformNativeException;
 import org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils;
 import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
 import org.apache.ignite.internal.util.GridConcurrentFactory;
 import org.apache.ignite.internal.util.typedef.C1;
-import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteFuture;
 import org.jetbrains.annotations.Nullable;
 
@@ -373,13 +372,13 @@ public class PlatformCache extends PlatformAbstractTarget {
     /**
      * Loads cache via localLoadCache or loadCache.
      */
-    private void loadCache0(BinaryRawReaderEx reader, boolean loc) throws IgniteCheckedException {
+    private void loadCache0(BinaryRawReaderEx reader, boolean loc) {
         PlatformCacheEntryFilter filter = null;
 
         Object pred = reader.readObjectDetached();
 
         if (pred != null)
-            filter = platformCtx.createCacheEntryFilter(pred, reader.readLong());
+            filter = platformCtx.createCacheEntryFilter(pred, 0);
 
         Object[] args = reader.readObjectArray();
 
@@ -955,7 +954,7 @@ public class PlatformCache extends PlatformAbstractTarget {
         Object pred = reader.readObjectDetached();
 
         if (pred != null)
-            qry.setFilter(platformCtx.createCacheEntryFilter(pred, reader.readLong()));
+            qry.setFilter(platformCtx.createCacheEntryFilter(pred, 0));
 
         qry.setLocal(loc);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c717855/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
index 430272f..33c9f11 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
@@ -26,7 +26,6 @@ namespace Apache.Ignite.Core.Tests.Cache
     using Apache.Ignite.Core.Cache.Expiry;
     using Apache.Ignite.Core.Cache.Query;
     using Apache.Ignite.Core.Cache.Query.Continuous;
-    using Apache.Ignite.Core.Common;
 
     /// <summary>
     /// Wraps IGridCache implementation to simplify async mode testing.

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c717855/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 411ef05..08a98f6 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
@@ -565,7 +565,6 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
         /// Check scan query with partitions.
         /// </summary>
         [Test]
-        [Ignore("IGNITE-1012")]
         public void TestScanQueryPartitions([Values(true, false)]  bool loc)
         {
             CheckScanQueryPartitions<QueryPerson>(MaxItemCnt, loc, false);
@@ -575,7 +574,6 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
         /// Check scan query with partitions in binary mode.
         /// </summary>
         [Test]
-        [Ignore("IGNITE-1012")]
         public void TestScanQueryPartitionsBinary([Values(true, false)]  bool loc)
         {
             CheckScanQueryPartitions<BinaryObject>(MaxItemCnt, loc, true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c717855/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs
index 12fb363..2c9cf35 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs
@@ -17,7 +17,6 @@
 
 namespace Apache.Ignite.Core.Cache.Query
 {
-    using System;
     using Apache.Ignite.Core.Impl.Binary;
     using Apache.Ignite.Core.Impl.Cache;
 
@@ -64,18 +63,7 @@ namespace Apache.Ignite.Core.Cache.Query
                 var holder = new CacheEntryFilterHolder(Filter, (key, val) => Filter.Invoke(
                     new CacheEntry<TK, TV>((TK) key, (TV) val)), writer.Marshaller, keepBinary);
 
-                try
-                {
-                    writer.WriteObject(holder);
-                }
-                catch (Exception)
-                {
-                    writer.Marshaller.Ignite.HandleRegistry.Release(holder.Handle);
-
-                    throw;
-                }
-
-                writer.WriteLong(holder.Handle);
+                writer.WriteObject(holder);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c717855/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs
index 0963145..4487c59 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs
@@ -42,9 +42,6 @@ namespace Apache.Ignite.Core.Impl.Cache
         /** Grid. */
         private readonly Marshaller _marsh;
         
-        /** Handle. */
-        private readonly long _handle;
-
         /// <summary>
         /// Initializes a new instance of the <see cref="CacheEntryFilterHolder" /> class.
         /// </summary>
@@ -63,16 +60,6 @@ namespace Apache.Ignite.Core.Impl.Cache
             _invoker = invoker;
             _marsh = marsh;
             _keepBinary = keepBinary;
-
-            _handle = marsh.Ignite.HandleRegistry.Allocate(this);
-        }
-
-        /// <summary>
-        /// Gets the handle.
-        /// </summary>
-        public long Handle
-        {
-            get { return _handle; }
         }
 
         /// <summary>
@@ -112,8 +99,6 @@ namespace Apache.Ignite.Core.Impl.Cache
             _marsh = reader0.Marshaller;
 
             _invoker = GetInvoker(_pred);
-
-            _handle = _marsh.Ignite.HandleRegistry.Allocate(this);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c717855/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 b1870d7..262ff12 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -270,21 +270,10 @@ namespace Apache.Ignite.Core.Impl.Cache
             {
                 if (p != null)
                 {
-                    var p0 = new CacheEntryFilterHolder(p, (k, v) => p.Invoke(new CacheEntry<TK, TV>((TK)k, (TV)v)),
+                    var p0 = new CacheEntryFilterHolder(p, (k, v) => p.Invoke(new CacheEntry<TK, TV>((TK) k, (TV) v)),
                         Marshaller, IsKeepBinary);
 
-                    try
-                    {
-                        writer.WriteObject(p0);
-                    }
-                    catch (Exception)
-                    {
-                        writer.Marshaller.Ignite.HandleRegistry.Release(p0.Handle);
-
-                        throw;
-                    }
-
-                    writer.WriteLong(p0.Handle);
+                    writer.WriteObject(p0);
                 }
                 else
                     writer.WriteObject<CacheEntryFilterHolder>(null);

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c717855/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
index 98ea106..e554cfc 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
@@ -313,7 +313,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
 
         private long CacheEntryFilterCreate(void* target, long memPtr)
         {
-            return SafeCall(() => CacheEntryFilterHolder.CreateInstance(memPtr, _ignite).Handle);
+            return SafeCall(() => _handleRegistry.Allocate(CacheEntryFilterHolder.CreateInstance(memPtr, _ignite)));
         }
 
         private int CacheEntryFilterApply(void* target, long objPtr, long memPtr)