Copilot commented on code in PR #9346:
URL: https://github.com/apache/ozone/pull/9346#discussion_r2556907612
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/MultiSnapshotLocks.java:
##########
@@ -67,8 +67,10 @@ public synchronized OMLockDetails
acquireLock(Collection<UUID> ids) throws OMExc
lock.acquireReadLocks(resource, keys);
if (omLockDetails.isLockAcquired()) {
objectLocks.addAll(keys);
+ this.lockDetails = OMLockDetails.EMPTY_DETAILS_LOCK_ACQUIRED;
+ } else {
+ this.lockDetails = OMLockDetails.EMPTY_DETAILS_LOCK_NOT_ACQUIRED;
}
- this.lockDetails = omLockDetails;
return omLockDetails;
Review Comment:
The method returns the ThreadLocal `omLockDetails` object directly instead
of returning the stored static instance. This defeats the purpose of the fix.
Consider returning `this.lockDetails` instead, or returning a copy of
`omLockDetails` via `getEmptyOmLockDetails(omLockDetails)` to maintain
consistency with the `SnapshotCache` pattern.
```suggestion
return this.lockDetails;
```
--
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]