-
Notifications
You must be signed in to change notification settings - Fork 55
feat: added a pluggable WorkerTransport, with Arrow Flight optional.
#508
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
Open
mdashti
wants to merge
4
commits into
datafusion-contrib:main
Choose a base branch
from
paradedb:moe/worker-transport
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a2778c7
Added a pluggable `WorkerTransport` abstraction.
mdashti e9b3070
Added an in-process `InMemoryWorkerTransport`.
mdashti 53ff817
Made the Arrow-Flight transport optional behind a `flight` feature.
mdashti 6c4373d
Clarified the in-process extension point and Flight module docs.
mdashti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
2 changes: 1 addition & 1 deletion
2
tests/clickbench_correctness_test.rs → ...arks/tests/clickbench_correctness_test.rs
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
2 changes: 1 addition & 1 deletion
2
tests/clickbench_plans_test.rs → benchmarks/tests/clickbench_plans_test.rs
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
2 changes: 1 addition & 1 deletion
2
tests/stateful_data_cleanup.rs → benchmarks/tests/stateful_data_cleanup.rs
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
2 changes: 1 addition & 1 deletion
2
tests/tpcds_correctness_test.rs → benchmarks/tests/tpcds_correctness_test.rs
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
2 changes: 1 addition & 1 deletion
2
tests/tpcds_plans_test.rs → benchmarks/tests/tpcds_plans_test.rs
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
2 changes: 1 addition & 1 deletion
2
tests/tpch_correctness_test.rs → benchmarks/tests/tpch_correctness_test.rs
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| use datafusion::execution::TaskContext; | ||
| use tokio_util::sync::CancellationToken; | ||
|
|
||
| /// Per-execution cancellation token, attached to the [TaskContext] by `DistributedExec` when a | ||
| /// plan starts. One token per execution: not on the transport (a shared, process-wide instance | ||
| /// cannot own per-execution state) and not per connection (too granular). | ||
| #[derive(Clone)] | ||
| pub(crate) struct DistributedCancellationToken(pub(crate) CancellationToken); | ||
|
|
||
| /// Returns the per-execution [CancellationToken] attached to `ctx`, or a fresh never-cancelled one | ||
| /// if none is set (a context that did not come through `DistributedExec`). A transport's producers | ||
| /// and consumers watch this instead of the transport carrying a `cancellation()` method. | ||
| /// | ||
| /// The token does not replace transport-level stream close. Close propagates hop by hop and | ||
| /// surfaces only when the next blocking operation fails; the token reaches every in-process | ||
| /// participant the moment the head stream drops, including ones whose channels were never opened | ||
| /// or never read. | ||
| /// | ||
| /// Two caveats for watchers: | ||
| /// - The token fires on any drop of the head stream, including after normal exhaustion. Treat it | ||
| /// as teardown, not failure. | ||
| /// - It lives in a session-config extension, so it is process-local: it does not cross plan | ||
| /// serialization to remote workers. Out-of-process producers need their own teardown signal. | ||
| pub fn get_distributed_cancellation_token(ctx: &TaskContext) -> CancellationToken { | ||
| ctx.session_config() | ||
| .get_extension::<DistributedCancellationToken>() | ||
| .map(|t| t.0.clone()) | ||
| .unwrap_or_default() | ||
| } |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| use crate::common::now_ns; | ||
| use crate::coordinator::latency_metric::LatencyMetric; | ||
| use crate::{BytesCounterMetric, BytesMetricExt, DISTRIBUTED_DATAFUSION_TASK_ID_LABEL}; | ||
| use datafusion::physical_expr_common::metrics::{ExecutionPlanMetricsSet, Label, MetricBuilder}; | ||
| use std::sync::Arc; | ||
|
|
||
| /// Metrics that measure network details about communications between [crate::DistributedExec] and a | ||
| /// worker. Shared by every transport's dispatch path, so the plan-send byte/latency counters read | ||
| /// the same regardless of how plans reach the workers. | ||
| #[derive(Clone)] | ||
| pub struct CoordinatorToWorkerMetrics { | ||
| pub plan_bytes_sent: BytesCounterMetric, | ||
| pub plan_send_latency: Arc<LatencyMetric>, | ||
| pub instantiation_time: u64, | ||
| } | ||
|
|
||
| impl CoordinatorToWorkerMetrics { | ||
| pub fn new(metrics: &ExecutionPlanMetricsSet) -> Self { | ||
| Self { | ||
| // Metric that measures to total sum of bytes worth of subplans sent. | ||
| plan_bytes_sent: MetricBuilder::new(metrics) | ||
| .with_label(Label::new(DISTRIBUTED_DATAFUSION_TASK_ID_LABEL, "0")) | ||
| .bytes_counter("plan_bytes_sent"), | ||
| // Latency statistics about the network calls issued to the workers for feeding subplans. | ||
| plan_send_latency: Arc::new(LatencyMetric::new( | ||
| "plan_send_latency", | ||
| |b| b.with_label(Label::new(DISTRIBUTED_DATAFUSION_TASK_ID_LABEL, "0")), | ||
| metrics, | ||
| )), | ||
| instantiation_time: now_ns(), | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
There might be a miss conception here. This project does not use the Arrow-Flight protocol, more info about that decision here:
We still rely on the
arrow-flightlibrary for IPC decoding, but we don't adhere to the Arrow Flight protocol