mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Merge pull request #14320 from bharatnc/ncb/fix-alter-live-lock
fix ALTER LIVE VIEW [REFRESH] lock issue
This commit is contained in:
commit
08ed74732e
@ -101,7 +101,7 @@ BlockIO InterpreterAlterQuery::execute()
|
||||
switch (command.type)
|
||||
{
|
||||
case LiveViewCommand::REFRESH:
|
||||
live_view->refresh(context);
|
||||
live_view->refresh();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -518,9 +518,10 @@ void StorageLiveView::drop()
|
||||
condition.notify_all();
|
||||
}
|
||||
|
||||
void StorageLiveView::refresh(const Context & context)
|
||||
void StorageLiveView::refresh()
|
||||
{
|
||||
auto table_lock = lockExclusively(context.getCurrentQueryId(), context.getSettingsRef().lock_acquire_timeout);
|
||||
// Lock is already acquired exclusively from InterperterAlterQuery.cpp InterpreterAlterQuery::execute() method.
|
||||
// So, reacquiring lock is not needed and will result in an exception.
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
if (getNewBlocks())
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
void startup() override;
|
||||
void shutdown() override;
|
||||
|
||||
void refresh(const Context & context);
|
||||
void refresh();
|
||||
|
||||
Pipe read(
|
||||
const Names & column_names,
|
||||
|
@ -0,0 +1 @@
|
||||
ALTER LIVE VIEW live1 REFRESH
|
@ -0,0 +1,10 @@
|
||||
CREATE TABLE test0 (
|
||||
c0 UInt64
|
||||
) ENGINE = MergeTree() PARTITION BY c0 ORDER BY c0;
|
||||
|
||||
SET allow_experimental_live_view=1;
|
||||
|
||||
CREATE LIVE VIEW live1 AS SELECT * FROM test0;
|
||||
|
||||
select 'ALTER LIVE VIEW live1 REFRESH';
|
||||
ALTER LIVE VIEW live1 REFRESH; -- success
|
Loading…
Reference in New Issue
Block a user