Repository: ignite
Updated Branches:
  refs/heads/master fe4147448 -> e6f44ad52


IGNITE-8910 PagesList.takeEmptyPage may fail with AssertionError: type = 1 - 
Fixes #4294.

Signed-off-by: Ivan Rakov <ira...@apache.org>


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

Branch: refs/heads/master
Commit: e6f44ad52a89c1a9e9b4bb5a7041515ef31ceb09
Parents: fe41474
Author: Dmitriy Sorokin <d.w.soro...@gmail.com>
Authored: Wed Jul 4 13:16:21 2018 +0300
Committer: Ivan Rakov <ira...@apache.org>
Committed: Wed Jul 4 13:16:21 2018 +0300

----------------------------------------------------------------------
 .../cache/persistence/freelist/PagesList.java       | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e6f44ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
index 7f55a70..831465d 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
@@ -471,8 +471,12 @@ public abstract class PagesList extends DataStructure {
                 else
                     newTails = null; // Drop the bucket completely.
 
-                if (casBucket(bucket, tails, newTails))
+                if (casBucket(bucket, tails, newTails)) {
+                    // Reset tailId for invalidation of locking when stripe 
was taken concurrently.
+                    tails[idx].tailId = 0L;
+
                     return true;
+                }
             }
             else {
                 // It is safe to assign new tail since we do it only when 
write lock on tail is held.
@@ -624,6 +628,11 @@ public abstract class PagesList extends DataStructure {
                 return;
 
             final long tailId = stripe.tailId;
+
+            // Stripe was removed from bucket concurrently.
+            if (tailId == 0L)
+                continue;
+
             final long tailPage = acquirePage(tailId);
 
             try {
@@ -1039,6 +1048,11 @@ public abstract class PagesList extends DataStructure {
                 return 0L;
 
             final long tailId = stripe.tailId;
+
+            // Stripe was removed from bucket concurrently.
+            if (tailId == 0L)
+                continue;
+
             final long tailPage = acquirePage(tailId);
 
             try {

Reply via email to