Currently, the tri-compare operator for big_decimal (operator <=>), uses a precise but potentially very expensive algorithm for comparing the numbers: it first brings them to the same scale, then compares the normalized unscaled values. big_decimal has abritrary precisions, therefore the stored numbers can be arbitrarily large. In extreme cases, comparing two numbers can result in huge amount of memory allocated and stalls. If this type is used int he primary key of a table, these comparisons can make the node completely unresponsive. This patch adds the following fast-paths to operator <=>: * An early return for the case of equal scales. * An early return for different signs. * An early return for the case where one or both of the numbers are 0. * A fast algorithm for detecting the case where the there is a big difference between the two numbers. This algorithm works only with the scales and is able to compare the two numbers by using only one division and some additions and substractions. This algorithm is imprecise and when the numbers are closer than its confidence window, it will fall-back to the current slow but precise tri-compare. All but the last case should have been fast before as well, but the scale-compare algorithm makes a huge difference. Numbers, which would previously make the node unresponsive, now compare in constant-time. Fixes: scylladb/scylladb#21716 Closes scylladb/scylladb#21715
Scylla in-source tests.
For details on how to run the tests, see docs/dev/testing.md
Shared C++ utils, libraries are in lib/, for Python - pylib/
alternator - Python tests which connect to a single server and use the DynamoDB API unit, boost, raft - unit tests in C++ cqlpy - Python tests which connect to a single server and use CQL topology* - tests that set up clusters and add/remove nodes cql - approval tests that use CQL and pre-recorded output rest_api - tests for Scylla REST API Port 9000 scylla-gdb - tests for scylla-gdb.py helper script nodetool - tests for C++ implementation of nodetool
If you can use an existing folder, consider adding your test to it. New folders should be used for new large categories/subsystems, or when the test environment is significantly different from some existing suite, e.g. you plan to start scylladb with different configuration, and you intend to add many tests and would like them to reuse an existing Scylla cluster (clusters can be reused for tests within the same folder).
To add a new folder, create a new directory, and then
copy & edit its suite.ini.