[10/30] hbase git commit: HBASE-19977 FileMmapEngine allocation of byte buffers should be synchronized (Ram)
HBASE-19977 FileMmapEngine allocation of byte buffers should be synchronized (Ram) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/16f1f5b4 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/16f1f5b4 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/16f1f5b4 Branch: refs/heads/HBASE-19064 Commit: 16f1f5b49424fcabc9b5c10882dab4f5bf7fa84b Parents: b4622ff Author: VasudevanAuthored: Tue Feb 13 15:49:37 2018 +0530 Committer: Vasudevan Committed: Tue Feb 13 15:49:37 2018 +0530 -- .../apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/16f1f5b4/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java index e2f0191..82f42cd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.yetus.audience.InterfaceAudience; import org.slf4j.Logger; @@ -69,12 +70,11 @@ public class FileMmapEngine implements IOEngine { throw ioex; } ByteBufferAllocator allocator = new ByteBufferAllocator() { - int pos = 0; + AtomicInteger pos = new AtomicInteger(0); @Override public ByteBuffer allocate(long size) throws IOException { ByteBuffer buffer = fileChannel.map(java.nio.channels.FileChannel.MapMode.READ_WRITE, -pos * size, size); -pos++; + pos.getAndIncrement() * size, size); return buffer; } }; @@ -106,7 +106,7 @@ public class FileMmapEngine implements IOEngine { byte[] dst = new byte[length]; bufferArray.getMultiple(offset, length, dst); return deserializer.deserialize(new SingleByteBuff(ByteBuffer.wrap(dst)), true, -MemoryType.EXCLUSIVE); + MemoryType.EXCLUSIVE); } /**
hbase git commit: HBASE-19977 FileMmapEngine allocation of byte buffers should be synchronized (Ram)
Repository: hbase Updated Branches: refs/heads/branch-2 5b95ea01d -> 3623089cb HBASE-19977 FileMmapEngine allocation of byte buffers should be synchronized (Ram) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/3623089c Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/3623089c Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/3623089c Branch: refs/heads/branch-2 Commit: 3623089cbad92a898a3230cb369ed6468046abb1 Parents: 5b95ea0 Author: VasudevanAuthored: Tue Feb 13 15:49:37 2018 +0530 Committer: Vasudevan Committed: Tue Feb 13 15:51:21 2018 +0530 -- .../apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/3623089c/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java index e2f0191..82f42cd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.yetus.audience.InterfaceAudience; import org.slf4j.Logger; @@ -69,12 +70,11 @@ public class FileMmapEngine implements IOEngine { throw ioex; } ByteBufferAllocator allocator = new ByteBufferAllocator() { - int pos = 0; + AtomicInteger pos = new AtomicInteger(0); @Override public ByteBuffer allocate(long size) throws IOException { ByteBuffer buffer = fileChannel.map(java.nio.channels.FileChannel.MapMode.READ_WRITE, -pos * size, size); -pos++; + pos.getAndIncrement() * size, size); return buffer; } }; @@ -106,7 +106,7 @@ public class FileMmapEngine implements IOEngine { byte[] dst = new byte[length]; bufferArray.getMultiple(offset, length, dst); return deserializer.deserialize(new SingleByteBuff(ByteBuffer.wrap(dst)), true, -MemoryType.EXCLUSIVE); + MemoryType.EXCLUSIVE); } /**
hbase git commit: HBASE-19977 FileMmapEngine allocation of byte buffers should be synchronized (Ram)
Repository: hbase Updated Branches: refs/heads/master b4622ffad -> 16f1f5b49 HBASE-19977 FileMmapEngine allocation of byte buffers should be synchronized (Ram) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/16f1f5b4 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/16f1f5b4 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/16f1f5b4 Branch: refs/heads/master Commit: 16f1f5b49424fcabc9b5c10882dab4f5bf7fa84b Parents: b4622ff Author: VasudevanAuthored: Tue Feb 13 15:49:37 2018 +0530 Committer: Vasudevan Committed: Tue Feb 13 15:49:37 2018 +0530 -- .../apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/16f1f5b4/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java -- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java index e2f0191..82f42cd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/FileMmapEngine.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.yetus.audience.InterfaceAudience; import org.slf4j.Logger; @@ -69,12 +70,11 @@ public class FileMmapEngine implements IOEngine { throw ioex; } ByteBufferAllocator allocator = new ByteBufferAllocator() { - int pos = 0; + AtomicInteger pos = new AtomicInteger(0); @Override public ByteBuffer allocate(long size) throws IOException { ByteBuffer buffer = fileChannel.map(java.nio.channels.FileChannel.MapMode.READ_WRITE, -pos * size, size); -pos++; + pos.getAndIncrement() * size, size); return buffer; } }; @@ -106,7 +106,7 @@ public class FileMmapEngine implements IOEngine { byte[] dst = new byte[length]; bufferArray.getMultiple(offset, length, dst); return deserializer.deserialize(new SingleByteBuff(ByteBuffer.wrap(dst)), true, -MemoryType.EXCLUSIVE); + MemoryType.EXCLUSIVE); } /**