-
Notifications
You must be signed in to change notification settings - Fork 95
LogicalTransactions in frontend Client #317
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
base: main
Are you sure you want to change the base?
Changes from 20 commits
c3c0039
ed0c361
1a4c8e8
84af9e8
77feddd
956a0cb
82c89ef
78a3611
2f3ebf6
bbc286b
6f88b42
4b4d0d9
08fcb59
33f1ec5
f57baa7
3349342
90b8ba9
b15c058
374107f
457abaf
b06fe28
c0528d3
a3f6d46
9f5c10f
b8f5fe6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
//! Binding between frontend client and a connection on the backend. | ||
|
||
use crate::{ | ||
net::{parameter::Parameters, ProtocolMessage}, | ||
net::{parameter::Parameters, ProtocolMessage, Query}, | ||
state::State, | ||
}; | ||
|
||
|
@@ -237,6 +237,13 @@ impl Binding { | |
Ok(()) | ||
} | ||
|
||
/// Execute a BEGIN on all servers | ||
/// TODO: Block mutli-shard BEGINs as transaction should not occur on multiple shards | ||
pub async fn begin(&mut self) -> Result<(), Error> { | ||
let query = Query::new("BEGIN"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See other comment. Client can pass options to |
||
self.execute(query.query()).await | ||
} | ||
|
||
pub async fn link_client(&mut self, params: &Parameters) -> Result<usize, Error> { | ||
match self { | ||
Binding::Server(Some(ref mut server)) => server.link_client(params).await, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,8 @@ use crate::{ | |
Error as BackendError, | ||
}, | ||
frontend::{ | ||
buffer::BufferedQuery, router::Error as RouterError, Buffer, Command, Comms, | ||
PreparedStatements, Router, RouterContext, Stats, | ||
logical_transaction::LogicalTransaction, router::Error as RouterError, Buffer, Command, | ||
Comms, PreparedStatements, Router, RouterContext, Stats, | ||
}, | ||
net::Parameters, | ||
state::State, | ||
|
@@ -29,8 +29,6 @@ pub struct Inner { | |
pub(super) router: Router, | ||
/// Client stats. | ||
pub(super) stats: Stats, | ||
/// Start transaction statement, intercepted by the router. | ||
pub(super) start_transaction: Option<BufferedQuery>, | ||
/// Client-wide comms. | ||
pub(super) comms: Comms, | ||
} | ||
|
@@ -47,7 +45,6 @@ impl Inner { | |
backend, | ||
router, | ||
stats: Stats::new(), | ||
start_transaction: None, | ||
comms: client.comms.clone(), | ||
}) | ||
} | ||
|
@@ -58,7 +55,7 @@ impl Inner { | |
buffer: &mut Buffer, | ||
prepared_statements: &mut PreparedStatements, | ||
params: &Parameters, | ||
in_transaction: bool, | ||
logical_transaction: &LogicalTransaction, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the root change, followed the compiler from here basically. |
||
) -> Result<Option<&Command>, RouterError> { | ||
let command = self | ||
.backend | ||
|
@@ -67,11 +64,11 @@ impl Inner { | |
.map(|cluster| { | ||
// Build router context. | ||
let context = RouterContext::new( | ||
buffer, // Query and parameters. | ||
cluster, // Cluster configuration. | ||
prepared_statements, // Prepared statements. | ||
params, // Client connection parameters. | ||
in_transaction, // Client in explcitely started transaction. | ||
buffer, // Query and parameters. | ||
cluster, // Cluster configuration. | ||
prepared_statements, // Prepared statements. | ||
params, // Client connection parameters. | ||
logical_transaction.in_transaction(), // Client in explcitely started transaction. | ||
)?; | ||
self.router.query(context) | ||
}) | ||
|
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.
docker-compose
is deprecated.docker compose
has replaced it.docker-compose
does not work on my recent version ofdocker
desktop.docker compose
works on the version of docker in our CI.win-win?
I suppose it will work for a every engineer's machine too. Can rollback this change if that is not the case