mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
StorageLog: avoid UB for rwlock unlock due to unlock from another thread
This commit is contained in:
parent
5d795661ed
commit
89a96cf14d
@ -357,6 +357,11 @@ void LogBlockOutputStream::writeSuffix()
|
|||||||
|
|
||||||
streams.clear();
|
streams.clear();
|
||||||
done = true;
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
5
tests/queries/0_stateless/01796_Log_rwlock_ub.sql
Normal file
5
tests/queries/0_stateless/01796_Log_rwlock_ub.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
DROP TABLE IF EXISTS underlying_01796;
|
||||||
|
CREATE TABLE underlying_01796 (key UInt64) Engine=Log();
|
||||||
|
INSERT INTO FUNCTION remote('127.1', currentDatabase(), underlying_01796) SELECT toUInt64(number) FROM system.numbers LIMIT 1;
|
||||||
|
SELECT * FROM underlying_01796 FORMAT Null;
|
||||||
|
DROP TABLE underlying_01796;
|
Loading…
Reference in New Issue
Block a user