adoroszlai commented on code in PR #8090:
URL: https://github.com/apache/ozone/pull/8090#discussion_r2001807151
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/CapacityVolumeChoosingPolicy.java:
##########
@@ -44,9 +44,6 @@ public class CapacityVolumeChoosingPolicy implements
VolumeChoosingPolicy {
public static final Logger LOG = LoggerFactory.getLogger(
CapacityVolumeChoosingPolicy.class);
- // Stores the index of the next volume to be returned.
- private final Random random = new Random();
Review Comment:
I mean if we use `Random`, the policy will use the next random value from
the sequence, regardless of which thread it is invoked in. With
`ThreadLocalRandom`, various threads will have their own sequences, so volume
choice will depend on which thread handles the request.
I think we use `ThreadLocalRandom` to avoid lock contention for getting
random values, but it's only OK if the threads are independent.
--
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]