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

 ##########
 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);
+      } else {
+        List<Appenderator> existingAppenderators = 
datasourceBundle.taskAppenderatorMap.remove(taskId);
+        if (existingAppenderators == null) {
+          LOG.error("Tried to remove appenderators for task [%s] but none were 
found.", taskId);
 
 Review comment:
   Same about the log level.

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