Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions pgdog/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub mod replication;
pub mod schema;
pub mod server;
pub mod server_options;
pub mod server_state;
pub mod stats;

pub use connect_reason::ConnectReason;
Expand Down
12 changes: 12 additions & 0 deletions pgdog/src/backend/prepared_statements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ impl PreparedStatements {
self.state.add_ignore('1');
Ok(())
}
ProtocolMessage::Sync(_) => {
self.state.add_ignore('Z');
Ok(())
}
ProtocolMessage::Close(_) => {
self.state.add_ignore('3');
Ok(())
}
ProtocolMessage::Bind(_) => {
self.state.add_ignore('2');
Ok(())
}
_ => Err(Error::UnsupportedHandleIgnore(request.code())),
}
}
Expand Down
9 changes: 9 additions & 0 deletions pgdog/src/backend/protocol/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ impl ProtocolState {
self.simulated.push_back(message);
}

/// Clear the state queue. Can be used for when a
/// statement fails and we have to retry it:
/// 1. Clear the state queue
/// 2. Fix up the statement (eg deallocate + reprepare)
/// 3. Run the statement again, building up the state again
pub(crate) fn clear(&mut self) {
self.queue.clear();
}

/// Get a simulated message from the execution queue.
///
/// Returns a message only if it should be returned at the current state
Expand Down
Loading