mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-01 13:45:53 +00:00
Scylla has a long-standing bug (issue #7620) where having many tombstones in the schema table significantly slows down further schema operations. Many cql-pytest tests use new_test_table() to create a temporary test table with a specific schema. Before this patch, each temporary table was created with a random name, and deleted after the test. When running many tests on the same Scylla server, this results in a lot of tombstones in the schema tables, and really slow schema operations. For example, look at home much time it takes to run the same test file N times: $ test/cql-pytest/run --count N test_filtering.py N=25 - 16 seconds (total time for the N repetitions) N=50 - 41 seconds N=100 - 122 seconds Notice how progressively slower each repetition is becoming - the total test time should have been linear in N, but it isn't! In this patch, we keep a cache of already-deleted table names (not the tables, just their names!) so as to reuse the same name when we can instead of inventing a new random name. With this patch, the performance improvement after some repetitions is amazing (compare to the table above): N=25 - 14 seconds N=50 - 29 seconds N=100 - 46 seconds Note how the testing time is now more-or-less linear in the number of repetitions, as expected. The table-name recycling trick is the same trick I already used in the past for the translated Cassandra tests (test/cql-pytest/cassandra_tests). The problem was even more obvious there because those tests create a lot of different tables. But the same problem also exists in cql-pytest in general, so let's solve it here too. Refs #7620 Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #10635