https://github.com/chobostar/pgbouncer-cancel-request
Demo how cancel requests can disable your Pgbouncer
https://github.com/chobostar/pgbouncer-cancel-request
Last synced: about 2 months ago
JSON representation
Demo how cancel requests can disable your Pgbouncer
- Host: GitHub
- URL: https://github.com/chobostar/pgbouncer-cancel-request
- Owner: chobostar
- Created: 2020-04-05T14:48:51.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-27T16:53:32.000Z (almost 5 years ago)
- Last Synced: 2025-03-04T19:42:16.419Z (about 2 months ago)
- Language: Dockerfile
- Size: 124 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Cancel requests outage pgbouncer
================================Usage:
```
$ go get github.com/chobostar/pgbouncer-cancel-request
$ cd ~/go/src/github.com/chobostar/pgbouncer-cancel-request
$ docker-compose up -d
$ make run_pgbouncer
```Check `used_clients`:
```
$ psql -h localhost -p 6432 -U pgbouncer -c "show lists" | grep 'used_clients'
```Ensure that connections are not available:
```
$ psql -h localhost -p 6432 -U postgres -d db
psql: ERROR: no more connections allowed (max_client_conn)
```#### Odyssey
```
$ make run_odyssey
```and it's okay
## Check stats output diffs
```
$ make test_stats
```## Check killed client
1. Start 3 queries:
- first:
```
$ PGAPPNAME=pgbouncer psql -U postgres -p 6432 -h localhost -d db -c "select pg_sleep(3600)"
```
- second:
```
$ PGAPPNAME=odyssey psql -U postgres -p 6532 -h localhost -d db -c "select pg_sleep(3600)"
```
- third:
```
$ PGAPPNAME=psql psql -U postgres -p 5432 -h localhost -d postgres -c "select pg_sleep(3600)"
```2. Kill both
```
$ kill $(ps aux | grep '[p]sql' | awk '{print $2}')
```3. Check active backends:
```
$ psql -U postgres -h localhost -c "select application_name from pg_stat_activity where state != 'idle' and pid != pg_backend_pid()"application_name
------------------
pgbouncer
psql
(2 rows)
```