mirror of
https://github.com/boostorg/mysql.git
synced 2025-05-12 14:11:41 +00:00
Simplified locking in sha256 tests by using GET_LOCK
This commit is contained in:
parent
bef74828a9
commit
91cd262c68
@ -27,10 +27,4 @@ ALTER USER 'csha2p_empty_password_user'@'%' IDENTIFIED BY '';
|
||||
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'csha2p_empty_password_user'@'%';
|
||||
|
||||
|
||||
-- caching_sha2_password behaves differently on sha256 cache hit and miss.
|
||||
-- These tests require exclusive access to the cache, and lock this table
|
||||
-- to avoid race conditions (e.g. between concurrent b2 runs)
|
||||
DROP TABLE IF EXISTS sha256_mutex;
|
||||
CREATE TABLE sha256_mutex (dummy INT);
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
FLUSH PRIVILEGES;
|
||||
|
@ -165,8 +165,8 @@ BOOST_FIXTURE_TEST_CASE(tcp_connection_, tcp_connection_fixture)
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END() // mysql_native_password
|
||||
|
||||
// caching_sha2_password. We acquire a lock on the sha256_mutex
|
||||
// (dummy table, used as a mutex) to avoid race conditions with other test runs
|
||||
// caching_sha2_password. We acquire a named lock
|
||||
// to avoid race conditions with other test runs
|
||||
// (which happens in b2 builds).
|
||||
// The sha256 cache is shared between all clients.
|
||||
struct caching_sha2_lock : any_connection_fixture
|
||||
@ -177,9 +177,9 @@ struct caching_sha2_lock : any_connection_fixture
|
||||
conn.async_connect(connect_params_builder().credentials("root", "").build(), as_netresult)
|
||||
.validate_no_error();
|
||||
|
||||
// Acquire the lock
|
||||
// Acquire the lock. -1 = no timeout
|
||||
results r;
|
||||
conn.async_execute("LOCK TABLE sha256_mutex WRITE", r, as_netresult).validate_no_error();
|
||||
conn.async_execute("DO GET_LOCK('sha256_cache', -1)", r, as_netresult).validate_no_error();
|
||||
|
||||
// The lock is released on fixture destruction, when the connection is closed
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user