Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
140cd88c
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
140cd88c
编写于
4月 09, 2020
作者:
A
Alexander Tokmakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes
上级
dd159083
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
35 addition
and
7 deletion
+35
-7
src/Interpreters/Context.cpp
src/Interpreters/Context.cpp
+1
-1
src/Interpreters/DatabaseCatalog.cpp
src/Interpreters/DatabaseCatalog.cpp
+21
-3
src/Interpreters/DatabaseCatalog.h
src/Interpreters/DatabaseCatalog.h
+4
-2
src/Storages/StorageReplicatedMergeTree.cpp
src/Storages/StorageReplicatedMergeTree.cpp
+5
-0
src/Storages/StorageReplicatedMergeTree.h
src/Storages/StorageReplicatedMergeTree.h
+2
-0
tests/queries/0_stateless/01213_alter_rename_primary_key_zookeeper.sql
.../0_stateless/01213_alter_rename_primary_key_zookeeper.sql
+2
-1
未找到文件。
src/Interpreters/Context.cpp
浏览文件 @
140cd88c
...
...
@@ -404,7 +404,7 @@ struct ContextShared
if
(
system_logs
)
system_logs
->
shutdown
();
DatabaseCatalog
::
instance
().
shutdown
();
DatabaseCatalog
::
shutdown
();
/// Preemptive destruction is important, because these objects may have a refcount to ContextShared (cyclic reference).
/// TODO: Get rid of this.
...
...
src/Interpreters/DatabaseCatalog.cpp
浏览文件 @
140cd88c
...
...
@@ -27,6 +27,7 @@ namespace ErrorCodes
extern
const
int
DATABASE_NOT_EMPTY
;
extern
const
int
DATABASE_ACCESS_DENIED
;
extern
const
int
LOGICAL_ERROR
;
extern
const
int
NULL_POINTER_DEREFERENCE
;
}
TemporaryTableHolder
::
TemporaryTableHolder
(
const
Context
&
context_
,
...
...
@@ -107,6 +108,7 @@ StoragePtr TemporaryTableHolder::getTable() const
void
DatabaseCatalog
::
loadDatabases
()
{
drop_delay_s
=
global_context
->
getConfigRef
().
getInt
(
"database_atomic_delay_before_drop_table_s"
,
60
);
auto
db_for_temporary_and_external_tables
=
std
::
make_shared
<
DatabaseMemory
>
(
TEMPORARY_DATABASE
);
attachDatabase
(
TEMPORARY_DATABASE
,
db_for_temporary_and_external_tables
);
...
...
@@ -117,7 +119,7 @@ void DatabaseCatalog::loadDatabases()
(
*
drop_task
)
->
activateAndSchedule
();
}
void
DatabaseCatalog
::
shutdown
()
void
DatabaseCatalog
::
shutdown
Impl
()
{
if
(
drop_task
)
(
*
drop_task
)
->
deactivate
();
...
...
@@ -378,8 +380,7 @@ DatabaseCatalog::DatabaseCatalog(Context * global_context_)
:
global_context
(
global_context_
),
log
(
&
Poco
::
Logger
::
get
(
"DatabaseCatalog"
))
{
if
(
!
global_context
)
throw
Exception
(
"DatabaseCatalog is not initialized. It's a bug."
,
ErrorCodes
::
LOGICAL_ERROR
);
drop_delay_s
=
global_context
->
getConfigRef
().
getInt
(
"database_atomic_delay_before_drop_table_s"
,
60
);
throw
Exception
(
"DatabaseCatalog is not initialized. It's a bug."
,
ErrorCodes
::
NULL_POINTER_DEREFERENCE
);
}
DatabaseCatalog
&
DatabaseCatalog
::
init
(
Context
*
global_context_
)
...
...
@@ -393,6 +394,23 @@ DatabaseCatalog & DatabaseCatalog::instance()
return
init
(
nullptr
);
}
void
DatabaseCatalog
::
shutdown
()
{
try
{
instance
().
shutdownImpl
();
}
catch
(
const
Exception
&
e
)
{
/// If catalog was not initialized yet by init(global_context), instance() throws NULL_POINTER_DEREFERENCE.
/// It can happen if some exception was thrown on first steps of startup (e.g. command line arguments parsing).
/// Ignore it.
if
(
e
.
code
()
==
ErrorCodes
::
NULL_POINTER_DEREFERENCE
)
return
;
throw
;
}
}
DatabasePtr
DatabaseCatalog
::
getDatabase
(
const
String
&
database_name
,
const
Context
&
local_context
)
const
{
String
resolved_database
=
local_context
.
resolveDatabase
(
database_name
);
...
...
src/Interpreters/DatabaseCatalog.h
浏览文件 @
140cd88c
...
...
@@ -102,9 +102,9 @@ public:
static
DatabaseCatalog
&
init
(
Context
*
global_context_
);
static
DatabaseCatalog
&
instance
();
static
void
shutdown
();
void
loadDatabases
();
void
shutdown
();
/// Get an object that protects the table from concurrently executing multiple DDL operations.
std
::
unique_ptr
<
DDLGuard
>
getDDLGuard
(
const
String
&
database
,
const
String
&
table
);
...
...
@@ -166,6 +166,8 @@ private:
void
assertDatabaseExistsUnlocked
(
const
String
&
database_name
)
const
;
void
assertDatabaseDoesntExistUnlocked
(
const
String
&
database_name
)
const
;
void
shutdownImpl
();
struct
UUIDToStorageMapPart
{
...
...
@@ -222,7 +224,7 @@ private:
mutable
std
::
mutex
tables_marked_dropped_mutex
;
std
::
unique_ptr
<
BackgroundSchedulePoolTaskHolder
>
drop_task
;
time_t
drop_delay_s
;
time_t
drop_delay_s
=
60
;
};
}
src/Storages/StorageReplicatedMergeTree.cpp
浏览文件 @
140cd88c
...
...
@@ -2880,11 +2880,15 @@ void StorageReplicatedMergeTree::startup()
move_parts_task_handle
=
pool
.
createTask
([
this
]
{
return
movePartsTask
();
});
pool
.
startTask
(
move_parts_task_handle
);
}
need_shutdown
.
store
(
true
);
}
void
StorageReplicatedMergeTree
::
shutdown
()
{
if
(
!
need_shutdown
.
load
())
return
;
clearOldPartsFromFilesystem
(
true
);
/// Cancel fetches, merges and mutations to force the queue_task to finish ASAP.
fetcher
.
blocker
.
cancelForever
();
...
...
@@ -2917,6 +2921,7 @@ void StorageReplicatedMergeTree::shutdown()
std
::
unique_lock
lock
(
data_parts_exchange_endpoint
->
rwlock
);
}
data_parts_exchange_endpoint
.
reset
();
need_shutdown
.
store
(
false
);
}
...
...
src/Storages/StorageReplicatedMergeTree.h
浏览文件 @
140cd88c
...
...
@@ -288,6 +288,8 @@ private:
/// True if replica was created for existing table with fixed granularity
bool
other_replicas_fixed_granularity
=
false
;
std
::
atomic_bool
need_shutdown
{
false
};
template
<
class
Func
>
void
foreachCommittedParts
(
const
Func
&
func
)
const
;
...
...
tests/queries/0_stateless/01213_alter_rename_primary_key_zookeeper.sql
浏览文件 @
140cd88c
...
...
@@ -23,7 +23,8 @@ ALTER TABLE table_for_rename_pk RENAME COLUMN key3 TO renamed_key3; --{serverErr
ALTER
TABLE
table_for_rename_pk
RENAME
COLUMN
key2
TO
renamed_key2
;
--{serverError 44}
DROP
TABLE
IF
EXISTS
table_for_rename_pk
;
DROP
TABLE
IF
EXISTS
table_for_rename_pk
NO
DELAY
;
SELECT
sleep
(
1
)
FORMAT
Null
;
DROP
TABLE
IF
EXISTS
table_for_rename_with_primary_key
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录