Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
ae2cc175
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,发现更多精彩内容 >>
提交
ae2cc175
编写于
1月 06, 2020
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed potential performance issue in "Context::getTable" method
上级
b6870e09
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
11 addition
and
15 deletion
+11
-15
dbms/src/Client/Connection.cpp
dbms/src/Client/Connection.cpp
+1
-3
dbms/src/IO/ReadHelpers.cpp
dbms/src/IO/ReadHelpers.cpp
+3
-5
dbms/src/IO/ReadHelpers.h
dbms/src/IO/ReadHelpers.h
+1
-1
dbms/src/Interpreters/Context.cpp
dbms/src/Interpreters/Context.cpp
+5
-5
dbms/src/Interpreters/Context.h
dbms/src/Interpreters/Context.h
+1
-1
未找到文件。
dbms/src/Client/Connection.cpp
浏览文件 @
ae2cc175
...
...
@@ -774,9 +774,7 @@ std::unique_ptr<Exception> Connection::receiveException()
{
//LOG_TRACE(log_wrapper.get(), "Receiving exception");
Exception
e
;
readException
(
e
,
*
in
,
"Received from "
+
getDescription
());
return
std
::
unique_ptr
<
Exception
>
{
e
.
clone
()
};
return
std
::
make_unique
<
Exception
>
{
readException
(
*
in
,
"Received from "
+
getDescription
())
};
}
...
...
dbms/src/IO/ReadHelpers.cpp
浏览文件 @
ae2cc175
...
...
@@ -959,7 +959,7 @@ void skipJSONField(ReadBuffer & buf, const StringRef & name_of_field)
}
void
readException
(
Exception
&
e
,
ReadBuffer
&
buf
,
const
String
&
additional_message
)
Exception
readException
(
ReadBuffer
&
buf
,
const
String
&
additional_message
)
{
int
code
=
0
;
String
name
;
...
...
@@ -986,14 +986,12 @@ void readException(Exception & e, ReadBuffer & buf, const String & additional_me
if
(
!
stack_trace
.
empty
())
out
<<
" Stack trace:
\n\n
"
<<
stack_trace
;
e
=
Exception
(
out
.
str
(),
code
);
return
Exception
(
out
.
str
(),
code
);
}
void
readAndThrowException
(
ReadBuffer
&
buf
,
const
String
&
additional_message
)
{
Exception
e
;
readException
(
e
,
buf
,
additional_message
);
e
.
rethrow
();
readException
(
buf
,
additional_message
).
rethrow
();
}
...
...
dbms/src/IO/ReadHelpers.h
浏览文件 @
ae2cc175
...
...
@@ -939,7 +939,7 @@ void skipJSONField(ReadBuffer & buf, const StringRef & name_of_field);
* (type is cut to base class, 'message' replaced by 'displayText', and stack trace is appended to 'message')
* Some additional message could be appended to exception (example: you could add information about from where it was received).
*/
void
readException
(
Exception
&
e
,
ReadBuffer
&
buf
,
const
String
&
additional_message
=
""
);
Exception
readException
(
ReadBuffer
&
buf
,
const
String
&
additional_message
=
""
);
void
readAndThrowException
(
ReadBuffer
&
buf
,
const
String
&
additional_message
=
""
);
...
...
dbms/src/Interpreters/Context.cpp
浏览文件 @
ae2cc175
...
...
@@ -922,7 +922,7 @@ StoragePtr Context::tryGetExternalTable(const String & table_name) const
StoragePtr
Context
::
getTable
(
const
String
&
database_name
,
const
String
&
table_name
)
const
{
Exception
exc
;
std
::
optional
<
Exception
>
exc
;
auto
res
=
getTableImpl
(
database_name
,
table_name
,
&
exc
);
if
(
!
res
)
throw
exc
;
...
...
@@ -932,11 +932,11 @@ StoragePtr Context::getTable(const String & database_name, const String & table_
StoragePtr
Context
::
tryGetTable
(
const
String
&
database_name
,
const
String
&
table_name
)
const
{
return
getTableImpl
(
database_name
,
table_name
,
nullptr
);
return
getTableImpl
(
database_name
,
table_name
,
{}
);
}
StoragePtr
Context
::
getTableImpl
(
const
String
&
database_name
,
const
String
&
table_name
,
Exception
*
exception
)
const
StoragePtr
Context
::
getTableImpl
(
const
String
&
database_name
,
const
String
&
table_name
,
std
::
optional
<
Exception
>
*
exception
)
const
{
String
db
;
DatabasePtr
database
;
...
...
@@ -958,7 +958,7 @@ StoragePtr Context::getTableImpl(const String & database_name, const String & ta
if
(
shared
->
databases
.
end
()
==
it
)
{
if
(
exception
)
*
exception
=
Exception
(
"Database "
+
backQuoteIfNeed
(
db
)
+
" doesn't exist"
,
ErrorCodes
::
UNKNOWN_DATABASE
);
exception
->
emplace
(
"Database "
+
backQuoteIfNeed
(
db
)
+
" doesn't exist"
,
ErrorCodes
::
UNKNOWN_DATABASE
);
return
{};
}
...
...
@@ -969,7 +969,7 @@ StoragePtr Context::getTableImpl(const String & database_name, const String & ta
if
(
!
table
)
{
if
(
exception
)
*
exception
=
Exception
(
"Table "
+
backQuoteIfNeed
(
db
)
+
"."
+
backQuoteIfNeed
(
table_name
)
+
" doesn't exist."
,
ErrorCodes
::
UNKNOWN_TABLE
);
exception
->
emplace
(
"Table "
+
backQuoteIfNeed
(
db
)
+
"."
+
backQuoteIfNeed
(
table_name
)
+
" doesn't exist."
,
ErrorCodes
::
UNKNOWN_TABLE
);
return
{};
}
...
...
dbms/src/Interpreters/Context.h
浏览文件 @
ae2cc175
...
...
@@ -589,7 +589,7 @@ private:
EmbeddedDictionaries
&
getEmbeddedDictionariesImpl
(
bool
throw_on_error
)
const
;
StoragePtr
getTableImpl
(
const
String
&
database_name
,
const
String
&
table_name
,
Exception
*
exception
)
const
;
StoragePtr
getTableImpl
(
const
String
&
database_name
,
const
String
&
table_name
,
std
::
optional
<
Exception
>
*
exception
)
const
;
SessionKey
getSessionKey
(
const
String
&
session_id
)
const
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录