Huginn-kio opened a new pull request, #8660: URL: https://github.com/apache/hbase/pull/8660
## HBASE-30391 ### Summary When `ByteArrayOutputStream` expands, it copies the entire backing array, including unused capacity. This change limits the copy to the bytes already written. See https://issues.apache.org/jira/browse/HBASE-30391 ### Root cause `ByteArrayOutputStream.checkSizeAndGrow` copied `buf.length` bytes when allocating a larger backing array, although only `pos` bytes contain valid stream data. ### Fix Copy only `pos` bytes during expansion. This preserves the stream contents while avoiding copies of unused capacity and reducing heap copy work. ### Testing - `mvn -pl hbase-common -am -DskipTests compile` with JDK 17: `BUILD SUCCESS`. - Targeted Checkstyle for `ByteArrayOutputStream.java`: `BUILD SUCCESS`. - The full reactor quality check was also attempted; it is currently blocked by pre-existing `InterfaceIsType` violations in untouched `hbase-annotations` test interfaces. ### Compatibility - No public API, configuration, persistence-format, or wire-format changes. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
