[10/50] [abbrv] ignite git commit: IGNITE-5960 Fixed race on continuous query registration and entry update. Fixes #2728.
IGNITE-5960 Fixed race on continuous query registration and entry update. Fixes #2728. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6a09c4e2 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6a09c4e2 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6a09c4e2 Branch: refs/heads/ignite-9349 Commit: 6a09c4e204de2c88580249ca43be3c01fb379163 Parents: 72335ae Author: Sunny Chan Authored: Mon Sep 10 12:53:28 2018 +0300 Committer: Alexey Goncharuk Committed: Mon Sep 10 12:53:28 2018 +0300 -- .../processors/cache/GridCacheMapEntry.java | 36 ++ .../continuous/CacheContinuousQueryManager.java | 39 +--- 2 files changed, 69 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/6a09c4e2/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 714d4a0..4806733 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 @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.cache.Cache; import javax.cache.expiry.ExpiryPolicy; @@ -184,6 +185,10 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme @GridToStringExclude private final ReentrantLock lock = new ReentrantLock(); +/** Read Lock for continuous query listener */ +@GridToStringExclude +private final Lock listenerLock; + /** * Flags: * @@ -212,6 +217,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme this.key = key; this.hash = key.hashCode(); this.cctx = cctx; +this.listenerLock = cctx.continuousQueries().getListenerReadLock(); ver = GridCacheVersionManager.START_VER; } @@ -1371,6 +1377,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme GridLongList mvccWaitTxs = null; +lockListenerReadLock(); lockEntry(); try { @@ -1524,6 +1531,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } finally { unlockEntry(); +unlockListenerReadLock(); } onUpdateFinished(updateCntr0); @@ -1602,6 +1610,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme GridLongList mvccWaitTxs = null; +lockListenerReadLock(); lockEntry(); try { @@ -1756,6 +1765,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } finally { unlockEntry(); +unlockListenerReadLock(); } if (deferred) @@ -1818,6 +1828,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme EntryProcessorResult invokeRes = null; +lockListenerReadLock(); lockEntry(); try { @@ -2133,6 +2144,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } finally { unlockEntry(); +unlockListenerReadLock(); } return new GridTuple3<>(res, @@ -2182,6 +2194,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme if (!primary && !isNear()) ensureFreeSpace(); +lockListenerReadLock(); lockEntry(); try { @@ -2443,6 +2456,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } finally { unlockEntry(); +unlockListenerReadLock(); } onUpdateFinished(c.updateRes.updateCounter()); @@ -3197,6 +3211,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme GridCacheVersion oldVer = null; +lockListenerReadLock(); lockEntry(); try { @@ -3380,6 +3395,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } finally { unlockEntry(); +unlockListenerReadLock(); // It is necessary to execute these callbacks outside of lock to avoid
ignite git commit: IGNITE-5960 Fixed race on continuous query registration and entry update. Fixes #2728.
Repository: ignite Updated Branches: refs/heads/master 72335ae9b -> 6a09c4e20 IGNITE-5960 Fixed race on continuous query registration and entry update. Fixes #2728. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6a09c4e2 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6a09c4e2 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6a09c4e2 Branch: refs/heads/master Commit: 6a09c4e204de2c88580249ca43be3c01fb379163 Parents: 72335ae Author: Sunny Chan Authored: Mon Sep 10 12:53:28 2018 +0300 Committer: Alexey Goncharuk Committed: Mon Sep 10 12:53:28 2018 +0300 -- .../processors/cache/GridCacheMapEntry.java | 36 ++ .../continuous/CacheContinuousQueryManager.java | 39 +--- 2 files changed, 69 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/6a09c4e2/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 714d4a0..4806733 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 @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.cache.Cache; import javax.cache.expiry.ExpiryPolicy; @@ -184,6 +185,10 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme @GridToStringExclude private final ReentrantLock lock = new ReentrantLock(); +/** Read Lock for continuous query listener */ +@GridToStringExclude +private final Lock listenerLock; + /** * Flags: * @@ -212,6 +217,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme this.key = key; this.hash = key.hashCode(); this.cctx = cctx; +this.listenerLock = cctx.continuousQueries().getListenerReadLock(); ver = GridCacheVersionManager.START_VER; } @@ -1371,6 +1377,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme GridLongList mvccWaitTxs = null; +lockListenerReadLock(); lockEntry(); try { @@ -1524,6 +1531,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } finally { unlockEntry(); +unlockListenerReadLock(); } onUpdateFinished(updateCntr0); @@ -1602,6 +1610,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme GridLongList mvccWaitTxs = null; +lockListenerReadLock(); lockEntry(); try { @@ -1756,6 +1765,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } finally { unlockEntry(); +unlockListenerReadLock(); } if (deferred) @@ -1818,6 +1828,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme EntryProcessorResult invokeRes = null; +lockListenerReadLock(); lockEntry(); try { @@ -2133,6 +2144,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } finally { unlockEntry(); +unlockListenerReadLock(); } return new GridTuple3<>(res, @@ -2182,6 +2194,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme if (!primary && !isNear()) ensureFreeSpace(); +lockListenerReadLock(); lockEntry(); try { @@ -2443,6 +2456,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } finally { unlockEntry(); +unlockListenerReadLock(); } onUpdateFinished(c.updateRes.updateCounter()); @@ -3197,6 +3211,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme GridCacheVersion oldVer = null; +lockListenerReadLock(); lockEntry(); try { @@ -3380,6 +3395,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } finally { unlockEntry(); +unlockListenerReadLock();