This is an automated email from the ASF dual-hosted git repository.
sammichen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 5322ff18c85 HDDS-13442. Replace OMKeyInfo with light-weight
ReconBasicOmKeyInfo for MultipartInfoInsightHandler (#9251)
5322ff18c85 is described below
commit 5322ff18c85731e7f18921f1f586019083e03893
Author: Priyesh Karatha <[email protected]>
AuthorDate: Tue Nov 11 08:35:19 2025 +0530
HDDS-13442. Replace OMKeyInfo with light-weight ReconBasicOmKeyInfo for
MultipartInfoInsightHandler (#9251)
Co-authored-by: tanvipenumudy
<[email protected]>
---
.../ozone/recon/api/types/ReconBasicOmKeyInfo.java | 32 ++++++++++++++++++++++
.../recon/tasks/MultipartInfoInsightHandler.java | 12 ++++----
2 files changed, 38 insertions(+), 6 deletions(-)
diff --git
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/ReconBasicOmKeyInfo.java
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/ReconBasicOmKeyInfo.java
index c22010580e4..df62f72c845 100644
---
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/ReconBasicOmKeyInfo.java
+++
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/ReconBasicOmKeyInfo.java
@@ -247,6 +247,38 @@ public static ReconBasicOmKeyInfo
getFromProtobuf(OzoneManagerProtocolProtos.Key
return builder.build();
}
+ /**
+ * Converts a KeyInfo protobuf object into a ReconBasicOmKeyInfo instance.
+ * This method extracts only the essential fields required for Recon event
handling, avoiding the overhead of
+ * deserializing unused metadata such as KeyLocationList or ACLs.
+ *
+ * @param keyInfoProto required for deserialization.
+ * @return the deserialized lightweight ReconBasicOmKeyInfo object.
+ */
+ public static ReconBasicOmKeyInfo
getFromProtobuf(OzoneManagerProtocolProtos.KeyInfo keyInfoProto) {
+ if (keyInfoProto == null) {
+ return null;
+ }
+
+ String keyName = keyInfoProto.getKeyName();
+
+ Builder builder = new Builder()
+ .setVolumeName(keyInfoProto.getVolumeName())
+ .setBucketName(keyInfoProto.getBucketName())
+ .setKeyName(keyName)
+ .setDataSize(keyInfoProto.getDataSize())
+ .setCreationTime(keyInfoProto.getCreationTime())
+ .setModificationTime(keyInfoProto.getModificationTime())
+ .setReplicationConfig(ReplicationConfig.fromProto(
+ keyInfoProto.getType(),
+ keyInfoProto.getFactor(),
+ keyInfoProto.getEcReplicationConfig()))
+ .setIsFile(!keyName.endsWith("/"))
+ .setParentId(keyInfoProto.getParentID());
+
+ return builder.build();
+ }
+
public OzoneManagerProtocolProtos.KeyInfoProtoLight toProtobuf() {
throw new UnsupportedOperationException("This method is not supported.");
}
diff --git
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/MultipartInfoInsightHandler.java
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/MultipartInfoInsightHandler.java
index 2f501a33ad9..3976919ab4b 100644
---
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/MultipartInfoInsightHandler.java
+++
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/MultipartInfoInsightHandler.java
@@ -21,9 +21,9 @@
import org.apache.commons.lang3.tuple.Triple;
import org.apache.hadoop.hdds.utils.db.Table;
import org.apache.hadoop.hdds.utils.db.TableIterator;
-import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.OmMultipartKeyInfo;
import
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PartKeyInfo;
+import org.apache.hadoop.ozone.recon.api.types.ReconBasicOmKeyInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,7 +50,7 @@ public void handlePutEvent(OMDBUpdateEvent<String, Object>
event, String tableNa
(k, count) -> count + 1L);
for (PartKeyInfo partKeyInfo : multipartKeyInfo.getPartKeyInfoMap()) {
- OmKeyInfo omKeyInfo =
OmKeyInfo.getFromProtobuf(partKeyInfo.getPartKeyInfo());
+ ReconBasicOmKeyInfo omKeyInfo =
ReconBasicOmKeyInfo.getFromProtobuf(partKeyInfo.getPartKeyInfo());
unReplicatedSizeMap.computeIfPresent(getUnReplicatedSizeKeyFromTable(tableName),
(k, size) -> size + omKeyInfo.getDataSize());
replicatedSizeMap.computeIfPresent(getReplicatedSizeKeyFromTable(tableName),
@@ -75,7 +75,7 @@ public void handleDeleteEvent(OMDBUpdateEvent<String, Object>
event, String tabl
(k, count) -> count > 0 ? count - 1L : 0L);
for (PartKeyInfo partKeyInfo : multipartKeyInfo.getPartKeyInfoMap()) {
- OmKeyInfo omKeyInfo =
OmKeyInfo.getFromProtobuf(partKeyInfo.getPartKeyInfo());
+ ReconBasicOmKeyInfo omKeyInfo =
ReconBasicOmKeyInfo.getFromProtobuf(partKeyInfo.getPartKeyInfo());
unReplicatedSizeMap.computeIfPresent(getUnReplicatedSizeKeyFromTable(tableName),
(k, size) -> {
long newSize = size > omKeyInfo.getDataSize() ? size -
omKeyInfo.getDataSize() : 0L;
@@ -121,7 +121,7 @@ public void handleUpdateEvent(OMDBUpdateEvent<String,
Object> event, String tabl
// Calculate old sizes
for (PartKeyInfo partKeyInfo : oldMultipartKeyInfo.getPartKeyInfoMap()) {
- OmKeyInfo omKeyInfo =
OmKeyInfo.getFromProtobuf(partKeyInfo.getPartKeyInfo());
+ ReconBasicOmKeyInfo omKeyInfo =
ReconBasicOmKeyInfo.getFromProtobuf(partKeyInfo.getPartKeyInfo());
unReplicatedSizeMap.computeIfPresent(getUnReplicatedSizeKeyFromTable(tableName),
(k, size) -> size - omKeyInfo.getDataSize());
replicatedSizeMap.computeIfPresent(getReplicatedSizeKeyFromTable(tableName),
@@ -130,7 +130,7 @@ public void handleUpdateEvent(OMDBUpdateEvent<String,
Object> event, String tabl
// Calculate new sizes
for (PartKeyInfo partKeyInfo : newMultipartKeyInfo.getPartKeyInfoMap()) {
- OmKeyInfo omKeyInfo =
OmKeyInfo.getFromProtobuf(partKeyInfo.getPartKeyInfo());
+ ReconBasicOmKeyInfo omKeyInfo =
ReconBasicOmKeyInfo.getFromProtobuf(partKeyInfo.getPartKeyInfo());
unReplicatedSizeMap.computeIfPresent(getUnReplicatedSizeKeyFromTable(tableName),
(k, size) -> size + omKeyInfo.getDataSize());
replicatedSizeMap.computeIfPresent(getReplicatedSizeKeyFromTable(tableName),
@@ -160,7 +160,7 @@ public Triple<Long, Long, Long> getTableSizeAndCount(
if (kv != null && kv.getValue() != null) {
OmMultipartKeyInfo multipartKeyInfo = (OmMultipartKeyInfo)
kv.getValue();
for (PartKeyInfo partKeyInfo : multipartKeyInfo.getPartKeyInfoMap())
{
- OmKeyInfo omKeyInfo =
OmKeyInfo.getFromProtobuf(partKeyInfo.getPartKeyInfo());
+ ReconBasicOmKeyInfo omKeyInfo =
ReconBasicOmKeyInfo.getFromProtobuf(partKeyInfo.getPartKeyInfo());
unReplicatedSize += omKeyInfo.getDataSize();
replicatedSize += omKeyInfo.getReplicatedSize();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]