You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by wc...@apache.org on 2024/09/11 14:25:32 UTC
(hbase) branch master updated: HBASE-28821: Optimise the memory-utilisation during persistence of bucketcache. (#6215)
This is an automated email from the ASF dual-hosted git repository.
wchevreuil pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new f8182f58207 HBASE-28821: Optimise the memory-utilisation during persistence of bucketcache. (#6215)
f8182f58207 is described below
commit f8182f582076a633938a0fb79195a38a6cd723f3
Author: jhungund <10...@users.noreply.github.com>
AuthorDate: Wed Sep 11 19:55:26 2024 +0530
HBASE-28821: Optimise the memory-utilisation during persistence of bucketcache. (#6215)
Signed-off-by: Wellington Chevreuil <wc...@apache.org>
---
.../hadoop/hbase/io/hfile/bucket/BucketProtoUtils.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketProtoUtils.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketProtoUtils.java
index 4618200325c..4acf724edd7 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketProtoUtils.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketProtoUtils.java
@@ -73,11 +73,15 @@ final class BucketProtoUtils {
fos.write(Bytes.toBytes(chunkSize));
fos.write(Bytes.toBytes(numChunks));
+ BucketCacheProtos.BackingMapEntry.Builder entryBuilder =
+ BucketCacheProtos.BackingMapEntry.newBuilder();
for (Map.Entry<BlockCacheKey, BucketEntry> entry : cache.backingMap.entrySet()) {
blockCount++;
- builder.addEntry(
- BucketCacheProtos.BackingMapEntry.newBuilder().setKey(BucketProtoUtils.toPB(entry.getKey()))
- .setValue(BucketProtoUtils.toPB(entry.getValue())).build());
+ entryBuilder.clear();
+ entryBuilder.setKey(BucketProtoUtils.toPB(entry.getKey()));
+ entryBuilder.setValue(BucketProtoUtils.toPB(entry.getValue()));
+ builder.addEntry(entryBuilder.build());
+
if (blockCount % chunkSize == 0 || (blockCount == backingMapSize)) {
chunkCount++;
if (chunkCount == 1) {
@@ -88,7 +92,7 @@ final class BucketProtoUtils {
builder.build().writeDelimitedTo(fos);
}
if (blockCount < backingMapSize) {
- builder = BucketCacheProtos.BackingMap.newBuilder();
+ builder.clear();
}
}
}