Skip to content

MSQ: Use task context flag useConcurrentLocks to determine task lock type#17193

Merged
cryptoe merged 1 commit intoapache:masterfrom
kfaraz:msq_task_lock_type
Sep 30, 2024
Merged

MSQ: Use task context flag useConcurrentLocks to determine task lock type#17193
cryptoe merged 1 commit intoapache:masterfrom
kfaraz:msq_task_lock_type

Conversation

@kfaraz
Copy link
Copy Markdown
Contributor

@kfaraz kfaraz commented Sep 30, 2024

Changes

  • Determine task lock type in MSQControllerTask using both the task context and the query context
  • Add method taskLockType() to ControllerContext so that ControllerImpl
    may use the task lock type that is determined in MsqControllerTask
  • Clean up MSQControllerTaskTest and add test for lock type

@github-actions github-actions Bot added Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Sep 30, 2024
@kfaraz kfaraz added this to the 31.0.0 milestone Sep 30, 2024
/**
* Task lock type.
*/
TaskLockType taskLockType();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems weird to put it in the context.
From the code, it seems the primary purpose of this is to aid testing ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest removing it. We already have the MSQ controller task for assertion in the UT's.

Copy link
Copy Markdown
Contributor Author

@kfaraz kfaraz Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the code, it seems the primary purpose of this is to aid testing ?

It is needed to get the task lock type in ControllerImpl.
Since ControllerImpl doesn't have access to the task context (present in the MSQControllerTask), I had to add this.

Do you think there is a cleaner way to achieve the same?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it is better to add a method to just return the task object itself?

MSQControllerTask task();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would become a cyclic dependency.
The current approach seems better. Thanks for the explanation.

Copy link
Copy Markdown
Contributor

@LakshSingla LakshSingla Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems weird to me as well. ControllerContext seems like a place to add stuff that is specific for a server type (indexer/middle manager/ standalone server), as opposed to a general configuration that does not change across all the servers (like an infra change on how to communicate with workers, create workers, check if the controller is alive etc versus a config change like query timeout). What's the cyclic dependency if we move this out?

Do you think there is a cleaner way to achieve the same?

WorkerImpl has a reference to the WorkerTask during the construction time, which it uses to have access to the context. Can a similar approach be used for controller as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If WorkerImpl already does it, I guess it would make sense to just pass MSQControllerTask as a constructor arg to ControllerImpl.

I looked at the code, it doesn't seem like there should be any cyclic dependency since controller is initialized in MSQControllerTask.runTask() and is not required on object creation.

@kfaraz
Copy link
Copy Markdown
Contributor Author

kfaraz commented Sep 30, 2024

Thanks for the quick review, @cryptoe !

@cryptoe cryptoe merged commit 28fead5 into apache:master Sep 30, 2024
@kfaraz kfaraz deleted the msq_task_lock_type branch October 1, 2024 03:16
kfaraz added a commit to kfaraz/druid that referenced this pull request Oct 4, 2024
kfaraz added a commit that referenced this pull request Oct 4, 2024
…) (#17074) (#17076) (#17077) (#17193) (#17243)

Backport the following patches for a clean backport of Dart changes
1. Add "targetPartitionsPerWorker" setting for MSQ. (#17048)
2. MSQ: Improved worker cancellation. (#17046)
3. Add "includeAllCounters()" to WorkerContext. (#17047)
4. MSQ: Include worker context maps in WorkOrders. (#17076)
5. TableInputSpecSlicer changes to support running on Brokers. (#17074)
6. Fix call to MemoryIntrospector in IndexerControllerContext. (#17066)
7. MSQ: Add QueryKitSpec to encapsulate QueryKit params. (#17077)
8. MSQ: Use task context flag useConcurrentLocks to determine task lock type (#17193)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants