Skip to content

Commit

Permalink
Sync with upstream (postgresml#35)
Browse files Browse the repository at this point in the history
Picks up upstream fix
Graceful shutdown and refactor (postgresml#144)
  • Loading branch information
drdrsh authored Aug 25, 2022
1 parent 58841f0 commit e42d3a4
Show file tree
Hide file tree
Showing 11 changed files with 690 additions and 395 deletions.
9 changes: 6 additions & 3 deletions .circleci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ PGPASSWORD=sharding_user pgbench -h 127.0.0.1 -U sharding_user shard1 -i
PGPASSWORD=sharding_user pgbench -h 127.0.0.1 -U sharding_user shard2 -i

# Install Toxiproxy to simulate a downed/slow database
wget -O toxiproxy-2.1.4.deb https://github.com/Shopify/toxiproxy/releases/download/v2.1.4/toxiproxy_2.1.4_amd64.deb
sudo dpkg -i toxiproxy-2.1.4.deb
wget -O toxiproxy-2.4.0.deb https://github.com/Shopify/toxiproxy/releases/download/v2.4.0/toxiproxy_2.4.0_linux_$(dpkg --print-architecture).deb
sudo dpkg -i toxiproxy-2.4.0.deb

# Start Toxiproxy
toxiproxy-server &
Expand Down Expand Up @@ -129,11 +129,14 @@ toxiproxy-cli toxic remove --toxicName latency_downstream postgres_replica
start_pgcat "info"

# Test session mode (and config reload)
sed -i 's/pool_mode = "transaction"/pool_mode = "session"/' .circleci/pgcat.toml
sed -i '0,/simple_db/s/pool_mode = "transaction"/pool_mode = "session"/' .circleci/pgcat.toml

# Reload config test
kill -SIGHUP $(pgrep pgcat)

# Revert settings after reload. Makes test runs idempotent
sed -i '0,/simple_db/s/pool_mode = "session"/pool_mode = "transaction"/' .circleci/pgcat.toml

sleep 1

# Prepared statements that will only work in session mode
Expand Down
4 changes: 2 additions & 2 deletions src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ where
for (_, pool) in get_all_pools() {
let pool_config = pool.settings.clone();
for shard in 0..pool.shards() {
let database_name = &pool_config.shards[&shard.to_string()].database;
let database_name = &pool.address(shard, 0).database;
for server in 0..pool.servers(shard) {
let address = pool.address(shard, server);
let pool_state = pool.pool_state(shard, server);
let banned = pool.is_banned(address, shard, Some(address.role));
let banned = pool.is_banned(address, Some(address.role));

res.put(data_row(&vec![
address.name(), // name
Expand Down
Loading

0 comments on commit e42d3a4

Please sign in to comment.