-
Notifications
You must be signed in to change notification settings - Fork 537
HDDS-12554. Support callback on completed reconfiguration #8391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Please review this PR @sumitagrawl @adoroszlai. TIA! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sarvekshayr we need register final callback to be triggered with required information as framework
...hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java
Outdated
Show resolved
Hide resolved
/** | ||
* Base class to support dynamic reconfiguration of configuration properties at runtime. | ||
*/ | ||
public abstract class ReconfigurableBase extends Configured implements Reconfigurable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need have test cases for this, as now ozone own this class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch @sarvekshayr.
Some minor comments inline.
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/HddsDatanodeService.java
Outdated
Show resolved
Hide resolved
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/conf/ReconfigurableBase.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
Outdated
Show resolved
Hide resolved
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/conf/ReconfigurableBase.java
Outdated
Show resolved
Hide resolved
public void start() { | ||
exec.scheduleWithFixedDelay(service, 0, interval, unit); | ||
public synchronized void start() { | ||
scheduledHandle = exec.scheduleWithFixedDelay(service, 0, interval, unit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add a check to not start the thread if scheduledHandle is not null?
cc @sumitagrawl
@@ -84,6 +84,7 @@ public class DirectoryDeletingService extends AbstractKeyDeletingService { | |||
private final DeletedDirSupplier deletedDirSupplier; | |||
|
|||
private AtomicInteger taskCount = new AtomicInteger(0); | |||
private String dirDeletingServiceInterval; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can remove this from the constructor as well as the getter function!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change requires removing the corresponding test in TestOmReconfiguration
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I believe it's safe to remove the test right now, as it was just checking the value of OZONE_DIR_DELETING_SERVICE_INTERVAL, not tracing the actual restart of the directory deleting service.
I'm not sure, but if possible, it would be better to write a test that checks the calling of "addReconfigurationCompleteCallback()" and "updateAndRestart()" upon changing the directory deletion interval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given few more comments and test cases for deeleteDirectoryService is not present
@@ -5107,6 +5140,37 @@ public void validateReplicationConfig(ReplicationConfig replicationConfig) | |||
} | |||
} | |||
|
|||
private void initOrUpdateDirDeletingService(OzoneConfiguration conf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the owner of dirDeletingService is KeyManagerImpl, so OM should not have callback and handling here.
@@ -5097,6 +5122,14 @@ private String reconfigureAllowListAllVolumes(String newVal) { | |||
return String.valueOf(allowListAllVolumes); | |||
} | |||
|
|||
private String reconfOzoneDirDeletingServiceInterval(String newVal) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this validation be registered by the service using this configuration, ie directorydeleteingService, and below logic also do validation, can that be used instead of using pattern if not null., configuration.getTimeDuration(
OZONE_BLOCK_DELETING_SERVICE_INTERVAL,
TimeUnit.MILLISECONDS);
public synchronized void stop() { | ||
LOG.info("Stopping {}", serviceName); | ||
if (scheduledHandle != null) { | ||
scheduledHandle.cancel(false); // don't interrupt running tasks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need interrupt running task make wait till its completed. this is as when start() new task, should not conflict is already running task. DirectoryDeletingTask can have reverse impact.
What changes were proposed in this pull request?
ReconfigurableBase
updates properties one by one. But some group of related properties may be reconfigurable only atomically. Example: replication is configured with "type" and "replication" (which is the type-specific description of the replication config). Updating type or replication separately results in invalid configuration (RATIS/THREE -> EC/THREE -> EC/rs-3-2-1024k should be updated in one step).To handle this situation, reconfiguration framework now allows registering callbacks for "reconfiguration completed" event. Reconfigured properties are accessible via
ReconfigurableBase#getReconfigurationTaskStatus
.What is the link to the Apache JIRA
HDDS-12554
How was this patch tested?
Tested on a docker cluster.
Logs
For invalid time duration format