Skip to content
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

feat(dml): sent dml data from the same session to a fixed worker node/channel #14380

Merged
merged 7 commits into from
Jan 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refine
  • Loading branch information
chenzl25 committed Jan 8, 2024
commit 946c3c75e94fc03c9460964b19d31c865527b61f
7 changes: 2 additions & 5 deletions src/frontend/src/scheduler/distributed/stage.rs
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ use std::rc::Rc;
use std::sync::Arc;
use std::time::Duration;

use anyhow::{anyhow, Context};
use anyhow::anyhow;
use arc_swap::ArcSwap;
use futures::stream::Fuse;
use futures::{stream, StreamExt, TryStreamExt};
@@ -709,10 +709,7 @@ impl StageRunner {
return Err(SchedulerError::EmptyWorkerNodes);
}
return Ok(Some(
candidates
.get(self.stage.session_id.0 as usize % candidates.len())
.context("no available worker node for dml")?
.clone(),
candidates[self.stage.session_id.0 as usize % candidates.len()].clone(),
));
};

7 changes: 2 additions & 5 deletions src/frontend/src/scheduler/local.rs
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::Arc;
use std::time::Duration;

use anyhow::{anyhow, Context};
use anyhow::anyhow;
use futures::stream::BoxStream;
use futures::StreamExt;
use futures_async_stream::try_stream;
@@ -583,10 +583,7 @@ impl LocalQueryExecution {
if candidates.is_empty() {
return Err(SchedulerError::EmptyWorkerNodes);
}
candidates
.get(stage.session_id.0 as usize % candidates.len())
.context("no available worker node for dml")?
.clone()
candidates[stage.session_id.0 as usize % candidates.len()].clone()
};
Ok(vec![worker_node])
} else {
1 change: 1 addition & 0 deletions src/source/src/table.rs
Original file line number Diff line number Diff line change
@@ -95,6 +95,7 @@ impl TableDmlHandle {
}
let len = guard.changes_txs.len();
// Use session id instead of txn_id to choose channel so that we can preserve transaction order in the same session.
chenzl25 marked this conversation as resolved.
Show resolved Hide resolved
// PS: only hold if there's no scaling on the table.
let sender = guard
.changes_txs
.get((session_id % len as u32) as usize)
Loading