v.21.11Improvements

Fix lock-order inversion between DROP TABLE for DatabaseMemory and LiveView

Fix lock-order-inversion between DROP TABLE for DatabaseMemory and LiveView. Live View is an experimental feature. Memory database is used in clickhouse-local. #29929 (Azat Khuzhin).
Fixes a lock-order inversion issue between DROP TABLE operations for DatabaseMemory and LiveView.

Why it matters

This fix resolves a concurrency problem that could cause deadlocks when dropping tables in the experimental Live View feature and in DatabaseMemory, which is used by clickhouse-local. The improvement ensures more stable behavior during table drop operations.

How to use it

Users do not need to take any specific action to enable this fix. It is applied internally to prevent deadlocks when using DROP TABLE with LiveView or DatabaseMemory.