chungen0126 commented on code in PR #10884:
URL: https://github.com/apache/ozone/pull/10884#discussion_r3807960516


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/QuotaRepairTask.java:
##########
@@ -584,53 +604,110 @@ private <VALUE> void recalculateUsages(
     List<Future<?>> tasks = new ArrayList<>();
     AtomicBoolean isRunning = new AtomicBoolean(true);
     for (int i = 0; i < TASK_THREAD_CNT; ++i) {
-      tasks.add(executor.submit(() -> captureCount(
-          prefixUsageMap, q, isRunning, haveValue)));
+      tasks.add(executor.submit(() -> captureCount(q, isRunning, kvConsumer)));
     }
     int count = 0;
     long startTime = Time.monotonicNow();
-    try (Table.KeyValueIterator<String, VALUE> keyIter
-        = table.iterator(null, haveValue ? KEY_AND_VALUE : KEY_ONLY)) {
+    Exception failure = null;
+    try {
       while (keyIter.hasNext()) {
         count++;
         kvList.add(keyIter.next());
         if (kvList.size() == BATCH_SIZE) {
-          q.put(kvList);
+          putBatch(q, kvList, tasks);
           kvList = new ArrayList<>(BATCH_SIZE);
         }
       }
-      q.put(kvList);
+      putBatch(q, kvList, tasks);

Review Comment:
   If the total number of keys is exactly a multiple of the batch size, this 
`putBatch` will put an empty `kvList`. I think it would be better to add a 
condition here to check if `kvList` is not empty before putting it.



-- 
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]

Reply via email to