update docs for kafka lookup extension to specify correct extension loading requirements#16929
Closed
georgew5656 wants to merge 6 commits intoapache:masterfrom
Closed
update docs for kafka lookup extension to specify correct extension loading requirements#16929georgew5656 wants to merge 6 commits intoapache:masterfrom
georgew5656 wants to merge 6 commits intoapache:masterfrom
Conversation
Contributor
|
Is there a known issues part of the Druid docs? You could also document the error and provide the same explainer there. |
techdocsmith
requested changes
Aug 21, 2024
This reverts commit 2ccaf61.
Co-authored-by: Charles Smith <techdocsmith@gmail.com>
Co-authored-by: Charles Smith <techdocsmith@gmail.com>
Contributor
Author
|
i think i found a better way to fix this bug, so i'm gonna close this docs pr |
This was referenced Aug 27, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's not necessary to load both druid-lookups-cached-global and druid-kafka-extraction-namespace to use kafka lookups. In fact if you happen to load both in the wrong order (global lookups before kafka lookups), it actually breaks kafka lookups (see: #3538).
Background
the druid-kafka-extraction-namespace extension has a dependency on druid-lookups-cached-global, so when loading the extension, both modules ( and ) are included.
So when druid-kafka-extraction-namespace is included as a extension, both modules are loaded and the features for both extensions are loaded (kafka lookups and global cached lookups)
There is logic in ExtensionsLoader.tryAdd that checks whether a module has already been loaded during initialization and skips it if it already has been loaded.
This is a problem when both druid-kafka-extraction-namespace and druid-lookups-cached-global are specified because they both load NamespaceExtractionModule.
If druid-kafka-extraction-namespace is specified first, both NamespaceExtractionModule and KafkaExtractionNamespaceModule are loaded by the druid-kafka-extraction-namespace classloader, and the druid-lookups-cached-global classloader doesn't load anything since NamespaceExtractionModule was already loaded. This is fine because the features of druid-lookups-cached-global are served through the module NamespaceExtractionModule being loaded in druid-kafka-extraction-namespace. (this is essentially the same behavior as just loading druid-kafka-extraction-namespace, and this is why loading both extensions in this order works)
If druid-lookups-cached-global is specified first, NamespaceExtractionModule is loaded by the druid-lookups-cached-global class loader. The druid-kafka-extraction-namespace classloader will only load KafkaExtractionNamespaceModule because NamespaceExtractionModule has already been loaded. This is a problem because kafka lookups rely on classes bound in NamespaceExtractionModule that it can't access (because NamespaceExtractionModule is only bound in the druid-lookups-cached-global classloader). this is the cause of the linked bug
Description
IMO the current behavior is a little weird (loading one extension essentially loads two extensions), but to fix this we would have to either move the shared code into druid core or allow first class extension dependencies. For now i think it makes sense to update the documentation to specify that you should only ever load one of the two extensions.
I have tested this behavior in a druid cluster (loading just the kafka extension and trying to create both a kafka lookup and a cachedNamespace lookup)
Release note
Update documentation for enabling kafka and globally cached lookups
Key changed/added classes in this PR
This PR has: