Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
c8f655c1
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,发现更多精彩内容 >>
提交
c8f655c1
编写于
5月 06, 2018
作者:
Z
zhang2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ISSUES-2259 fix the test after the merge master
上级
6613e567
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
23 addition
and
41 deletion
+23
-41
dbms/src/Interpreters/ClusterProxy/TruncateStreamFactory.cpp
dbms/src/Interpreters/ClusterProxy/TruncateStreamFactory.cpp
+6
-29
dbms/src/Interpreters/ClusterProxy/TruncateStreamFactory.h
dbms/src/Interpreters/ClusterProxy/TruncateStreamFactory.h
+2
-5
dbms/src/Interpreters/InterpreterDropQuery.cpp
dbms/src/Interpreters/InterpreterDropQuery.cpp
+0
-2
dbms/src/Parsers/ASTDropQuery.h
dbms/src/Parsers/ASTDropQuery.h
+4
-1
dbms/src/Parsers/ParserDropQuery.cpp
dbms/src/Parsers/ParserDropQuery.cpp
+5
-0
dbms/src/Storages/MergeTree/MergeTreeData.cpp
dbms/src/Storages/MergeTree/MergeTreeData.cpp
+0
-1
dbms/src/Storages/StorageDistributed.cpp
dbms/src/Storages/StorageDistributed.cpp
+1
-2
dbms/src/Storages/StorageMemory.h
dbms/src/Storages/StorageMemory.h
+1
-1
dbms/src/Storages/StorageSet.cpp
dbms/src/Storages/StorageSet.cpp
+4
-0
dbms/tests/queries/0_stateless/00623_replicated_truncate_table_zookeeper.reference
...eless/00623_replicated_truncate_table_zookeeper.reference
+0
-0
dbms/tests/queries/0_stateless/00623_replicated_truncate_table_zookeeper.sql
...0_stateless/00623_replicated_truncate_table_zookeeper.sql
+0
-0
未找到文件。
dbms/src/Interpreters/ClusterProxy/TruncateStreamFactory.cpp
浏览文件 @
c8f655c1
...
...
@@ -2,6 +2,7 @@
#include <Interpreters/InterpreterDropQuery.h>
#include <DataStreams/RemoteBlockInputStream.h>
#include <Interpreters/Cluster.h>
#include <ext/range.h>
namespace
DB
{
...
...
@@ -9,8 +10,9 @@ namespace DB
namespace
ClusterProxy
{
TruncateStreamFactory
::
TruncateStreamFactory
(
ClusterPtr
&
cluster_
,
String
&
storage_path_
)
:
cluster
(
cluster_
),
storage_path
(
storage_path_
)
{}
TruncateStreamFactory
::
TruncateStreamFactory
(
ClusterPtr
&
cluster_
)
:
cluster
(
cluster_
)
{
}
void
TruncateStreamFactory
::
createForShard
(
const
Cluster
::
ShardInfo
&
shard_info
,
...
...
@@ -18,9 +20,6 @@ void TruncateStreamFactory::createForShard(
const
ThrottlerPtr
&
throttler
,
Context
&
context
,
BlockInputStreams
&
res
)
{
/// TODO remove temporary
// removeTemporaryDir(shard_info);
if
(
shard_info
.
isLocal
())
{
InterpreterDropQuery
drop_query
{
query_ast
,
context
};
...
...
@@ -48,6 +47,8 @@ void TruncateStreamFactory::createForShard(
if
(
shard_info
.
hasInternalReplication
())
break
;
continue
;
}
throw
Exception
(
"Connection pool for replica "
+
replicas
[
replica_index
].
readableString
()
+
" does not exist"
,
ErrorCodes
::
LOGICAL_ERROR
);
...
...
@@ -56,30 +57,6 @@ void TruncateStreamFactory::createForShard(
}
}
void
TruncateStreamFactory
::
removeTemporaryDir
(
const
Cluster
::
ShardInfo
&
shard_info
)
const
{
if
(
!
shard_info
.
hasInternalReplication
())
{
Cluster
::
Addresses
addresses
=
cluster
->
getShardsAddresses
().
at
(
shard_info
.
shard_num
);
for
(
auto
&
address
:
addresses
)
{
auto
temporary_file
=
Poco
::
File
(
storage_path
+
"/"
+
address
.
toStringFull
());
if
(
temporary_file
.
exists
())
temporary_file
.
remove
(
true
);
}
return
;
}
if
(
!
shard_info
.
dir_name_for_internal_replication
.
empty
())
{
auto
temporary_file
=
Poco
::
File
(
storage_path
+
"/"
+
shard_info
.
dir_name_for_internal_replication
);
if
(
temporary_file
.
exists
())
temporary_file
.
remove
(
true
);
}
}
Cluster
::
Addresses
TruncateStreamFactory
::
getShardReplicasAddresses
(
const
Cluster
::
ShardInfo
&
info
)
{
const
auto
addresses_with_failovers
=
cluster
->
getShardsAddresses
();
...
...
dbms/src/Interpreters/ClusterProxy/TruncateStreamFactory.h
浏览文件 @
c8f655c1
...
...
@@ -12,7 +12,7 @@ class TruncateStreamFactory final : public IStreamFactory
{
public:
TruncateStreamFactory
(
ClusterPtr
&
cluster
,
String
&
storage_path
);
TruncateStreamFactory
(
ClusterPtr
&
cluster
);
void
createForShard
(
const
Cluster
::
ShardInfo
&
shard_info
,
...
...
@@ -20,11 +20,8 @@ public:
const
ThrottlerPtr
&
throttler
,
Context
&
context
,
BlockInputStreams
&
res
)
override
;
void
removeTemporaryDir
(
const
Cluster
::
ShardInfo
&
shard_info
)
const
;
private:
ClusterPtr
cluster
;
String
&
storage_path
;
ClusterPtr
&
cluster
;
Cluster
::
Addresses
getShardReplicasAddresses
(
const
Cluster
::
ShardInfo
&
info
);
};
...
...
dbms/src/Interpreters/InterpreterDropQuery.cpp
浏览文件 @
c8f655c1
...
...
@@ -8,8 +8,6 @@
#include <Storages/IStorage.h>
#include <Common/escapeForFileName.h>
#include <Common/typeid_cast.h>
#include <Functions/GatherUtils/Algorithms.h>
#include <AggregateFunctions/AggregateFunctionSequenceMatch.h>
namespace
DB
...
...
dbms/src/Parsers/ASTDropQuery.h
浏览文件 @
c8f655c1
...
...
@@ -3,11 +3,14 @@
#include <Parsers/IAST.h>
#include <Parsers/ASTQueryWithOutput.h>
#include <Parsers/ASTQueryWithOnCluster.h>
#include <AggregateFunctions/AggregateFunctionSequenceMatch.h>
namespace
DB
{
namespace
ErrorCodes
{
extern
const
int
SYNTAX_ERROR
;
}
/** DROP query
*/
...
...
dbms/src/Parsers/ParserDropQuery.cpp
浏览文件 @
c8f655c1
...
...
@@ -10,6 +10,11 @@
namespace
DB
{
namespace
ErrorCodes
{
extern
const
int
SYNTAX_ERROR
;
extern
const
int
LOGICAL_ERROR
;
}
bool
ParserDropQuery
::
parseImpl
(
Pos
&
pos
,
ASTPtr
&
node
,
Expected
&
expected
)
{
...
...
dbms/src/Storages/MergeTree/MergeTreeData.cpp
浏览文件 @
c8f655c1
...
...
@@ -1580,7 +1580,6 @@ void MergeTreeData::renameAndDetachPart(const DataPartPtr & part_to_detach, cons
part
->
renameAddPrefix
(
move_to_detached
,
prefix
);
data_parts_indexes
.
erase
(
it_part
);
std
::
cout
<<
"MergeTreeData::renameAndDetachPart
\n
"
;
if
(
restore_covered
&&
part
->
info
.
level
==
0
)
{
LOG_WARNING
(
log
,
"Will not recover parts covered by zero-level part "
<<
part
->
name
);
...
...
dbms/src/Storages/StorageDistributed.cpp
浏览文件 @
c8f655c1
...
...
@@ -317,8 +317,7 @@ void StorageDistributed::truncate(const ASTPtr & query)
}
}
String
storage_path
=
getDataPath
();
ClusterProxy
::
TruncateStreamFactory
truncate_stream_factory
(
cluster
,
storage_path
);
ClusterProxy
::
TruncateStreamFactory
truncate_stream_factory
(
cluster
);
ClusterProxy
::
executeQuery
(
truncate_stream_factory
,
cluster
,
ast_drop_query
,
context
,
context
.
getSettingsRef
());
}
...
...
dbms/src/Storages/StorageMemory.h
浏览文件 @
c8f655c1
...
...
@@ -40,7 +40,7 @@ public:
void
drop
()
override
;
v
irtual
v
oid
truncate
(
const
ASTPtr
&
query
)
override
;
void
truncate
(
const
ASTPtr
&
query
)
override
;
void
rename
(
const
String
&
/*new_path_to_db*/
,
const
String
&
/*new_database_name*/
,
const
String
&
new_table_name
)
override
{
table_name
=
new_table_name
;
}
...
...
dbms/src/Storages/StorageSet.cpp
浏览文件 @
c8f655c1
...
...
@@ -120,8 +120,12 @@ size_t StorageSet::getSize() const { return set->getTotalRowCount(); }
void
StorageSet
::
truncate
(
const
ASTPtr
&
/*query*/
)
{
Block
header
=
getSampleBlock
();
header
=
header
.
sortColumns
();
increment
=
0
;
set
=
std
::
make_shared
<
Set
>
(
SizeLimits
());
set
->
setHeader
(
header
);
static
const
auto
file_suffix
=
".bin"
;
...
...
dbms/tests/queries/0_stateless/00623_replicated_truncate_table.reference
→
dbms/tests/queries/0_stateless/00623_replicated_truncate_table
_zookeeper
.reference
浏览文件 @
c8f655c1
文件已移动
dbms/tests/queries/0_stateless/00623_replicated_truncate_table.sql
→
dbms/tests/queries/0_stateless/00623_replicated_truncate_table
_zookeeper
.sql
浏览文件 @
c8f655c1
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录