Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
1f05000c
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,发现更多精彩内容 >>
提交
1f05000c
编写于
4月 19, 2018
作者:
V
Vitaliy Lyudvichenko
提交者:
alexey-milovidov
5月 09, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Better naming. [#CLICKHOUSE-3645]
上级
70458396
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
43 addition
and
43 deletion
+43
-43
dbms/src/Client/Connection.cpp
dbms/src/Client/Connection.cpp
+3
-3
dbms/src/Common/DNSResolver.cpp
dbms/src/Common/DNSResolver.cpp
+14
-14
dbms/src/Common/DNSResolver.h
dbms/src/Common/DNSResolver.h
+9
-9
dbms/src/IO/ReadWriteBufferFromHTTP.cpp
dbms/src/IO/ReadWriteBufferFromHTTP.cpp
+2
-2
dbms/src/Interpreters/Cluster.cpp
dbms/src/Interpreters/Cluster.cpp
+2
-2
dbms/src/Interpreters/Context.cpp
dbms/src/Interpreters/Context.cpp
+1
-1
dbms/src/Interpreters/DDLWorker.cpp
dbms/src/Interpreters/DDLWorker.cpp
+2
-2
dbms/src/Interpreters/DNSCacheUpdater.cpp
dbms/src/Interpreters/DNSCacheUpdater.cpp
+2
-2
dbms/src/Interpreters/InterpreterSystemQuery.cpp
dbms/src/Interpreters/InterpreterSystemQuery.cpp
+2
-2
dbms/src/Server/ClusterCopier.cpp
dbms/src/Server/ClusterCopier.cpp
+2
-2
dbms/src/Server/Server.cpp
dbms/src/Server/Server.cpp
+2
-2
dbms/src/Storages/System/StorageSystemClusters.cpp
dbms/src/Storages/System/StorageSystemClusters.cpp
+2
-2
未找到文件。
dbms/src/Client/Connection.cpp
浏览文件 @
1f05000c
...
...
@@ -17,7 +17,7 @@
#include <Common/Exception.h>
#include <Common/NetException.h>
#include <Common/CurrentMetrics.h>
#include <Common/DNS
Cache
.h>
#include <Common/DNS
Resolver
.h>
#include <Interpreters/ClientInfo.h>
#include <Common/config.h>
...
...
@@ -68,7 +68,7 @@ void Connection::connect()
socket
=
std
::
make_unique
<
Poco
::
Net
::
StreamSocket
>
();
}
current_resolved_address
=
DNS
Cache
::
instance
().
resolveAddress
(
host
,
port
);
current_resolved_address
=
DNS
Resolver
::
instance
().
resolveAddress
(
host
,
port
);
socket
->
connect
(
current_resolved_address
,
timeouts
.
connection_timeout
);
socket
->
setReceiveTimeout
(
timeouts
.
receive_timeout
);
...
...
@@ -471,7 +471,7 @@ Poco::Net::SocketAddress Connection::getResolvedAddress() const
if
(
connected
)
return
current_resolved_address
;
return
DNS
Cache
::
instance
().
resolveAddress
(
host
,
port
);
return
DNS
Resolver
::
instance
().
resolveAddress
(
host
,
port
);
}
...
...
dbms/src/Common/DNS
Cache
.cpp
→
dbms/src/Common/DNS
Resolver
.cpp
浏览文件 @
1f05000c
#include "DNS
Cache
.h"
#include "DNS
Resolver
.h"
#include <Common/SimpleCache.h>
#include <Common/Exception.h>
#include <Core/Types.h>
...
...
@@ -75,47 +75,47 @@ static Poco::Net::IPAddress resolveIPAddressImpl(const std::string & host)
}
struct
DNS
Cache
::
Impl
struct
DNS
Resolver
::
Impl
{
SimpleCache
<
decltype
(
resolveIPAddressImpl
),
&
resolveIPAddressImpl
>
cache_host
;
/// If disabled, will not make cache lookups, will resolve addresses manually on each call
std
::
atomic
<
bool
>
is_disabled
{
false
};
std
::
atomic
<
bool
>
disable_cache
{
false
};
};
DNS
Cache
::
DNSCache
()
:
impl
(
std
::
make_unique
<
DNSCache
::
Impl
>
())
{}
DNS
Resolver
::
DNSResolver
()
:
impl
(
std
::
make_unique
<
DNSResolver
::
Impl
>
())
{}
Poco
::
Net
::
IPAddress
DNS
Cache
::
resolveHost
(
const
std
::
string
&
host
)
Poco
::
Net
::
IPAddress
DNS
Resolver
::
resolveHost
(
const
std
::
string
&
host
)
{
return
!
impl
->
is_disabled
?
impl
->
cache_host
(
host
)
:
resolveIPAddressImpl
(
host
);
return
!
impl
->
disable_cache
?
impl
->
cache_host
(
host
)
:
resolveIPAddressImpl
(
host
);
}
Poco
::
Net
::
SocketAddress
DNS
Cache
::
resolveAddress
(
const
std
::
string
&
host_and_port
)
Poco
::
Net
::
SocketAddress
DNS
Resolver
::
resolveAddress
(
const
std
::
string
&
host_and_port
)
{
String
host
;
UInt16
port
;
splitHostAndPort
(
host_and_port
,
host
,
port
);
return
!
impl
->
is_disabled
?
Poco
::
Net
::
SocketAddress
(
impl
->
cache_host
(
host
),
port
)
:
Poco
::
Net
::
SocketAddress
(
host_and_port
);
return
!
impl
->
disable_cache
?
Poco
::
Net
::
SocketAddress
(
impl
->
cache_host
(
host
),
port
)
:
Poco
::
Net
::
SocketAddress
(
host_and_port
);
}
Poco
::
Net
::
SocketAddress
DNS
Cache
::
resolveAddress
(
const
std
::
string
&
host
,
UInt16
port
)
Poco
::
Net
::
SocketAddress
DNS
Resolver
::
resolveAddress
(
const
std
::
string
&
host
,
UInt16
port
)
{
return
!
impl
->
is_disabled
?
Poco
::
Net
::
SocketAddress
(
impl
->
cache_host
(
host
),
port
)
:
Poco
::
Net
::
SocketAddress
(
host
,
port
);
return
!
impl
->
disable_cache
?
Poco
::
Net
::
SocketAddress
(
impl
->
cache_host
(
host
),
port
)
:
Poco
::
Net
::
SocketAddress
(
host
,
port
);
}
void
DNS
Cache
::
drop
()
void
DNS
Resolver
::
dropCache
()
{
impl
->
cache_host
.
drop
();
}
void
DNS
Cache
::
setDisabl
eFlag
(
bool
is_disabled
)
void
DNS
Resolver
::
setDisableCach
eFlag
(
bool
is_disabled
)
{
impl
->
is_disabled
=
is_disabled
;
impl
->
disable_cache
=
is_disabled
;
}
DNS
Cache
::~
DNSCache
()
=
default
;
DNS
Resolver
::~
DNSResolver
()
=
default
;
}
dbms/src/Common/DNS
Cache
.h
→
dbms/src/Common/DNS
Resolver
.h
浏览文件 @
1f05000c
...
...
@@ -9,13 +9,13 @@
namespace
DB
{
/// A singleton implementing
global and
permanent DNS cache
///
It
could be updated only manually via drop() method
class
DNS
Cache
:
public
ext
::
singleton
<
DNSCache
>
/// A singleton implementing
DNS names resolving with optional
permanent DNS cache
///
The cache
could be updated only manually via drop() method
class
DNS
Resolver
:
public
ext
::
singleton
<
DNSResolver
>
{
public:
DNS
Cache
(
const
DNSCache
&
)
=
delete
;
DNS
Resolver
(
const
DNSResolver
&
)
=
delete
;
/// Accepts host names like 'example.com' or '127.0.0.1' or '::1' and resolve its IP
Poco
::
Net
::
IPAddress
resolveHost
(
const
std
::
string
&
host
);
...
...
@@ -26,18 +26,18 @@ public:
Poco
::
Net
::
SocketAddress
resolveAddress
(
const
std
::
string
&
host
,
UInt16
port
);
/// Disables caching
void
setDisableFlag
(
bool
is_disabled
=
true
);
void
setDisable
Cache
Flag
(
bool
is_disabled
=
true
);
/// Drops all caches
void
drop
();
void
drop
Cache
();
~
DNS
Cache
();
~
DNS
Resolver
();
protected:
DNS
Cache
();
DNS
Resolver
();
friend
class
ext
::
singleton
<
DNS
Cache
>
;
friend
class
ext
::
singleton
<
DNS
Resolver
>
;
struct
Impl
;
std
::
unique_ptr
<
Impl
>
impl
;
...
...
dbms/src/IO/ReadWriteBufferFromHTTP.cpp
浏览文件 @
1f05000c
...
...
@@ -4,7 +4,7 @@
#include <Common/config.h>
#include <Core/Types.h>
#include <IO/ReadBufferFromIStream.h>
#include <Common/DNS
Cache
.h>
#include <Common/DNS
Resolver
.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPResponse.h>
#include <Poco/Version.h>
...
...
@@ -43,7 +43,7 @@ ReadWriteBufferFromHTTP::ReadWriteBufferFromHTTP(const Poco::URI & uri,
new
Poco
::
Net
::
HTTPClientSession
)
}
{
session
->
setHost
(
DNS
Cache
::
instance
().
resolveHost
(
uri
.
getHost
()).
toString
());
session
->
setHost
(
DNS
Resolver
::
instance
().
resolveHost
(
uri
.
getHost
()).
toString
());
session
->
setPort
(
uri
.
getPort
());
#if POCO_CLICKHOUSE_PATCH || POCO_VERSION >= 0x02000000
...
...
dbms/src/Interpreters/Cluster.cpp
浏览文件 @
1f05000c
#include <Interpreters/Cluster.h>
#include <Common/DNS
Cache
.h>
#include <Common/DNS
Resolver
.h>
#include <Common/escapeForFileName.h>
#include <Common/isLocalAddress.h>
#include <Common/SimpleCache.h>
...
...
@@ -47,7 +47,7 @@ inline bool isLocal(const Cluster::Address & address, const Poco::Net::SocketAdd
Poco
::
Net
::
SocketAddress
resolveSocketAddress
(
const
String
&
host
,
UInt16
port
)
{
return
Poco
::
Net
::
SocketAddress
(
DNS
Cache
::
instance
().
resolveHost
(
host
),
port
);
return
Poco
::
Net
::
SocketAddress
(
DNS
Resolver
::
instance
().
resolveHost
(
host
),
port
);
}
}
...
...
dbms/src/Interpreters/Context.cpp
浏览文件 @
1f05000c
...
...
@@ -39,7 +39,7 @@
#include <Interpreters/QueryLog.h>
#include <Interpreters/PartLog.h>
#include <Interpreters/Context.h>
#include <Common/DNS
Cache
.h>
#include <Common/DNS
Resolver
.h>
#include <IO/ReadBufferFromFile.h>
#include <IO/UncompressedCache.h>
#include <Parsers/ASTCreateQuery.h>
...
...
dbms/src/Interpreters/DDLWorker.cpp
浏览文件 @
1f05000c
...
...
@@ -16,7 +16,7 @@
#include <Interpreters/executeQuery.h>
#include <Interpreters/Cluster.h>
#include <Common/DNS
Cache
.h>
#include <Common/DNS
Resolver
.h>
#include <Common/Macros.h>
#include <Common/getFQDNOrHostName.h>
...
...
@@ -94,7 +94,7 @@ struct HostID
{
try
{
return
DB
::
isLocalAddress
(
DNS
Cache
::
instance
().
resolveAddress
(
host_name
,
port
),
clickhouse_port
);
return
DB
::
isLocalAddress
(
DNS
Resolver
::
instance
().
resolveAddress
(
host_name
,
port
),
clickhouse_port
);
}
catch
(
const
Poco
::
Net
::
NetException
&
e
)
{
...
...
dbms/src/Interpreters/DNSCacheUpdater.cpp
浏览文件 @
1f05000c
#include "DNSCacheUpdater.h"
#include <Common/DNS
Cache
.h>
#include <Common/DNS
Resolver
.h>
#include <Interpreters/Context.h>
#include <Storages/MergeTree/BackgroundProcessingPool.h>
#include <Common/ProfileEvents.h>
...
...
@@ -43,7 +43,7 @@ bool DNSCacheUpdater::run()
{
LOG_INFO
(
&
Poco
::
Logger
::
get
(
"DNSCacheUpdater"
),
"Updating DNS cache"
);
DNS
Cache
::
instance
().
drop
();
DNS
Resolver
::
instance
().
dropCache
();
context
.
reloadClusterConfig
();
last_num_network_erros
=
num_current_network_exceptions
;
...
...
dbms/src/Interpreters/InterpreterSystemQuery.cpp
浏览文件 @
1f05000c
#include <Interpreters/InterpreterSystemQuery.h>
#include <Common/DNS
Cache
.h>
#include <Common/DNS
Resolver
.h>
#include <Interpreters/Context.h>
#include <Interpreters/ExternalDictionaries.h>
#include <Interpreters/EmbeddedDictionaries.h>
...
...
@@ -78,7 +78,7 @@ BlockIO InterpreterSystemQuery::execute()
throwFromErrno
(
"System call kill(0, SIGKILL) failed"
,
ErrorCodes
::
CANNOT_KILL
);
break
;
case
Type
::
DROP_DNS_CACHE
:
DNS
Cache
::
instance
().
drop
();
DNS
Resolver
::
instance
().
dropCache
();
/// Reinitialize clusters to update their resolved_addresses
system_context
.
reloadClusterConfig
();
break
;
...
...
dbms/src/Server/ClusterCopier.cpp
浏览文件 @
1f05000c
...
...
@@ -29,7 +29,7 @@
#include <Common/typeid_cast.h>
#include <Common/ClickHouseRevision.h>
#include <Common/formatReadable.h>
#include <Common/DNS
Cache
.h>
#include <Common/DNS
Resolver
.h>
#include <Common/escapeForFileName.h>
#include <Client/Connection.h>
#include <Interpreters/Context.h>
...
...
@@ -612,7 +612,7 @@ static ShardPriority getReplicasPriority(const Cluster::Addresses & replicas, co
res
.
is_remote
=
1
;
for
(
auto
&
replica
:
replicas
)
{
if
(
isLocalAddress
(
DNS
Cache
::
instance
().
resolveHost
(
replica
.
host_name
)))
if
(
isLocalAddress
(
DNS
Resolver
::
instance
().
resolveHost
(
replica
.
host_name
)))
{
res
.
is_remote
=
0
;
break
;
...
...
dbms/src/Server/Server.cpp
浏览文件 @
1f05000c
...
...
@@ -11,7 +11,7 @@
#include <common/ErrorHandlers.h>
#include <common/getMemoryAmount.h>
#include <Common/ClickHouseRevision.h>
#include <Common/DNS
Cache
.h>
#include <Common/DNS
Resolver
.h>
#include <Common/CurrentMetrics.h>
#include <Common/Macros.h>
#include <Common/StringUtils/StringUtils.h>
...
...
@@ -330,7 +330,7 @@ int Server::main(const std::vector<std::string> & /*args*/)
if
(
config
().
has
(
"disable_internal_dns_cache"
)
&&
config
().
getInt
(
"disable_internal_dns_cache"
))
{
/// Disable DNS caching at all
DNS
Cache
::
instance
().
setDisabl
eFlag
();
DNS
Resolver
::
instance
().
setDisableCach
eFlag
();
}
else
{
...
...
dbms/src/Storages/System/StorageSystemClusters.cpp
浏览文件 @
1f05000c
...
...
@@ -5,7 +5,7 @@
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataStreams/OneBlockInputStream.h>
#include <Common/DNS
Cache
.h>
#include <Common/DNS
Resolver
.h>
#include <Interpreters/Context.h>
namespace
DB
...
...
@@ -52,7 +52,7 @@ BlockInputStreams StorageSystemClusters::read(
res_columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
shard_info
.
weight
));
res_columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
address
.
replica_num
));
res_columns
[
i
++
]
->
insert
(
address
.
host_name
);
res_columns
[
i
++
]
->
insert
(
DNS
Cache
::
instance
().
resolveHost
(
address
.
host_name
).
toString
());
res_columns
[
i
++
]
->
insert
(
DNS
Resolver
::
instance
().
resolveHost
(
address
.
host_name
).
toString
());
res_columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
address
.
port
));
res_columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
shard_info
.
isLocal
()));
res_columns
[
i
++
]
->
insert
(
address
.
user
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录