StorageStripeLog: avoid UB for rwlock unlock due to unlock from another thread

This commit is contained in:
Azat Khuzhin 2021-04-04 08:24:01 +03:00
parent 89a96cf14d
commit 44abb7588a
3 changed files with 10 additions and 0 deletions

View File

@ -228,6 +228,11 @@ public:
storage.file_checker.save();
done = true;
/// unlock should be done from the same thread as lock, and dtor may be
/// called from different thread, so it should be done here (at least in
/// case of no exceptions occurred)
lock.unlock();
}
private:

View File

@ -0,0 +1,5 @@
DROP TABLE IF EXISTS underlying_01797;
CREATE TABLE underlying_01797 (key UInt64) Engine=StripeLog();
INSERT INTO FUNCTION remote('127.1', currentDatabase(), underlying_01797) SELECT toUInt64(number) FROM system.numbers LIMIT 1;
SELECT * FROM underlying_01797 FORMAT Null;
DROP TABLE underlying_01797;