kfaraz commented on code in PR #18045:
URL: https://github.com/apache/druid/pull/18045#discussion_r2120207126
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/TaskStorageDirTracker.java:
##########
@@ -154,6 +159,7 @@ public synchronized StorageSlot pickStorageSlot(String
taskId)
public synchronized void returnStorageSlot(StorageSlot slot)
{
if (slot.getParentRef() == this) {
+ --numUsedSlots;
Review Comment:
Please do this after the `runningTaskId` has been set to null.
It wouldn't make any functional difference but makes for better symmetry.
The order should be:
increment slot count -> use slot -> give up slot -> decrement slot count.
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/TaskStorageDirTracker.java:
##########
@@ -189,6 +196,7 @@ public synchronized Map<String, StorageSlot>
findExistingTaskDirs(List<String> t
missingIds.add(taskId);
} else {
candidateSlot.runningTaskId = taskId;
+ ++numUsedSlots;
Review Comment:
Please put this before the above line for symmetry with the other place
where this is being incremented.
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/ForkingTaskRunner.java:
##########
@@ -713,29 +713,22 @@ public static String getMaskedCommand(List<String>
maskedProperties, List<String
@Override
public Map<String, Long> getTotalTaskSlotCount()
{
- return ImmutableMap.of(workerConfig.getCategory(),
getTotalTaskSlotCountLong());
- }
-
- public long getTotalTaskSlotCountLong()
- {
- return workerConfig.getCapacity();
+ return ImmutableMap.of(workerConfig.getCategory(),
getWorkerTotalTaskSlotCount());
}
@Override
public Map<String, Long> getIdleTaskSlotCount()
{
- return ImmutableMap.of(workerConfig.getCategory(),
Math.max(getTotalTaskSlotCountLong() - getUsedTaskSlotCountLong(), 0));
+ return ImmutableMap.of(
Review Comment:
Nit: use `Map.of` instead.
--
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]