mirror of
https://github.com/neondatabase/neon.git
synced 2026-08-18 03:58:19 +00:00
8142edda01
Solves a flaky test error in the wild[^1] by: - Make the gc shutdown signal reading an `allowed_error` - Note the gc shutdown signal readings as being in `allowed_error`s - Allow passing tenant conf to init_start to avoid unncessary tenants [^1]: https://neon-github-public-dev.s3.amazonaws.com/reports/pr-4399/5176432780/index.html#suites/b97efae3a617afb71cb8142f5afa5224/2cd76021ea011f93
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
# This test spawns pgbench in a thread in the background and concurrently restarts pageserver,
|
|
# checking how client is able to transparently restore connection to pageserver
|
|
#
|
|
import threading
|
|
import time
|
|
|
|
from fixtures.log_helper import log
|
|
from fixtures.neon_fixtures import NeonEnv, PgBin
|
|
|
|
|
|
# Test restarting page server, while safekeeper and compute node keep
|
|
# running.
|
|
def test_pageserver_restarts_under_worload(neon_simple_env: NeonEnv, pg_bin: PgBin):
|
|
env = neon_simple_env
|
|
env.neon_cli.create_branch("test_pageserver_restarts")
|
|
endpoint = env.endpoints.create_start("test_pageserver_restarts")
|
|
n_restarts = 10
|
|
scale = 10
|
|
|
|
def run_pgbench(connstr: str):
|
|
log.info(f"Start a pgbench workload on pg {connstr}")
|
|
pg_bin.run_capture(["pgbench", "-i", f"-s{scale}", connstr])
|
|
pg_bin.run_capture(["pgbench", f"-T{n_restarts}", connstr])
|
|
|
|
thread = threading.Thread(target=run_pgbench, args=(endpoint.connstr(),), daemon=True)
|
|
thread.start()
|
|
|
|
for i in range(n_restarts):
|
|
# Stop the pageserver gracefully and restart it.
|
|
time.sleep(1)
|
|
env.pageserver.stop()
|
|
env.pageserver.start()
|
|
|
|
thread.join()
|