Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
142c63e4
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,发现更多精彩内容 >>
提交
142c63e4
编写于
5月 30, 2020
作者:
M
MovElb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
done rebase
上级
b4b5c903
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
27 addition
and
6 deletion
+27
-6
programs/server/Server.cpp
programs/server/Server.cpp
+16
-0
src/Core/PostgreSQLProtocol.h
src/Core/PostgreSQLProtocol.h
+3
-2
src/Server/PostgreSQLHandler.cpp
src/Server/PostgreSQLHandler.cpp
+0
-0
src/Server/PostgreSQLHandler.h
src/Server/PostgreSQLHandler.h
+1
-0
src/Server/PostgreSQLHandlerFactory.cpp
src/Server/PostgreSQLHandlerFactory.cpp
+2
-3
src/Server/PostgreSQLHandlerFactory.h
src/Server/PostgreSQLHandlerFactory.h
+3
-1
src/Server/ya.make
src/Server/ya.make
+2
-0
未找到文件。
programs/server/Server.cpp
浏览文件 @
142c63e4
...
...
@@ -60,6 +60,7 @@
#include <Common/SensitiveDataMasker.h>
#include <Common/ThreadFuzzer.h>
#include <Server/MySQLHandlerFactory.h>
#include <Server/PostgreSQLHandlerFactory.h>
#if !defined(ARCADIA_BUILD)
...
...
@@ -935,6 +936,21 @@ int Server::main(const std::vector<std::string> & /*args*/)
LOG_INFO
(
log
,
"Listening for MySQL compatibility protocol: {}"
,
address
.
toString
());
});
create_server
(
"postgresql_port"
,
[
&
](
UInt16
port
)
{
Poco
::
Net
::
ServerSocket
socket
;
auto
address
=
socket_bind_listen
(
socket
,
listen_host
,
port
,
/* secure = */
true
);
socket
.
setReceiveTimeout
(
Poco
::
Timespan
());
socket
.
setSendTimeout
(
settings
.
send_timeout
);
servers
.
emplace_back
(
std
::
make_unique
<
Poco
::
Net
::
TCPServer
>
(
new
PostgreSQLHandlerFactory
(
*
this
),
server_pool
,
socket
,
new
Poco
::
Net
::
TCPServerParams
));
LOG_INFO
(
log
,
"Listening for PostgreSQL compatibility protocol: "
+
address
.
toString
());
});
/// Prometheus (if defined and not setup yet with http_port)
create_server
(
"prometheus.port"
,
[
&
](
UInt16
port
)
{
...
...
src/Core/PostgreSQLProtocol.h
浏览文件 @
142c63e4
...
...
@@ -8,6 +8,7 @@
#include <IO/ReadHelpers.h>
#include <IO/WriteBuffer.h>
#include <IO/WriteHelpers.h>
#include <common/logger_useful.h>
#include <Poco/Format.h>
#include <Poco/RegularExpression.h>
#include <Poco/Net/StreamSocket.h>
...
...
@@ -800,7 +801,7 @@ protected:
const
Poco
::
Net
::
SocketAddress
&
address
)
{
try
{
context
.
setUser
(
user_name
,
password
,
address
,
""
);
context
.
setUser
(
user_name
,
password
,
address
);
}
catch
(
const
Exception
&
)
{
...
...
@@ -897,7 +898,7 @@ public:
{
type_to_method
[
user_auth_type
]
->
authenticate
(
user_name
,
context
,
mt
,
address
);
mt
.
send
(
Messaging
::
AuthenticationOk
(),
true
);
LOG_INFO
(
log
,
"Authentication for user
"
<<
user_name
<<
" was successful."
);
LOG_INFO
(
log
,
"Authentication for user
{} was successful."
,
user_name
);
return
;
}
...
...
programs/s
erver/PostgreSQLHandler.cpp
→
src/S
erver/PostgreSQLHandler.cpp
浏览文件 @
142c63e4
文件已移动
programs/s
erver/PostgreSQLHandler.h
→
src/S
erver/PostgreSQLHandler.h
浏览文件 @
142c63e4
...
...
@@ -3,6 +3,7 @@
#include <Common/CurrentMetrics.h>
#include <Core/PostgreSQLProtocol.h>
#include <Poco/Net/TCPServerConnection.h>
#include <common/logger_useful.h>
#include "IServer.h"
#if USE_SSL
...
...
programs/s
erver/PostgreSQLHandlerFactory.cpp
→
src/S
erver/PostgreSQLHandlerFactory.cpp
浏览文件 @
142c63e4
#include "PostgreSQLHandlerFactory.h"
#include "IServer.h"
#include <Poco/Net/TCPServerConnectionFactory.h>
#include <memory>
#include
"PostgreSQLHandler.h"
#include
<Server/PostgreSQLHandler.h>
namespace
DB
{
...
...
@@ -21,7 +20,7 @@ PostgreSQLHandlerFactory::PostgreSQLHandlerFactory(IServer & server_)
Poco
::
Net
::
TCPServerConnection
*
PostgreSQLHandlerFactory
::
createConnection
(
const
Poco
::
Net
::
StreamSocket
&
socket
)
{
Int32
connection_id
=
last_connection_id
++
;
LOG_TRACE
(
log
,
"PostgreSQL connection. Id:
"
<<
connection_id
<<
". Address: "
<<
socket
.
peerAddress
().
toString
());
LOG_TRACE
(
log
,
"PostgreSQL connection. Id:
{}. Address: {}"
,
connection_id
,
socket
.
peerAddress
().
toString
());
return
new
PostgreSQLHandler
(
socket
,
server
,
ssl_enabled
,
connection_id
,
auth_methods
);
}
...
...
programs/s
erver/PostgreSQLHandlerFactory.h
→
src/S
erver/PostgreSQLHandlerFactory.h
浏览文件 @
142c63e4
#pragma once
#include "IServer.h"
#include <Poco/Net/TCPServerConnectionFactory.h>
#include <atomic>
#include <memory>
#include <Server/IServer.h>
#include <Core/PostgreSQLProtocol.h>
namespace
DB
...
...
src/Server/ya.make
浏览文件 @
142c63e4
...
...
@@ -11,6 +11,8 @@ SRCS(
InterserverIOHTTPHandler.cpp
MySQLHandler.cpp
MySQLHandlerFactory.cpp
PostgreSQLHandler.cpp
PostgreSQLHandlerFactory.cpp
NotFoundHandler.cpp
PrometheusMetricsWriter.cpp
PrometheusRequestHandler.cpp
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录