mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-23 01:16:30 +00:00
First try with role reset (#427)
* First try with role rest * update * extra line * Update src/server.rs Co-authored-by: Lev Kokotov <levkk@users.noreply.github.com> * Update tests/ruby/misc_spec.rb Co-authored-by: Lev Kokotov <levkk@users.noreply.github.com> --------- Co-authored-by: Lev Kokotov <levkk@users.noreply.github.com>
This commit is contained in:
@@ -963,6 +963,7 @@ impl Server {
|
||||
if self.needs_cleanup {
|
||||
warn!("Server returned with session state altered, discarding state");
|
||||
self.query("DISCARD ALL").await?;
|
||||
self.query("RESET ROLE").await?;
|
||||
self.needs_cleanup = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -241,6 +241,18 @@ describe "Miscellaneous" do
|
||||
|
||||
expect(processes.primary.count_query("DISCARD ALL")).to eq(10)
|
||||
end
|
||||
|
||||
it "Resets server roles correctly" do
|
||||
10.times do
|
||||
conn = PG::connect(processes.pgcat.connection_string("sharded_db", "sharding_user"))
|
||||
conn.async_exec("SET SERVER ROLE to 'primary'")
|
||||
conn.async_exec("SELECT 1")
|
||||
conn.async_exec("SET statement_timeout to 5000")
|
||||
conn.close
|
||||
end
|
||||
|
||||
expect(processes.primary.count_query("RESET ROLE")).to eq(10)
|
||||
end
|
||||
end
|
||||
|
||||
context "transaction mode" do
|
||||
|
||||
Reference in New Issue
Block a user