mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
fix order of destruction of table locks and child streams
Incorrect order could lead to a very rare `mutex lock failed: Invalid argument` error when MergeTree table was dropped and its parts were deleted defore the destruction of streams that were reading from that parts.
This commit is contained in:
parent
6e852288ff
commit
bc30ed92d4
@ -242,6 +242,10 @@ public:
|
|||||||
void enableExtremes() { enabled_extremes = true; }
|
void enableExtremes() { enabled_extremes = true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/// Order is important: `table_locks` must be destroyed after `children` so that tables from
|
||||||
|
/// which child streams read are protected by the locks during the lifetime of the child streams.
|
||||||
|
TableStructureReadLocks table_locks;
|
||||||
|
|
||||||
BlockInputStreams children;
|
BlockInputStreams children;
|
||||||
std::shared_mutex children_mutex;
|
std::shared_mutex children_mutex;
|
||||||
|
|
||||||
@ -268,8 +272,6 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TableStructureReadLocks table_locks;
|
|
||||||
|
|
||||||
bool enabled_extremes = false;
|
bool enabled_extremes = false;
|
||||||
|
|
||||||
/// The limit on the number of rows/bytes has been exceeded, and you need to stop execution on the next `read` call, as if the thread has run out.
|
/// The limit on the number of rows/bytes has been exceeded, and you need to stop execution on the next `read` call, as if the thread has run out.
|
||||||
|
Loading…
Reference in New Issue
Block a user