adoroszlai opened a new pull request, #4873: URL: https://github.com/apache/ozone/pull/4873
## What changes were proposed in this pull request? `TestScmHAFinalization` intermittently reports `Found 2 leaked objects` (`CodecBuffer` instances). ``` 2023-06-08 19:50:12,664 [Finalizer] WARN db.CodecBuffer (CodecBuffer.java:finalize(129)) - LEAK 1: org.apache.hadoop.hdds.utils.db.CodecBuffer@292f4cc4, refCnt=1, capacity=3 allocation: org.apache.hadoop.hdds.utils.db.CodecBuffer.allocate(CodecBuffer.java:74) ... org.apache.hadoop.hdds.utils.db.TypedTable.putWithBatch(TypedTable.java:172) ``` `CodecBuffer`s created for batch operations are released on commit. They are leaked if the batch is closed without commit. https://github.com/apache/ozone/blob/b479a384e854b6eb62c429801ec3ce2acfa3c160/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBBatchOperation.java#L333-L339 This PR fixes the leak by clearing the batch's cache in `close()`. It does not commit the batch, which still must be done explicitly to persist the changes. https://issues.apache.org/jira/browse/HDDS-8803 ## How was this patch tested? Ran `TestScmHAFinalization#testSnapshotFinalization`: ``` [664dc5c1-8c56-4847-89db-9e9428244ac1@group-B4112365FA6F-StateMachineUpdater] WARN db.RDBBatchOperation (RDBBatchOperation.java:clear(189)) - discarding changes Batch-4: meta batchSize=105 B, discarded: 6 (90 B), #put=7, #del=0 ``` CI: https://github.com/adoroszlai/hadoop-ozone/actions/runs/5230215922 -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
