adoroszlai commented on code in PR #7776:
URL: https://github.com/apache/ozone/pull/7776#discussion_r1935409147
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisor.java:
##########
@@ -232,14 +232,24 @@ private ReplicationSupervisor(StateContext context,
ExecutorService executor,
* Queue an asynchronous download of the given container.
*/
public void addTask(AbstractReplicationTask task) {
+ if (queueHasRoomFor(task)) {
+ initCounters(task);
+ addToQueue(task);
+ }
+ }
+
+ private boolean queueHasRoomFor(AbstractReplicationTask task) {
final int max = maxQueueSize;
if (getTotalInFlightReplications() >= max) {
LOG.warn("Ignored {} command for container {} in Replication Supervisor"
- + "as queue reached max size of {}.",
- task.getClass(), task.getContainerId(), max);
- return;
+ + "as queue reached max size of {}.",
+ task.getClass(), task.getContainerId(), max);
Review Comment:
```suggestion
+ "as queue reached max size of {}.",
task.getClass(), task.getContainerId(), max);
```
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisor.java:
##########
@@ -255,14 +265,16 @@ public void addTask(AbstractReplicationTask task) {
}
}
}
+ }
+ private void addToQueue(AbstractReplicationTask task) {
if (inFlight.add(task)) {
if (task.getPriority() != ReplicationCommandPriority.LOW) {
// Low priority tasks are not included in the replication queue sizes
// returned to SCM in the heartbeat, so we only update the count for
// priorities other than low.
taskCounter.computeIfAbsent(task.getClass(),
- k -> new AtomicInteger()).incrementAndGet();
+ k -> new AtomicInteger()).incrementAndGet();
Review Comment:
```suggestion
k -> new AtomicInteger()).incrementAndGet();
```
--
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]