You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "sadanand48 (via GitHub)" <gi...@apache.org> on 2025/02/03 08:59:13 UTC

[PR] HDDS-12186. Avoid array allocation for table iterator. [ozone]

sadanand48 opened a new pull request, #7797:
URL: https://github.com/apache/ozone/pull/7797

   ## What changes were proposed in this pull request?
   Changes in [HDDS-11508](https://issues.apache.org/jira/browse/HDDS-11508) [cause](https://github.com/apache/ozone/pull/7365#pullrequestreview-2589186593) byte[] allocation on iteration. The array is used only for getting its size. Using codecBuffer.getReadableBytes() instead.
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-12186
   
   ## How was this patch tested?
   Existing unit tests
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12186. Avoid array allocation for table iterator. [ozone]

Posted by "nandakumar131 (via GitHub)" <gi...@apache.org>.
nandakumar131 merged PR #7797:
URL: https://github.com/apache/ozone/pull/7797


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12186. Avoid array allocation for table iterator. [ozone]

Posted by "nandakumar131 (via GitHub)" <gi...@apache.org>.
nandakumar131 commented on PR #7797:
URL: https://github.com/apache/ozone/pull/7797#issuecomment-2631417643

   Thanks @sadanand48 for the contribution & thanks @adoroszlai for the review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12186. Avoid array allocation for table iterator. [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #7797:
URL: https://github.com/apache/ozone/pull/7797#discussion_r1939026921


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/Table.java:
##########
@@ -337,12 +337,8 @@ interface KeyValue<KEY, VALUE> {
 
     VALUE getValue() throws IOException;
 
-    default byte[] getRawKey() throws IOException {
-      return null;
-    }
-
-    default byte[] getRawValue() throws IOException {
-      return null;
+    default int getReadableBytes()  throws IOException {
+      return -1;

Review Comment:
   I think 0 would be safer for size calculations.
   
   `consumedSize += objectSerializedSize` etc.



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/Table.java:
##########
@@ -396,13 +392,8 @@ public V getValue() {
       }
 
       @Override
-      public byte[] getRawKey() throws IOException {
-        return rawKey;
-      }
-
-      @Override
-      public byte[] getRawValue() throws IOException {
-        return rawValue;
+      public int getReadableBytes() throws IOException {
+        return readableBytes;

Review Comment:
   nit: I think `readableBytes` is in `CodecBuffer` terms (which supports reading the data from the buffer).  For `KeyValue`, it may be better to rename this to `rawSize`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org