hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Li Pi (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-4330) Fix races in slab cache
Date Mon, 12 Sep 2011 20:29:08 GMT

    [ https://issues.apache.org/jira/browse/HBASE-4330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13103010#comment-13103010
] 

Li Pi commented on HBASE-4330:
------------------------------

The change in v7 that fixes things:

-    scache.cacheBlock(blockName, cachedItem); // if this
-                                              // fails, due to
-                                              // block already
-    // being there, exception will be thrown
-    backingStore.put(blockName, scache);
+
+    /*This will throw a runtime exception if we try to cache the same value twice*/
+    scache.cacheBlock(blockName, cachedItem);
+
+    /*Spinlock, if we're spinlocking, that means an eviction hasn't taken place yet*/
+    while (backingStore.putIfAbsent(blockName, scache) != null) {
+      Thread.yield();
+    }

The test failed when the following occurred:


Invariant:

Both SSC and SC have the same contents:

Violation:

Item A is in both SSC and SC.

Thread A: evicts A from ssc.
Thread B: starts doing a put into thread SC, -
Thread B: gets directed into SSC, starts doing put in SSC,
Thread B: put goes through thanks to the occuring eviction.
Thread A: calls evictor on SC, removing the object from SlabCache. 

result: Object is in SSC, but not SC.


> Fix races in slab cache
> -----------------------
>
>                 Key: HBASE-4330
>                 URL: https://issues.apache.org/jira/browse/HBASE-4330
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.92.0
>            Reporter: Todd Lipcon
>            Assignee: Li Pi
>             Fix For: 0.92.0
>
>         Attachments: hbase-4330.txt, hbase-4330.txt, hbase-4330v3.txt, hbase-4330v4.txt,
hbase-4330v5.txt, hbase-4330v6.txt, hbase-4330v7.txt
>
>
> A few races are still lingering in the slab cache. Here are some tests and proposed fixes.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message