maytasm commented on a change in pull request #11200:
URL: https://github.com/apache/druid/pull/11200#discussion_r627853881



##########
File path: 
server/src/main/java/org/apache/druid/metadata/SQLMetadataSupervisorManager.java
##########
@@ -249,6 +252,34 @@ public Void withHandle(Handle handle) throws Exception
     );
   }
 
+  @Override
+  public int removeTerminatedSupervisorsOlderThan(long timestamp)
+  {
+    int removedCount = 0;
+    DateTime dateTime = DateTimes.utc(timestamp);
+    Map<String, SupervisorSpec> supervisors = getLatest();
+    for (Map.Entry<String, SupervisorSpec> supervisor : 
supervisors.entrySet()) {
+      final SupervisorSpec spec = supervisor.getValue();
+      if (spec instanceof NoopSupervisorSpec) {
+        removedCount += dbi.withHandle(
+            handle -> {
+              Update sql = handle.createStatement(
+                  StringUtils.format(
+                      "DELETE FROM %1$s WHERE spec_id = :spec_id AND 
created_date < :date_time",

Review comment:
       Done




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

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