Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
81e679dc
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,发现更多精彩内容 >>
提交
81e679dc
编写于
8月 26, 2020
作者:
B
BohuTANG
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ISSUES-4006 support gtid sets with whitespace
上级
d01f4d38
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
69 addition
and
42 deletion
+69
-42
src/Core/MySQL/MySQLGtid.cpp
src/Core/MySQL/MySQLGtid.cpp
+1
-1
src/Core/tests/mysql_protocol.cpp
src/Core/tests/mysql_protocol.cpp
+68
-41
未找到文件。
src/Core/MySQL/MySQLGtid.cpp
浏览文件 @
81e679dc
...
...
@@ -28,7 +28,7 @@ void GTIDSets::parse(const String gtid_format)
}
std
::
vector
<
String
>
gtid_sets
;
boost
::
split
(
gtid_sets
,
gtid_format
,
[](
char
c
)
{
return
c
==
','
;
}
);
boost
::
split
(
gtid_sets
,
gtid_format
,
boost
::
is_any_of
(
", "
),
boost
::
token_compress_on
);
for
(
const
auto
&
gset
:
gtid_sets
)
{
...
...
src/Core/tests/mysql_protocol.cpp
浏览文件 @
81e679dc
#include <string>
#include <Core/MySQL/MySQLClient.h>
#include <Core/MySQL/Authentication.h>
#include <Core/MySQL/
PacketsGeneric
.h>
#include <Core/MySQL/
MySQLClient
.h>
#include <Core/MySQL/PacketsConnection.h>
#include <Core/MySQL/PacketsGeneric.h>
#include <Core/MySQL/PacketsProtocolText.h>
#include <IO/ReadBufferFromString.h>
#include <IO/WriteBufferFromString.h>
...
...
@@ -37,13 +37,13 @@ int main(int argc, char ** argv)
/// Handshake packet
{
/// 1. Greeting:
/// 1.1 Server writes greeting to client
std
::
string
s0
;
WriteBufferFromString
out0
(
s0
);
Handshake
server_handshake
(
server_capability_flags
,
-
1
,
"ClickHouse"
,
"mysql_native_password"
,
"aaaaaaaaaaaaaaaaaaaaa"
,
CharacterSet
::
utf8_general_ci
);
Handshake
server_handshake
(
server_capability_flags
,
-
1
,
"ClickHouse"
,
"mysql_native_password"
,
"aaaaaaaaaaaaaaaaaaaaa"
,
CharacterSet
::
utf8_general_ci
);
server_handshake
.
writePayload
(
out0
,
server_sequence_id
);
/// 1.2 Client reads the greeting
...
...
@@ -171,22 +171,49 @@ int main(int argc, char ** argv)
ASSERT
(
client
.
schema
==
server
.
schema
)
}
/// GTID tests.
{
String
str
=
"2c5adab4-d64a-11e5-82df-ac162d72dac0:1-247743812,9f58c169-d121-11e7-835b-ac162db9c048:1-56060985:56060987-56061175:56061177-"
"56061224:56061226-75201528:75201530-75201755:75201757-75201983:75201985-75407550:75407552-75407604:75407606-75407661:"
"75407663-87889848:87889850-87889935:87889937-87890042:87890044-88391955:88391957-88392125:88392127-88392245:88392247-"
"88755771:88755773-88755826:88755828-88755921:88755923-100279047:100279049-100279126:100279128-100279247:100279249-121672430:"
"121672432-121672503:121672505-121672524:121672526-122946019:122946021-122946291:122946293-122946469:122946471-134313284:"
"134313286-134313415:134313417-134313648:134313650-136492728:136492730-136492784:136492786-136492904:136492906-145582402:"
"145582404-145582439:145582441-145582463:145582465-147455222:147455224-147455262:147455264-147455277:147455279-149319049:"
"149319051-149319261:149319263-150635915,a6d83ff6-bfcf-11e7-8c93-246e96158550:1-126618302"
;
GTIDSets
gtid_sets
;
gtid_sets
.
parse
(
str
);
String
got
=
gtid_sets
.
toString
();
ASSERT
(
str
==
got
)
/// GTID sets tests.
{
struct
Testcase
{
String
name
;
String
sets
;
String
want
;
};
Testcase
cases
[]
=
{
{
"gtid-sets-without-whitespace"
,
"2c5adab4-d64a-11e5-82df-ac162d72dac0:1-247743812,9f58c169-d121-11e7-835b-ac162db9c048:1-56060985:56060987-56061175:56061177-"
"56061224:56061226-75201528:75201530-75201755:75201757-75201983:75201985-75407550:75407552-75407604:75407606-75407661:"
"75407663-87889848:87889850-87889935:87889937-87890042:87890044-88391955:88391957-88392125:88392127-88392245:88392247-"
"88755771:88755773-88755826:88755828-88755921:88755923-100279047:100279049-100279126:100279128-100279247:100279249-121672430:"
"121672432-121672503:121672505-121672524:121672526-122946019:122946021-122946291:122946293-122946469:122946471-134313284:"
"134313286-134313415:134313417-134313648:134313650-136492728:136492730-136492784:136492786-136492904:136492906-145582402:"
"145582404-145582439:145582441-145582463:145582465-147455222:147455224-147455262:147455264-147455277:147455279-149319049:"
"149319051-149319261:149319263-150635915,a6d83ff6-bfcf-11e7-8c93-246e96158550:1-126618302"
,
"2c5adab4-d64a-11e5-82df-ac162d72dac0:1-247743812,9f58c169-d121-11e7-835b-ac162db9c048:1-56060985:56060987-56061175:56061177-"
"56061224:56061226-75201528:75201530-75201755:75201757-75201983:75201985-75407550:75407552-75407604:75407606-75407661:"
"75407663-87889848:87889850-87889935:87889937-87890042:87890044-88391955:88391957-88392125:88392127-88392245:88392247-"
"88755771:88755773-88755826:88755828-88755921:88755923-100279047:100279049-100279126:100279128-100279247:100279249-121672430:"
"121672432-121672503:121672505-121672524:121672526-122946019:122946021-122946291:122946293-122946469:122946471-134313284:"
"134313286-134313415:134313417-134313648:134313650-136492728:136492730-136492784:136492786-136492904:136492906-145582402:"
"145582404-145582439:145582441-145582463:145582465-147455222:147455224-147455262:147455264-147455277:147455279-149319049:"
"149319051-149319261:149319263-150635915,a6d83ff6-bfcf-11e7-8c93-246e96158550:1-126618302"
},
{
"gtid-sets-with-whitespace"
,
"2c5adab4-d64a-11e5-82df-ac162d72dac0:1-247743812, 9f58c169-d121-11e7-835b-ac162db9c048:1-56060985:56060987-56061175:56061177"
,
"2c5adab4-d64a-11e5-82df-ac162d72dac0:1-247743812,9f58c169-d121-11e7-835b-ac162db9c048:1-56060985:56060987-56061175:56061177"
},
{
"gtid-sets-single"
,
"2c5adab4-d64a-11e5-82df-ac162d72dac0:1-247743812"
,
"2c5adab4-d64a-11e5-82df-ac162d72dac0:1-247743812"
}};
for
(
auto
&
tc
:
cases
)
{
GTIDSets
gtid_sets
;
gtid_sets
.
parse
(
tc
.
sets
);
String
want
=
tc
.
want
;
String
got
=
gtid_sets
.
toString
();
ASSERT
(
want
==
got
)
}
}
{
...
...
@@ -200,39 +227,39 @@ int main(int argc, char ** argv)
Testcase
cases
[]
=
{
{
"merge"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:4-7"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:3"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-7"
},
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:4-7"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:3"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-7"
},
{
"merge-front"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:5-7"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:3"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-3:5-7"
},
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:5-7"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:3"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-3:5-7"
},
{
"extend-interval"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:6-7"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:4"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:4:6-7"
},
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:6-7"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:4"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:4:6-7"
},
{
"extend-interval"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:4:7-9"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:5"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:4-5:7-9"
},
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:4:7-9"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:5"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:1-2:4-5:7-9"
},
{
"extend-interval"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:6-7"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:4"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:4:6-7"
},
"10662d71-9d91-11ea-bbc2-0242ac110003:6-7"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:4"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:4:6-7"
},
{
"extend-interval"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:6-7"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:9"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:6-7:9"
},
"10662d71-9d91-11ea-bbc2-0242ac110003:6-7"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:9"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:6-7:9"
},
{
"extend-interval"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:6-7"
,
"20662d71-9d91-11ea-bbc2-0242ac110003:9"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:6-7,20662d71-9d91-11ea-bbc2-0242ac110003:9"
},
"10662d71-9d91-11ea-bbc2-0242ac110003:6-7"
,
"20662d71-9d91-11ea-bbc2-0242ac110003:9"
,
"10662d71-9d91-11ea-bbc2-0242ac110003:6-7,20662d71-9d91-11ea-bbc2-0242ac110003:9"
},
};
for
(
auto
&
tc
:
cases
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录