jon-wei commented on a change in pull request #8287: Cleanup appenderators and 
segment walkers in UnifiedIndexerAppenderatorsManager
URL: https://github.com/apache/incubator-druid/pull/8287#discussion_r314547560
 
 

 ##########
 File path: 
server/src/main/java/org/apache/druid/segment/realtime/appenderator/UnifiedIndexerAppenderatorsManager.java
 ##########
 @@ -183,22 +192,48 @@ public Appenderator createOfflineAppenderatorForTask(
       IndexMerger indexMerger
   )
   {
-    Appenderator appenderator = Appenderators.createOffline(
-        schema,
-        rewriteAppenderatorConfigMemoryLimits(config),
-        metrics,
-        dataSegmentPusher,
-        objectMapper,
-        indexIO,
-        wrapIndexMerger(indexMerger)
-    );
-    return appenderator;
+    synchronized (this) {
+      DatasourceBundle datasourceBundle = datasourceBundles.computeIfAbsent(
+          schema.getDataSource(),
+          (datasource) -> {
+            return new DatasourceBundle(datasource);
+          }
+      );
+
+      Appenderator appenderator = Appenderators.createOffline(
+          schema,
+          rewriteAppenderatorConfigMemoryLimits(config),
+          metrics,
+          dataSegmentPusher,
+          objectMapper,
+          indexIO,
+          wrapIndexMerger(indexMerger)
+      );
+      datasourceBundle.addAppenderator(taskId, appenderator);
+      return appenderator;
+    }
   }
 
   @Override
-  public void removeAppenderatorForTask(String taskId)
+  public void removeAppenderatorsForTask(
+      String taskId,
+      String dataSource
+  )
   {
-    // nothing to remove presently
+    synchronized (this) {
+      DatasourceBundle datasourceBundle = datasourceBundles.get(dataSource);
+      if (datasourceBundle == null) {
+        LOG.error("Could not find datasource bundle for [%s], task [%s]", 
dataSource, taskId);
 
 Review comment:
   I think this is more of an error at the level of the task manager and it 
would only be called after a task has finished (so I don't think it could be 
propagated to tasks), it's not fatal enough to stop altogether but I think it 
indicates bugs so I wanted to be ERROR instead of WARN. 
   
   
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to