Task manager's tasks stay in memory after they are finished. Moreover, even if a child task is unregistered from task manager, it is still alive since its parent keeps a foreign pointer to it. Also, when a task has finished successfully there is no point in keeping all of its descendants in memory. The patch introduces folding of task manager's tasks. Whenever a task which has a parent is finished it is unregistered from task manager and foreign_ptr to it (kept in its parent) is replaced with its status. Children's statuses of the task are dropped unless they or one of their descendants failed. So for each operation we keep a tree of tasks which contains: - a root task and its direct children (status if they are finished, a task otherwise); - running tasks and their direct children (same as above); - a statuses path from root to failed tasks. /task_manager/wait_task/ does not unregister tasks anymore. Refs: #16694. - [ ] ** Backport reason (please explain below if this patch should be backported or not) ** Requires backport to 6.0 as task number exploded with tablets. Closes scylladb/scylladb#18735 * github.com:scylladb/scylladb: docs: describe task folding test: rest_api: add test for task tree structure test: rest_api: modify new_test_module tasks: test: modify test_task methods api: task_manager: do not unregister task in /task_manager/wait_task/ tasks: unregister tasks with parents when they are finished tasks: fold finished tasks info their parents tasks: make task_manager::task::impl::finish_failed noexcept tasks: change _children type
Tests for the Scylla REST API.
Tests use the requests library and the pytest frameworks (both are available from Linux distributions, or with "pip install").
To run all tests using test.py, just run ./test.py api/run.
To run all tests against an already-running local installation of Scylla,
just run pytest. The "--host" and "--api-port"
can be used to give a different location for the running Scylla.
More conveniently, we have a script - "run" - which does all the work necessary to start Scylla, and run the tests on it. The Scylla process is run in a temporary directory which is automatically deleted when the test ends.
"run" automatically picks the most recently compiled version of Scylla in
build/*/scylla - but this choice of Scylla executable can be overridden with
the SCYLLA environment variable.
Additional options can be passed to "pytest" or to "run" to control which tests to run:
- To run all tests in a single file, do
pytest test_system.py. - To run a single specific test, do
pytest test_system.py::test_system_uptime_ms. - To run the same test or tests 100 times, add the
--count=100option. This is faster than runningrun100 times, because Scylla is only run once, and also counts for you how many of the runs failed. Forpytestto support the--countoption, you need to install a pytest extension:pip install pytest-repeat
Additional useful pytest options, especially useful for debugging tests:
- -v: show the names of each individual test running instead of just dots.
- -s: show the full output of running tests (by default, pytest captures the test's output and only displays it if a test fails)