-
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
Disable loading lookups by default in CompactionTask #16420
Disable loading lookups by default in CompactionTask #16420
Conversation
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/CompactionTask.java
Outdated
Show resolved
Hide resolved
indexing-service/src/main/java/org/apache/druid/indexing/common/task/CompactionTask.java
Outdated
Show resolved
Hide resolved
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/server/lookup/cache/LookupLoadingSpec.java
Show resolved
Hide resolved
sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerContext.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/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
Show resolved
Hide resolved
|
||
// Return params: <context, default LookupLoadingSpec, expected LookupLoadingSpec> | ||
Object[][] params = new Object[][]{ | ||
// Default spec is returned in the case of context not having the lookup keys. |
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 wonder if the intention was to name the set of config somehow; you could use: Named.of("default", ... )
to name parameters
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.
Sorry, I didn't get it. Could you please elaborate? Thanks!
Not sure if this helps, but the intention here was just to have parameterized test as it would be cleaner than having separate test methods for the different combinations. So provideParamsForTestCreateFromContext
method is just supplying params to testGetLookupLoadingSpecFromContext
test via @MethodSource("provideParamsForTestCreateFromContext")
.
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.
that's great and fine ; but instead of leaving comments about a param's intentions - its better to name it with Named ; so a more descriptive name will be shown when the testcase is run - an SO example is here
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.
@kgyrtkirk I see.
The above test was refactored into non-parameterized tests, so this should be fine, but will keep that in mind for future code changes.
.../src/test/java/org/apache/druid/indexing/common/task/ClientCompactionTaskQuerySerdeTest.java
Fixed
Show fixed
Hide fixed
.../src/test/java/org/apache/druid/indexing/common/task/ClientCompactionTaskQuerySerdeTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/apache/druid/indexing/common/task/ClientCompactionTaskQuerySerdeTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/apache/druid/indexing/common/task/ClientCompactionTaskQuerySerdeTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/apache/druid/indexing/common/task/ClientCompactionTaskQuerySerdeTest.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.
Left one test related comment, rest of the changes look good.
server/src/test/java/org/apache/druid/server/lookup/cache/LookupLoadingSpecTest.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/server/lookup/cache/LookupLoadingSpecTest.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/server/lookup/cache/LookupLoadingSpecTest.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/server/lookup/cache/LookupLoadingSpecTest.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/server/lookup/cache/LookupLoadingSpecTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/apache/druid/indexing/common/task/ClientCompactionTaskQuerySerdeTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/apache/druid/indexing/common/task/ClientCompactionTaskQuerySerdeTest.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/apache/druid/server/lookup/cache/LookupLoadingSpecTest.java
Show resolved
Hide resolved
Changes look good to me. @kgyrtkirk , @cryptoe , do you have any further feedback? |
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.
The description seems outdated. Can you please update @Akshat-Jain
indexing-service/src/main/java/org/apache/druid/indexing/common/task/CompactionTask.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
This patch failed on the group |
The cds check passed on the penultimate commit on this PR (https://github.com/apache/druid/actions/runs/9061792112/job/24906027048), and the latest commit didn't have anything other than updating an error message in a couple of files (e6e92a4). Also this PR doesn't touch the cds part at all, hence was merged. |
Description
This PR updates CompactionTask to not load any lookups by default, unless
transformSpec
is present.If transformSpec is present, we will make the decision based on context values, loading all lookups by default. This is done to ensure backward compatibility since transformSpec can reference lookups.
If transform spec is not present and no context value is passed, we donot load any lookup.
This behavior can be overridden by supplying
lookupLoadingMode
andlookupsToLoad
in the task context.Other changes/refactoring:
LookupLoadingSpec#getSpecFromContext
.Task#getLookupLoadingSpec
to returnLookupLoadingSpec.getSpecFromContext(getContext(), LookupLoadingSpec.ALL)
. The defaultALL
ensures that no existing behavior is broken, unless context has been overridden. Making this change inTask
interface prevents us from having to make this change in a bunch of tasks that are spawned by CompactionTask.Test Plan
lookupLoadingMode
andlookupsToLoad
- validated that the lookups in all tasks (compaction + spawned) were loaded as per the overridden context. This would help achieve any use-cases where lookups are needed during compaction.This PR has: