HBASE-4278 Race condition in Slab.java that occurs due to spinlock unlocking
early (Li Pi) git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1162886 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5626936a70
commit
53e7f73ab9
|
@ -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)
|
||||
|
|
|
@ -113,8 +113,11 @@ class Slab implements org.apache.hadoop.hbase.io.HeapSize {
|
|||
*/
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue