suneet-s commented on a change in pull request #11227: URL: https://github.com/apache/druid/pull/11227#discussion_r629566613
########## File path: server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java ########## @@ -1423,4 +1424,40 @@ public boolean insertDataSourceMetadata(String dataSource, DataSourceMetadata me .execute() ); } + + @Override + public int removeDataSourceMetadataOlderThan(long timestamp, @Nullable Set<String> excludeDatasources) + { + DateTime dateTime = DateTimes.utc(timestamp); + List<String> datasources = connector.getDBI().withHandle( + handle -> handle + .createQuery( + StringUtils.format( + "SELECT dataSource FROM %1$s WHERE created_date < '%2$s'", + dbTables.getDataSourceTable(), + dateTime.toString() + ) + ) + .mapTo(String.class) + .list() + ); + return connector.getDBI().withHandle( Review comment: What happens if an exception is thrown while trying to delete the datasources? `withHandle` will throw a `CallbackFailedException` - is this handled somewhere else in the code? -- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org