ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [04/50] [abbrv] incubator-ignite git commit: ignite-848 Excessive memory and CPU consumption by TTL manager
Date Tue, 12 May 2015 10:34:54 GMT
ignite-848 Excessive memory and CPU consumption by TTL manager


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

Branch: refs/heads/ignite-695
Commit: 70872aa6ad3c90fca974f308bf8d293c9f2a1e5a
Parents: 8b5a1ce
Author: agura <agura@gridgain.com>
Authored: Wed May 6 14:30:01 2015 +0300
Committer: agura <agura@gridgain.com>
Committed: Wed May 6 14:30:01 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheMapEntry.java  | 10 +++++++---
 .../processors/cache/GridCacheTtlManager.java         | 14 +++++---------
 .../internal/processors/cache/GridCacheUtils.java     |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/70872aa6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 614da6b..71858d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -3292,6 +3292,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx
{
     @Override public boolean onTtlExpired(GridCacheVersion obsoleteVer) {
         boolean obsolete = false;
         boolean deferred = false;
+        GridCacheVersion ver0 = null;
 
         try {
             synchronized (this) {
@@ -3305,7 +3306,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx
{
                     if (!obsolete()) {
                         if (cctx.deferredDelete() && !detached() && !isInternal())
{
                             if (!deletedUnlocked()) {
-                                update(null, 0L, 0L, ver);
+                                update(null, 0L, 0L, ver0 = ver);
 
                                 deletedUnlocked(true);
 
@@ -3351,8 +3352,11 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx
{
                 cctx.cache().removeEntry(this);
             }
 
-            if (deferred)
-                cctx.onDeferredDelete(this, ver);
+            if (deferred) {
+                assert ver0 != null;
+
+                cctx.onDeferredDelete(this, ver0);
+            }
 
             if ((obsolete || deferred) && cctx.cache().configuration().isStatisticsEnabled())
                 cctx.cache().metrics0().onEvict();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/70872aa6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
index ef5ac19..5f9049a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
@@ -88,17 +88,13 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
 
     /**
      * Expires entries by TTL.
-     *
-     * @param sizeLimited Size limited.
      */
-    public void expire(boolean sizeLimited) {
+    public void expire() {
         long now = U.currentTimeMillis();
 
-        int size = pendingEntries.sizex();
-
         GridCacheVersion obsoleteVer = null;
 
-        while (!sizeLimited || size-- > 0) {
+        for (int size = pendingEntries.sizex(); size > 0; size--) {
             EntryWrapper e = pendingEntries.firstx();
 
             if (e == null || e.expireTime > now)
@@ -108,8 +104,8 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
                 if (obsoleteVer == null)
                     obsoleteVer = cctx.versions().next();
 
-                if (log.isDebugEnabled())
-                    log.debug("Trying to remove expired entry from cache: " + e);
+                if (log.isTraceEnabled())
+                    log.trace("Trying to remove expired entry from cache: " + e);
 
                 e.entry.onTtlExpired(obsoleteVer);
             }
@@ -130,7 +126,7 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
         /** {@inheritDoc} */
         @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException
{
             while (!isCancelled()) {
-                expire(false);
+                expire();
 
                 EntryWrapper first = pendingEntries.firstx();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/70872aa6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 9a98358..549f42f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1157,7 +1157,7 @@ public class GridCacheUtils {
         if (ctx.isNear())
             ctx.near().dht().context().evicts().unwind();
 
-        ctx.ttl().expire(true);
+        ctx.ttl().expire();
     }
 
     /**
@@ -1172,7 +1172,7 @@ public class GridCacheUtils {
             if (cacheCtx.isNear())
                 cacheCtx.near().dht().context().evicts().unwind();
 
-            cacheCtx.ttl().expire(true);
+            cacheCtx.ttl().expire();
         }
     }
 


Mime
View raw message