Copilot commented on code in PR #8003:
URL: https://github.com/apache/ozone/pull/8003#discussion_r2135570932


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/BackgroundService.java:
##########
@@ -86,6 +86,11 @@ public void setPoolSize(int size) {
     exec.setCorePoolSize(size);
   }
 
+  public synchronized void setServiceTimeoutInNanos(long newTimeout) {
+    LOG.info("{} timeout is {} {}", serviceName, newTimeout, 
TimeUnit.NANOSECONDS.name().toLowerCase());
+    this.serviceTimeoutInNanos = newTimeout;

Review Comment:
   The `serviceTimeoutInNanos` field is written under synchronization but read 
without synchronization, which can lead to visibility issues. Consider 
declaring the field as `volatile` or using an `AtomicLong` to ensure 
thread-safe updates and reads.
   ```suggestion
       this.serviceTimeoutInNanos.set(newTimeout);
   ```



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -5159,6 +5161,12 @@ private String 
reconfOzoneDirDeletingServiceInterval(String newVal) {
     return newVal;
   }
 
+  private String reconfOzoneThreadNumberDirDeletion(String newVal) {
+    getConfiguration().set(OZONE_THREAD_NUMBER_DIR_DELETION, newVal);
+    
getKeyManager().getDirDeletingService().setPoolSize(Integer.parseInt(newVal));

Review Comment:
   Parsing the new thread count directly may throw `NumberFormatException` on 
invalid input and cause the reconfiguration task to fail without a clear error 
message. Consider validating the string (e.g., with a regex or try/catch) and 
returning a descriptive error for invalid values.



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