From 7aba299dbdf946f4bdb9c1b3b1b8fd11c0f30490 Mon Sep 17 00:00:00 2001 From: anastasia Date: Tue, 11 Jan 2022 17:16:25 +0300 Subject: [PATCH] Use safekeeper in test_branch_behind (#1068) to avoid a subtle race condition. Without safekeeper, walreceiver reconnection can stuck, because of IO deadlock between walsender auth and regular backend. --- test_runner/batch_others/test_branch_behind.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test_runner/batch_others/test_branch_behind.py b/test_runner/batch_others/test_branch_behind.py index 1165952a93..333d685d15 100644 --- a/test_runner/batch_others/test_branch_behind.py +++ b/test_runner/batch_others/test_branch_behind.py @@ -5,7 +5,7 @@ import psycopg2.extras import pytest from fixtures.log_helper import log from fixtures.utils import print_gc_result -from fixtures.zenith_fixtures import ZenithEnv +from fixtures.zenith_fixtures import ZenithEnvBuilder pytest_plugins = ("fixtures.zenith_fixtures") @@ -13,10 +13,18 @@ pytest_plugins = ("fixtures.zenith_fixtures") # # Create a couple of branches off the main branch, at a historical point in time. # -def test_branch_behind(zenith_simple_env: ZenithEnv): - env = zenith_simple_env +def test_branch_behind(zenith_env_builder: ZenithEnvBuilder): + + # Use safekeeper in this test to avoid a subtle race condition. + # Without safekeeper, walreceiver reconnection can stuck + # because of IO deadlock. + # + # See https://github.com/zenithdb/zenith/issues/1068 + zenith_env_builder.num_safekeepers = 1 + env = zenith_env_builder.init() + # Branch at the point where only 100 rows were inserted - env.zenith_cli(["branch", "test_branch_behind", "empty"]) + env.zenith_cli(["branch", "test_branch_behind", "main"]) pgmain = env.postgres.create_start('test_branch_behind') log.info("postgres is running on 'test_branch_behind' branch")