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_r315943072
########## 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: Hm, I think it's fine as ERROR for now since the operator can't really take any action to remedy the situation, and I don't think the error is severe enough to warrant alerting. We could revisit this area in the future if needed. ---------------------------------------------------------------- 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