From f805b43a0832967340a06254d23cba9a3dda8cd6 Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Mon, 21 Feb 2022 00:16:33 -0800 Subject: [PATCH] test session mode and config reload for real (#33) * test session mode and config reload for real * period * run them at the end * typo * wrong dir --- .circleci/run_tests.sh | 13 ++++++++++--- README.md | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.circleci/run_tests.sh b/.circleci/run_tests.sh index 9ba0686..2204b24 100644 --- a/.circleci/run_tests.sh +++ b/.circleci/run_tests.sh @@ -34,9 +34,6 @@ psql -e -h 127.0.0.1 -p 6432 -f tests/sharding/query_routing_test_select.sql > / # Replica/primary selection & more sharding tests psql -e -h 127.0.0.1 -p 6432 -f tests/sharding/query_routing_test_primary_replica.sql > /dev/null -# Test reload config -kill -SIGHUP $(pgrep pgcat) - # # ActiveRecord tests! # @@ -45,6 +42,16 @@ sudo gem install bundler bundle install ruby tests.rb +cd ../../ +# Test session mode (and config reload) +sed -i 's/pool_mode = "transaction"/pool_mode = "session"/' pgcat.toml + +# Reload config +kill -SIGHUP $(pgrep pgcat) + +# Prepared statements that will only work in session mode +pgbench -h 127.0.0.1 -p 6432 -t 500 -c 2 --protocol prepared + # Attempt clean shut down killall pgcat -s SIGINT diff --git a/README.md b/README.md index cf955eb..3801473 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ See [sharding README](./tests/sharding/README.md) for sharding logic testing. | **Feature** | **Tested in CI** | **Tested manually** | **Comments** | |-----------------------|--------------------|---------------------|--------------------------------------------------------------------------------------------------------------------------| | Transaction pooling | :heavy_check_mark: | :heavy_check_mark: | Used by default for all tests. | -| Session pooling | :x: | :heavy_check_mark: | Easiest way to test is to enable it and run pgbench - results will be better than transaction pooling as expected. | +| Session pooling | :heavy_check_mark: | :heavy_check_mark: | Tested by running pgbench with `--protocol prepared` which only works in session mode. | | `COPY` | :heavy_check_mark: | :heavy_check_mark: | `pgbench -i` uses `COPY`. `COPY FROM` is tested as well. | | Query cancellation | :heavy_check_mark: | :heavy_check_mark: | `psql -c 'SELECT pg_sleep(1000);'` and press `Ctrl-C`. | | Load balancing | :x: | :heavy_check_mark: | We could test this by emitting statistics for each replica and compare them. |