未验证 提交 08ed7473 编写于 作者: A alexey-milovidov 提交者: GitHub

Merge pull request #14320 from bharatnc/ncb/fix-alter-live-lock

 fix ALTER LIVE VIEW  [REFRESH] lock issue 
......@@ -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,
......
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册