guilherme-dsantos opened a new pull request, #3292:
URL: https://github.com/apache/amoro/pull/3292

   Fix/Resolve #3286
   
   **Changes made:**
   - Added synchronization block in TableRuntime.getQuotaTime() to prevent 
ConcurrentModificationException
   - The fix synchronizes both removeIf and stream operations to ensure thread 
safety
   
   **Technical details:**
   - Location: org.apache.amoro.server.table.TableRuntime
   - Method modified: getQuotaTime()
   - Added synchronized block around list operations to prevent concurrent 
modification
   
   **Testing:**
   - While the original error couldn't be reproduced, the fix ensures thread 
safety for concurrent access to taskQuotas list
   
   **Code changes:**
   ```java
   public long getQuotaTime() {
       long calculatingEndTime = System.currentTimeMillis();
       long calculatingStartTime = calculatingEndTime - 
AmoroServiceConstants.QUOTA_LOOK_BACK_TIME;
       long finishedTaskQuotaTime;
       synchronized (taskQuotas) {
           taskQuotas.removeIf(task -> task.checkExpired(calculatingStartTime));
           finishedTaskQuotaTime = taskQuotas.stream()
                   .mapToLong(taskQuota -> 
taskQuota.getQuotaTime(calculatingStartTime))
                   .sum();
       }
       return optimizingProcess == null
               ? finishedTaskQuotaTime
               : finishedTaskQuotaTime
               + optimizingProcess.getRunningQuotaTime(calculatingStartTime, 
calculatingEndTime);
   }
   


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

Reply via email to