shuan1026 opened a new pull request, #11116: URL: https://github.com/apache/ozone/pull/11116
<h3 data-heading="What changes were proposed in this pull request?">What changes were proposed in this pull request?</h3> <p><code>OmMetadataManagerImpl.getExpiredOpenKeys</code>'s hsync-commit branch called <code>OmKeyLocationInfoGroup.createLocationList()</code> on the key's latest version group just to stream it once while building the commit <code>KeyArgs</code> protobuf, allocating a throwaway flattened <code>List</code> per matched hsync key.</p> <p>This PR swaps the method reference for the zero-copy <code>getLocationLists()</code> accessor and inserts a <code>flatMap(List::stream)</code> to keep the rest of the chain (<code>.map(getProtobuf).forEach(addKeyLocations)</code>) unchanged.</p> <p>Additionally, a throwaway (not committed) JUnit micro-benchmark measured per-<code>KeyArgs</code>-construction thread allocation for both implementations (JDK 21.0.12, 50,000-iteration warmup then 500,000 measured iterations per shape, output <code>KeyArgs</code> protobufs asserted equal, <code>volatile</code> sink to block JIT elimination):</p> Key Shape | Before | After | Saved -- | -- | -- | -- 1 version list x 1 block | 352 ns / 1372 B | 177 ns / 1154 B | 218 B 1 version list x 4 blocks | 367 ns / 2496 B | 387 ns / 2296 B | 200 B 1 version list x 32 blocks | 2155 ns / 13264 B | 2086 ns / 12728 B | 536 B 4 version lists x 4 blocks | 1144 ns / 7432 B | 1117 ns / 7048 B | 384 B 16 version lists x 8 blocks | 8176 ns / 51280 B | 8005 ns / 49088 B | 2192 B <h3 data-heading="What is the link to the Apache JIRA">What is the link to the Apache JIRA</h3> <p><a href="https://issues.apache.org/jira/browse/HDDS-16257" class="external-link" target="_blank" rel="noopener nofollow">https://issues.apache.org/jira/browse/HDDS-16257</a></p> <h3 data-heading="How was this patch tested?">How was this patch tested?</h3> <ul> <li><code>TestOpenKeyCleanupService#testCommitExpiredHsyncKeys</code></li> <li><code>TestOpenKeyCleanupService#testCleanupExpiredOpenKeys</code></li> <li><code>TestOpenKeyCleanupService#testIgnoreExpiredRecoverhsyncKeys</code></li> </ul> -- 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]
