Compare commits

...

19 Commits

Author SHA1 Message Date
Thang Pham
e9766fb883 test 2022-07-14 14:34:11 -04:00
Thang Pham
57cfee1d67 test 2022-07-14 14:34:10 -04:00
Thang Pham
28e2c0a542 test 2022-07-14 14:34:09 -04:00
Thang Pham
35e4aad392 test 2022-07-14 14:34:08 -04:00
Thang Pham
1877ecc175 test 2022-07-14 14:34:07 -04:00
Thang Pham
69f8812960 add thread limit for test_branching_with_pgbench 2022-07-14 14:33:59 -04:00
Thang Pham
7a0297dd76 test 2022-07-14 13:09:22 -04:00
Thang Pham
936e6869bc test 2022-07-14 13:09:21 -04:00
Thang Pham
d0635939d1 test 2022-07-14 13:09:20 -04:00
Thang Pham
0f5474e305 test 2022-07-14 13:09:19 -04:00
Thang Pham
c00177d526 test 2022-07-14 13:09:17 -04:00
Thang Pham
f7ba424481 Merge branch 'main' into fix-flaky-branch-tests 2022-07-14 13:09:13 -04:00
Thang Pham
35b7f14a34 add back test_branching_with_pgbench 2022-07-14 12:32:37 -04:00
Thang Pham
2d6ec3b8b0 skip test_branching_with_pgbench 2022-07-14 10:43:44 -04:00
Thang Pham
adcda6d4e5 run multiple test_ancestor_branch 2022-07-13 17:34:06 -04:00
Thang Pham
8eef47eeb4 only run test_ancestor_branch 2022-07-13 16:21:43 -04:00
Thang Pham
9536d17b04 remove sleep failpoints 2022-07-13 15:53:19 -04:00
Thang Pham
d28fe732c5 skip branch and gc test 2022-07-13 15:33:58 -04:00
Thang Pham
5fb2e6df50 update test_branch_and_gc test:
- add manual compaction
- reduce compaction frequency
2022-07-13 15:11:19 -04:00
3 changed files with 22 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ from fixtures.neon_fixtures import NeonEnv, NeonEnvBuilder, NeonPageserverApiExc
#
# Create ancestor branches off the main branch.
#
# @pytest.mark.parametrize("x", range(20))
def test_ancestor_branch(neon_env_builder: NeonEnvBuilder):
env = neon_env_builder.init_start()
@@ -21,7 +22,7 @@ def test_ancestor_branch(neon_env_builder: NeonEnvBuilder):
'compaction_target_size': '4194304',
})
env.pageserver.safe_psql("failpoints flush-frozen-before-sync=sleep(10000)")
# env.pageserver.safe_psql("failpoints flush-frozen-before-sync=sleep(10000)")
pg_branch0 = env.postgres.create_start('main', tenant_id=tenant)
branch0_cur = pg_branch0.connect().cursor()

View File

@@ -1,3 +1,4 @@
import pytest
from fixtures.log_helper import log
from fixtures.neon_fixtures import NeonEnv
from fixtures.utils import lsn_from_hex
@@ -40,6 +41,7 @@ from fixtures.utils import lsn_from_hex
# Because the delta layer D covering lsn1 is corrupted, creating a branch
# starting from lsn1 should return an error as follows:
# could not find data for key ... at LSN ..., for request at LSN ...
# @pytest.mark.skip("")
def test_branch_and_gc(neon_simple_env: NeonEnv):
env = neon_simple_env
@@ -56,9 +58,9 @@ def test_branch_and_gc(neon_simple_env: NeonEnv):
'compaction_target_size': f'{1024 ** 3}',
# tweak the default settings to allow quickly create image layers and L1 layers
'compaction_period': '1 s',
'compaction_period': '10 s',
'compaction_threshold': '2',
'image_creation_threshold': '1',
'image_creation_threshold': '2',
# set PITR interval to be small, so we can do GC
'pitr_interval': '1 s'
@@ -77,6 +79,9 @@ def test_branch_and_gc(neon_simple_env: NeonEnv):
lsn1 = main_cur.fetchone()[0]
log.info(f'LSN1: {lsn1}')
# trigger a manual compaction
env.pageserver.safe_psql(f'''compact {tenant.hex} {timeline_main.hex}''')
main_cur.execute('INSERT INTO foo SELECT FROM generate_series(1, 100000)')
main_cur.execute('SELECT pg_current_wal_insert_lsn()')
lsn2 = main_cur.fetchone()[0]

View File

@@ -44,7 +44,7 @@ def test_branching_with_pgbench(neon_simple_env: NeonEnv,
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', '-c10', '-T15', connstr])
pg_bin.run_capture(['pgbench', '-T15', connstr])
env.neon_cli.create_branch('b0', tenant_id=tenant)
pgs: List[Postgres] = []
@@ -54,12 +54,24 @@ def test_branching_with_pgbench(neon_simple_env: NeonEnv,
threads.append(threading.Thread(target=run_pgbench, args=(pgs[0], ), daemon=True))
threads[-1].start()
thread_limit = 4
for i in range(n_branches):
# random a delay between [0, 5]
delay = random.random() * 5
time.sleep(delay)
log.info(f"Sleep {delay}s")
# If the number of concurrent threads exceeds a threshold,
# wait for all the threads to finish before spawning a new one.
#
# Because tests defined in `batch_others` are run concurrently in CI,
# we want to avoid the situation that one test exhausts resources for other tests.
if len(threads) >= thread_limit:
for thread in threads:
thread.join()
threads = []
if ty == "cascade":
env.neon_cli.create_branch('b{}'.format(i + 1), 'b{}'.format(i), tenant_id=tenant)
else: