-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for selective loading of lookups in the task layer #16328
Add support for selective loading of lookups in the task layer #16328
Conversation
There is another PR #16266 which also addresses the same problem, but takes a slightly different approach. cc: @cryptoe , @Akshat-Jain |
As I see it, pros of this approach:
Cons of this approach:
cc: @cryptoe |
server/src/main/java/org/apache/druid/query/lookup/LookupListeningAnnouncerConfig.java
Outdated
Show resolved
Hide resolved
@kfaraz IIUC, it's not. This PR only intends to add support for selective loading of lookups in the task layer, with task changes only for a sample task (KillUnusedSegmentsTask). The work for extracting the list of lookups and passing them for tasks that need lookups is pending, and I was thinking of it as my next step as a separate PR. With that said, this should be applicable for both approaches. |
@Akshat-Jain Hi |
@IgorBerman Sure, I can do that! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes, @Akshat-Jain ! Overall, the changes look good. I have left some minor suggestions.
indexing-service/src/main/java/org/apache/druid/indexing/common/task/Task.java
Outdated
Show resolved
Hide resolved
...xing-service/src/main/java/org/apache/druid/indexing/common/task/KillUnusedSegmentsTask.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/query/lookup/LookupListeningAnnouncerConfigTest.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/query/lookup/LookupListeningAnnouncerConfigTest.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/query/lookup/LookupReferencesManagerTest.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/query/lookup/LookupReferencesManagerTest.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/query/lookup/LookupReferencesManagerTest.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/query/lookup/LookupReferencesManagerTest.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/query/lookup/LookupReferencesManagerTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing up the tests!
@IgorBerman Have updated CompactionTask to not load lookups as well. |
indexing-service/src/main/java/org/apache/druid/indexing/common/task/Task.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java
Outdated
Show resolved
Hide resolved
@Provides | ||
@LazySingleton | ||
@Named(DataSourceTaskIdHolder.LOOKUPS_TO_LOAD_FOR_TASK) | ||
public List<String> getLookupsToLoad(final Task task) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does it work for indexers and mm less task system. Does that code go via cliPeon ? Maybe you can test locally and see how it goes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indexer is a single process, so it should always load all lookups, right? IIUC, the changes here would only bind the lookupsToLoad
for peons, which is what we want.
Not too sure about MM-less system. The other PR had tweaked K8sTaskAdapter
to handle it there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using Indexers. All lookups are loaded at the very beginning for Indexers. Changes of this PR don't affect the Indexer flow in any way.
For MM-less system, I'm not sure yet. @cryptoe Based on our earlier discussion, I have to setup the Kubernetes thing locally and try MM-less ingestion, and see what happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmless runs CliPeon as the entrypoint so it should work as intended
indexing-service/src/main/java/org/apache/druid/indexing/common/task/CompactionTask.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java
Outdated
Show resolved
Hide resolved
e26a4e2
to
4fc0d13
Compare
server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
indexing-service/src/main/java/org/apache/druid/indexing/common/task/Task.java
Outdated
Show resolved
Hide resolved
...xing-service/src/main/java/org/apache/druid/indexing/common/task/KillUnusedSegmentsTask.java
Outdated
Show resolved
Hide resolved
indexing-service/src/main/java/org/apache/druid/indexing/common/task/Task.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/server/lookup/cache/LookupLoadingSpecTest.java
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM. Looking forward to results from MM less ingestion testing.
server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…e#16328) Changes: - Add `LookupLoadingSpec` to support 3 modes of lookup loading: ALL, NONE, ONLY_REQUIRED - Add method `Task.getLookupLoadingSpec()` - Do not load any lookups for `KillUnusedSegmentsTask`
Description
This PR adds support for loading a specified subset of lookups in the task layer via a new class named
LookupLoadingSpec
. It updates theLookupReferencesManager
to support 3 modes:LookupLoadingSpec.mode
isALL
.LookupLoadingSpec.mode
isNONE
.LookupLoadingSpec.mode
isONLY_REQUIRED
. The lookups to load are consumed usingLookupLoadingSpec#getLookupsToLoad()
.This PR also updates the
KillUnusedSegmentsTask
to return an empty set of lookups to load, as this task has no dependency on any lookups. Future work would involve implementing this functionality for other tasks, depending on their dependency on lookups.Test plan
KillUnusedSegmentsTask
with different implementations ofgetLookupsToLoad()
method, to test the behavior of all the 3 aforementioned modes.This PR has: