You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/09/07 10:20:29 UTC
[GitHub] [ozone] siddhantsangwan commented on a diff in pull request #3738: HDDS-7204. EC: Schedule UnderReplicatedProcessor and OverReplicatedProcessor threads in RM instead of StorageContainerManager
siddhantsangwan commented on code in PR #3738:
URL: https://github.com/apache/ozone/pull/3738#discussion_r964660812
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationManager.java:
##########
@@ -248,6 +261,38 @@ public synchronized void stop() {
}
}
+ /**
+ * Create Replication Manager sub services such as Over and Under Replication
+ * processors.
+ */
+ private void createSubServices() {
Review Comment:
> I thought we concluded that these sub-services should not be registered with the ServiceManager themselves, but just be threads managed within the replication manager?
Yeah. When implementing that, I realised that we would end up writing code similar to BackgroundSCMService. `BackgroundThread` implementing Runnable will have something like:
```
private void run() {
while (running.get()) {
try {
if (shouldRun()) {
try {
periodicalTask.run();
} catch (Throwable e) {
log.error("Caught Unhandled exception in {}. The task will be " +
"re-tried in {}ms", getServiceName(), intervalInMillis, e);
}
}
synchronized (this) {
if (!runImmediately) {
wait(intervalInMillis);
}
runImmediately = false;
}
} catch (InterruptedException e) {
log.warn("{} is interrupted, exit", serviceName);
Thread.currentThread().interrupt();
running.set(false);
}
}
}
```
We can avoid doing this by using BackgroundSCMService. The downside is that our definition of whether they are RM sub threads or SCM threads becomes hazy. But we are solving a part of that problem by restricting their visibility to only RM and SCMServiceManager.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org