mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-25 02:50:33 +00:00
test_scylla_sstable_shard_of takes lots of time preparing the keys for a
certain shard. with the debug build, it takes 3 minutes to complete the
test.
so in order to test the "shard-of" subcommand in an more efficient way,
in this change, we improve the test in two ways:
1. cache the output of 'scylla types shardof`. so we can avoid the
overhead of running a seastar application repeatly for the
same keys.
2. reduce the number of partitions from 42 to 1. as the number of
partitions in an sstable does not matter when testing the
output of "shard-of" command of a certain sstable. because,
the sstable is always generated by a certain shard.
before this change, with pytest-profiling:
```
ncalls tottime percall cumtime percall filename:lineno(function)
4/3 0.000 0.000 181.950 60.650 runner.py:219(call_and_report)
4/3 0.000 0.000 181.948 60.649 runner.py:247(call_runtest_hook)
4/3 0.000 0.000 181.948 60.649 runner.py:318(from_call)
4/3 0.000 0.000 181.948 60.649 runner.py:262(<lambda>)
44/11 0.000 0.000 181.935 16.540 _hooks.py:427(__call__)
43/11 0.000 0.000 181.935 16.540 _manager.py:103(_hookexec)
43/11 0.000 0.000 181.935 16.540 _callers.py:30(_multicall)
361 0.001 0.000 181.531 0.503 contextlib.py:141(__exit__)
782/81 0.001 0.000 177.578 2.192 {built-in method builtins.next}
1044 0.006 0.000 92.452 0.089 base_events.py:1894(_run_once)
11 0.000 0.000 91.129 8.284 fixtures.py:686(<lambda>)
17/11 0.000 0.000 91.129 8.284 fixtures.py:1025(finish)
4 0.000 0.000 91.128 22.782 fixtures.py:913(_teardown_yield_fixture)
2/1 0.000 0.000 91.055 91.055 runner.py:111(pytest_runtest_protocol)
2/1 0.000 0.000 91.055 91.055 runner.py:119(runtestprotocol)
2 0.000 0.000 91.052 45.526 conftest.py:50(cql)
2 0.000 0.000 91.040 45.520 util.py:161(cql_session)
1 0.000 0.000 91.040 91.040 runner.py:180(pytest_runtest_teardown)
1 0.000 0.000 91.040 91.040 runner.py:509(teardown_exact)
1945 0.002 0.000 90.722 0.047 events.py:82(_run)
```
after this change:
```
ncalls tottime percall cumtime percall filename:lineno(function)
4/3 0.000 0.000 8.271 2.757 runner.py:219(call_and_report)
44/11 0.000 0.000 8.270 0.752 _hooks.py:427(__call__)
44/11 0.000 0.000 8.270 0.752 _manager.py:103(_hookexec)
44/11 0.000 0.000 8.270 0.752 _callers.py:30(_multicall)
4/3 0.000 0.000 8.269 2.756 runner.py:247(call_runtest_hook)
4/3 0.000 0.000 8.269 2.756 runner.py:318(from_call)
4/3 0.000 0.000 8.269 2.756 runner.py:262(<lambda>)
48 0.000 0.000 8.269 0.172 {method 'send' of 'generator' objects}
27 0.000 0.000 5.671 0.210 contextlib.py:141(__exit__)
11 0.000 0.000 4.297 0.391 fixtures.py:686(<lambda>)
2/1 0.000 0.000 4.228 4.228 runner.py:111(pytest_runtest_protocol)
2/1 0.000 0.000 4.228 4.228 runner.py:119(runtestprotocol)
2 0.000 0.000 4.213 2.106 capture.py:877(pytest_runtest_teardown)
1 0.000 0.000 4.213 4.213 runner.py:180(pytest_runtest_teardown)
1 0.000 0.000 4.213 4.213 runner.py:509(teardown_exact)
2 0.000 0.000 3.628 1.814 capture.py:872(pytest_runtest_call)
1 0.000 0.000 3.627 3.627 runner.py:160(pytest_runtest_call)
1 0.000 0.000 3.627 3.627 python.py:1797(runtest)
114/81 0.001 0.000 3.505 0.043 {built-in method builtins.next}
15 0.784 0.052 3.183 0.212 subprocess.py:417(check_output)
```
Fixes #16516
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
Closes scylladb/scylladb#16523
(cherry picked from commit 642652efab)