Remove a redundant chat handler service name announcement
I believe this announcement is redundant, moreover, it's not unannounced afterward. https://github.com/druid-io/druid/blob/693e3575f9ff878d94770948f468810f91552b32/server/src/main/java/io/druid/segment/realtime/firehose/EventReceiverFirehoseFactory.java#L134
if (chatHandlerProvider.isPresent()) {
log.info("Found chathandler of class[%s]", chatHandlerProvider.get().getClass().getName());
chatHandlerProvider.get().register(serviceName, firehose);
if (serviceName.contains(":")) {
chatHandlerProvider.get().register(serviceName.replaceAll(".*:", ""), firehose); // rofl
}
} else {
log.warn("No chathandler detected");
}
otherwise, if it is used somehow it should be documented. But in any way, I think, there should be a way to solve it with one service name announcement.
Currently, these redundant entries make a lot of garbage in our Zookeeper discovery node.
IIRC this extra announcement was for compatibility with Tranquility. It found tasks by looking for the chat handler announcement. And the // rofl line was a hack to make sure the firehose is announced in the format that Tranquility is looking for. I'm not sure if it's still needed, but that would be the place to look to figure that out.
Fwiw, Tranquility these days supports a non-ZK based method of discovering tasks (it can use the overlord APIs). So we could also make that the default and then probably remove chat handler announcements completely. They were an internal thing and nothing other than Tranquility was supposed to use them. So I think it'd be ok to remove them once Tranquility's default is changed, and a new Tranquility release is done, and release notes are updated accordingly.
@gianm thanks for your reply, when realtime task has done,the announcement znode will be removed,but it's parent directory still exist, can we remove them together?
I think the parent directory is the service discovery directory, which we wouldn't want to remove?
@gianm My version is 0.9.2 , for example, there is a datasource named A , then /druid/discovery/firehose:druid:overlord:A-003-0000-0000/a6e77875-b777-4fb2-8457-1441b7788253 and /druid/discovery/A-003-0000-0000/b6e5f62a-c3cc-4cff-8f82-1104a5d047fc could exist in zookeeper, after realtime task done, b6e5f62a-c3cc-4cff-8f82-1104a5d047fc and b6e5f62a-c3cc-4cff-8f82-1104a5d047fc could be removed ,but firehose:druid:overlord:A-003-0000-0000 and A-003-0000-0000 still exist, please correct me if i am wrong.
firehose:druid:overlord:A-003-0000-0000 and A-003-0000-0000 will exist, because this is how Curator Discovery works. Curator Discovery creates a node with all its parents for a service that means <service-name>/<generated-id>, while it deletes only a child <generated-id>.
org/apache/curator/curator-x-discovery/2.11.0/curator-x-discovery-2.11.0-sources.jar!/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java:235
client.create().creatingParentContainersIfNeeded().withMode(mode).forPath(path, bytes);
org/apache/curator/curator-x-discovery/2.11.0/curator-x-discovery-2.11.0-sources.jar!/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java:516
String path = pathForInstance(entry.service.getName(), entry.service.getId());
@egor-ryashin thanks for your reply,
Curator Discovery creates a node with all its parents for a service that means
<service-name>/<generated-id>, while it deletes only a child<generated-id>.
yes, my suggestion is to delete those redundant <service-name> znodes , nowadays , i removed them manually.
Because of client.delete().guaranteed().forPath(path) in Curator, it seems that this problem can not be resolved friendly.
This issue has been marked as stale due to 280 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.
This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.