Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
96f33e92
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,发现更多精彩内容 >>
提交
96f33e92
编写于
4月 14, 2015
作者:
A
Alexey Arno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dbms: Server: Code cleanups. [#METR-15090]
上级
9bcb33c1
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
20 addition
and
32 deletion
+20
-32
dbms/include/DB/Interpreters/InterpreterOptimizeQuery.h
dbms/include/DB/Interpreters/InterpreterOptimizeQuery.h
+1
-1
dbms/include/DB/Storages/IStorage.h
dbms/include/DB/Storages/IStorage.h
+2
-8
dbms/include/DB/Storages/StorageBuffer.h
dbms/include/DB/Storages/StorageBuffer.h
+1
-2
dbms/include/DB/Storages/StorageMaterializedView.h
dbms/include/DB/Storages/StorageMaterializedView.h
+1
-2
dbms/include/DB/Storages/StorageMergeTree.h
dbms/include/DB/Storages/StorageMergeTree.h
+7
-9
dbms/include/DB/Storages/StorageReplicatedMergeTree.h
dbms/include/DB/Storages/StorageReplicatedMergeTree.h
+2
-2
dbms/src/Storages/StorageBuffer.cpp
dbms/src/Storages/StorageBuffer.cpp
+3
-3
dbms/src/Storages/StorageMaterializedView.cpp
dbms/src/Storages/StorageMaterializedView.cpp
+1
-1
dbms/src/Storages/StorageReplicatedMergeTree.cpp
dbms/src/Storages/StorageReplicatedMergeTree.cpp
+2
-4
未找到文件。
dbms/include/DB/Interpreters/InterpreterOptimizeQuery.h
浏览文件 @
96f33e92
...
...
@@ -24,7 +24,7 @@ public:
const
ASTOptimizeQuery
&
ast
=
typeid_cast
<
const
ASTOptimizeQuery
&>
(
*
query_ptr
);
StoragePtr
table
=
context
.
getTable
(
ast
.
database
,
ast
.
table
);
auto
table_lock
=
table
->
lockStructure
(
true
);
table
->
optimize
(
&
context
.
getSettingsRef
());
table
->
optimize
(
context
.
getSettings
());
}
private:
...
...
dbms/include/DB/Storages/IStorage.h
浏览文件 @
96f33e92
...
...
@@ -236,9 +236,9 @@ public:
/** Выполнить какую-либо фоновую работу. Например, объединение кусков в таблице типа MergeTree.
* Возвращает - была ли выполнена какая-либо работа.
*/
bool
optimize
(
const
Settings
*
settings
=
nullptr
)
virtual
bool
optimize
(
const
Settings
&
settings
)
{
return
performOptimize
(
settings
);
throw
Exception
(
"Method optimize is not supported by storage "
+
getName
(),
ErrorCodes
::
NOT_IMPLEMENTED
);
}
/** Получить запрос CREATE TABLE, который описывает данную таблицу.
...
...
@@ -279,12 +279,6 @@ public:
/// проверяет валидность данных
virtual
bool
checkData
()
const
{
throw
DB
::
Exception
(
"Check query is not supported for "
+
getName
()
+
" storage"
);
}
protected:
virtual
bool
performOptimize
(
const
Settings
*
settings
)
{
throw
Exception
(
"Method optimize is not supported by storage "
+
getName
(),
ErrorCodes
::
NOT_IMPLEMENTED
);
}
protected:
using
ITableDeclaration
::
ITableDeclaration
;
...
...
dbms/include/DB/Storages/StorageBuffer.h
浏览文件 @
96f33e92
...
...
@@ -70,6 +70,7 @@ public:
/// Сбрасывает все буферы в подчинённую таблицу.
void
shutdown
()
override
;
bool
optimize
(
const
Settings
&
settings
)
override
;
void
rename
(
const
String
&
new_path_to_db
,
const
String
&
new_database_name
,
const
String
&
new_table_name
)
override
{
name
=
new_table_name
;
}
...
...
@@ -123,8 +124,6 @@ private:
void
writeBlockToDestination
(
const
Block
&
block
,
StoragePtr
table
);
void
flushThread
();
bool
performOptimize
(
const
Settings
*
settings
)
override
;
};
}
dbms/include/DB/Storages/StorageMaterializedView.h
浏览文件 @
96f33e92
...
...
@@ -32,6 +32,7 @@ public:
BlockOutputStreamPtr
write
(
ASTPtr
query
)
override
;
void
drop
()
override
;
bool
optimize
(
const
Settings
&
settings
)
override
;
BlockInputStreams
read
(
const
Names
&
column_names
,
...
...
@@ -55,8 +56,6 @@ private:
const
NamesAndTypesList
&
alias_columns_
,
const
ColumnDefaults
&
column_defaults_
,
bool
attach_
);
bool
performOptimize
(
const
Settings
*
settings
)
override
;
};
}
dbms/include/DB/Storages/StorageMergeTree.h
浏览文件 @
96f33e92
...
...
@@ -79,6 +79,13 @@ public:
BlockOutputStreamPtr
write
(
ASTPtr
query
)
override
;
/** Выполнить очередной шаг объединения кусков.
*/
bool
optimize
(
const
Settings
&
settings
)
override
{
return
merge
(
settings
.
min_bytes_to_use_direct_io
,
true
);
}
void
dropPartition
(
const
Field
&
partition
,
bool
detach
,
const
Settings
&
settings
)
override
;
void
attachPartition
(
const
Field
&
partition
,
bool
unreplicated
,
bool
part
,
const
Settings
&
settings
)
override
;
void
freezePartition
(
const
Field
&
partition
,
const
Settings
&
settings
)
override
;
...
...
@@ -93,15 +100,6 @@ public:
MergeTreeData
&
getData
()
{
return
data
;
}
private:
/** Выполнить очередной шаг объединения кусков.
*/
bool
performOptimize
(
const
Settings
*
settings
)
override
{
const
auto
&
applied_settings
=
(
settings
!=
nullptr
)
?
*
settings
:
context
.
getSettings
();
return
merge
(
applied_settings
.
min_bytes_to_use_direct_io
,
true
);
}
private:
String
path
;
String
database_name
;
...
...
dbms/include/DB/Storages/StorageReplicatedMergeTree.h
浏览文件 @
96f33e92
...
...
@@ -83,6 +83,8 @@ public:
BlockOutputStreamPtr
write
(
ASTPtr
query
)
override
;
bool
optimize
(
const
Settings
&
settings
)
override
;
void
alter
(
const
AlterCommands
&
params
,
const
String
&
database_name
,
const
String
&
table_name
,
Context
&
context
)
override
;
void
dropPartition
(
const
Field
&
partition
,
bool
detach
,
const
Settings
&
settings
)
override
;
...
...
@@ -386,8 +388,6 @@ private:
*/
void
waitForReplicaToProcessLogEntry
(
const
String
&
replica_name
,
const
LogEntry
&
entry
);
bool
performOptimize
(
const
Settings
*
settings
)
override
;
/// Преобразовать число в строку формате суффиксов автоинкрементных нод в ZooKeeper.
static
String
padIndex
(
UInt64
index
)
{
...
...
dbms/src/Storages/StorageBuffer.cpp
浏览文件 @
96f33e92
...
...
@@ -265,11 +265,11 @@ void StorageBuffer::shutdown()
if
(
flush_thread
.
joinable
())
flush_thread
.
join
();
optimize
();
optimize
(
context
.
getSettings
()
);
}
bool
StorageBuffer
::
performOptimize
(
const
Settings
*
settings
)
bool
StorageBuffer
::
optimize
(
const
Settings
&
settings
)
{
flushAllBuffers
(
false
);
...
...
@@ -442,7 +442,7 @@ void StorageBuffer::alter(const AlterCommands & params, const String & database_
auto
lock
=
lockStructureForAlter
();
/// Чтобы не осталось блоков старой структуры.
optimize
();
optimize
(
context
.
getSettings
()
);
params
.
apply
(
*
columns
,
materialized_columns
,
alias_columns
,
column_defaults
);
InterpreterAlterQuery
::
updateMetadata
(
database_name
,
table_name
,
...
...
dbms/src/Storages/StorageMaterializedView.cpp
浏览文件 @
96f33e92
...
...
@@ -129,7 +129,7 @@ void StorageMaterializedView::drop()
}
}
bool
StorageMaterializedView
::
performOptimize
(
const
Settings
*
settings
)
bool
StorageMaterializedView
::
optimize
(
const
Settings
&
settings
)
{
return
data
->
optimize
(
settings
);
}
...
...
dbms/src/Storages/StorageReplicatedMergeTree.cpp
浏览文件 @
96f33e92
...
...
@@ -2060,7 +2060,7 @@ BlockOutputStreamPtr StorageReplicatedMergeTree::write(ASTPtr query)
}
bool
StorageReplicatedMergeTree
::
performOptimize
(
const
Settings
*
settings
)
bool
StorageReplicatedMergeTree
::
optimize
(
const
Settings
&
settings
)
{
/// Померджим какие-нибудь куски из директории unreplicated.
/// TODO: Мерджить реплицируемые куски тоже.
...
...
@@ -2079,9 +2079,7 @@ bool StorageReplicatedMergeTree::performOptimize(const Settings * settings)
return
false
;
const
auto
&
merge_entry
=
context
.
getMergeList
().
insert
(
database_name
,
table_name
,
merged_name
);
const
auto
&
applied_settings
=
(
settings
!=
nullptr
)
?
*
settings
:
context
.
getSettings
();
unreplicated_merger
->
mergeParts
(
parts
,
merged_name
,
*
merge_entry
,
applied_settings
.
min_bytes_to_use_direct_io
);
unreplicated_merger
->
mergeParts
(
parts
,
merged_name
,
*
merge_entry
,
settings
.
min_bytes_to_use_direct_io
);
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录