hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1162886 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/io/hfile/slab/Slab.java
Date Mon, 29 Aug 2011 16:00:47 GMT
Author: tedyu
Date: Mon Aug 29 16:00:47 2011
New Revision: 1162886

URL: http://svn.apache.org/viewvc?rev=1162886&view=rev
Log:
HBASE-4278  Race condition in Slab.java that occurs due to spinlock unlocking
               early (Li Pi)

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/Slab.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1162886&r1=1162885&r2=1162886&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Mon Aug 29 16:00:47 2011
@@ -220,6 +220,8 @@ Release 0.91.0 - Unreleased
    HBASE-3229  HBASE-3229 Table creation, though using "async" call to master,
                can actually run for a while and cause RPC timeout (Ming Ma)
    HBASE-4252  TestLogRolling's low-probability failure (Jieshan Bean)
+   HBASE-4278  Race condition in Slab.java that occurs due to spinlock unlocking
+               early (Li Pi)
 
   IMPROVEMENTS
    HBASE-3290  Max Compaction Size (Nicolas Spiegelberg via Stack)  

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/Slab.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/Slab.java?rev=1162886&r1=1162885&r2=1162886&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/Slab.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/Slab.java Mon Aug 29 16:00:47
2011
@@ -113,8 +113,11 @@ class Slab implements org.apache.hadoop.
    */
   ByteBuffer alloc(int bufferSize) {
     int newCapacity = Preconditions.checkPositionIndex(bufferSize, blockSize);
-    while (buffers.isEmpty()); // Spinlock
-    ByteBuffer returnedBuffer = buffers.remove();
+
+    ByteBuffer returnedBuffer = buffers.poll();
+    while(returnedBuffer == null){
+      returnedBuffer = buffers.poll();
+    }
     returnedBuffer.clear().limit(newCapacity);
     return returnedBuffer;
   }



Mime
View raw message