Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3d10b6f8
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3d10b6f8
编写于
7月 17, 2020
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support multi thread update dnode
上级
c877418d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
26 deletion
+45
-26
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+3
-0
src/client/src/tscServer.c
src/client/src/tscServer.c
+41
-26
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-0
未找到文件。
src/client/src/tscSchemaUtil.c
浏览文件 @
3d10b6f8
...
...
@@ -157,6 +157,9 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size
pTableMeta
->
sid
=
pTableMetaMsg
->
sid
;
pTableMeta
->
uid
=
pTableMetaMsg
->
uid
;
pTableMeta
->
vgroupInfo
=
pTableMetaMsg
->
vgroup
;
//init version here
pTableMeta
->
vgroupInfo
.
version
=
0
;
pTableMeta
->
sversion
=
pTableMetaMsg
->
sversion
;
pTableMeta
->
tversion
=
pTableMetaMsg
->
tversion
;
...
...
src/client/src/tscServer.c
浏览文件 @
3d10b6f8
...
...
@@ -51,8 +51,7 @@ static void tscDumpMgmtIpSet(SRpcIpSet *ipSet) {
}
bool
tscIpSetIsEqual
(
SRpcIpSet
*
s1
,
SRpcIpSet
*
s2
)
{
if
(
s1
->
numOfIps
!=
s2
->
numOfIps
||
s1
->
inUse
!=
s1
->
inUse
)
{
if
(
s1
->
numOfIps
!=
s2
->
numOfIps
/*|| s1->inUse != s1->inUse*/
)
{
return
false
;
}
for
(
int32_t
i
=
0
;
i
<
s1
->
numOfIps
;
i
++
)
{
...
...
@@ -80,21 +79,38 @@ void tscSetMgmtIpList(SRpcIpSet *pIpSet) {
}
taosCorEndWrite
(
&
tscMgmtIpSet
.
version
);
}
static
void
tscSetDnodeIpList
(
SSqlObj
*
pSql
,
SCMVgroupInfo
*
pVgroupInfo
)
{
SRpcIpSet
*
pIpList
=
&
pSql
->
ipList
;
pIpList
->
inUse
=
0
;
if
(
pVgroupInfo
==
NULL
)
{
pIpList
->
numOfIps
=
0
;
return
;
static
void
tscDumpIpSetFromVgroupInfo
(
SCMVgroupInfo
*
pVgroupInfo
,
SRpcIpSet
*
pIpSet
,
int32_t
*
vgId
)
{
if
(
pVgroupInfo
==
NULL
)
{
return
;}
taosCorBeginRead
(
&
pVgroupInfo
->
version
);
if
(
vgId
)
{
*
vgId
=
pVgroupInfo
->
vgId
;
}
pIp
List
->
numOfIps
=
pVgroupInfo
->
numOfIps
;
for
(
int32_t
i
=
0
;
i
<
pVgroupInfo
->
numOfIps
;
++
i
)
{
str
cpy
(
pIpList
->
fqdn
[
i
],
pVgroupInfo
->
ipAddr
[
i
].
fqdn
);
pIp
Lis
t
->
port
[
i
]
=
pVgroupInfo
->
ipAddr
[
i
].
port
;
pIpSet
->
inUse
=
0
;
pIp
Set
->
numOfIps
=
pVgroupInfo
->
numOfIps
;
for
(
int32_t
i
=
0
;
i
<
pVgroupInfo
->
numOfIps
;
++
i
)
{
str
ncpy
(
pIpSet
->
fqdn
[
i
],
pVgroupInfo
->
ipAddr
[
i
].
fqdn
,
TSDB_FQDN_LEN
);
pIp
Se
t
->
port
[
i
]
=
pVgroupInfo
->
ipAddr
[
i
].
port
;
}
taosCorEndRead
(
&
pVgroupInfo
->
version
);
}
static
void
tscSetVgroupInfoWithIpSet
(
SCMVgroupInfo
*
pVgroupInfo
,
SRpcIpSet
*
pIpSet
)
{
taosCorBeginWrite
(
&
pVgroupInfo
->
version
);
//TODO(dengyihao), dont care vgid
pVgroupInfo
->
numOfIps
=
pIpSet
->
numOfIps
;
for
(
int32_t
i
=
0
;
pVgroupInfo
->
numOfIps
;
i
++
)
{
strncpy
(
pVgroupInfo
->
ipAddr
[
i
].
fqdn
,
pIpSet
->
fqdn
[
i
],
TSDB_FQDN_LEN
);
pVgroupInfo
->
ipAddr
[
i
].
port
=
pIpSet
->
port
[
i
];
}
taosCorEndWrite
(
&
pVgroupInfo
->
version
);
}
static
void
tscSetVgroupInfo
(
SSqlObj
*
pObj
,
SRpcIpSet
*
pIpSet
)
{
if
(
tscIpSetIsEqual
(
&
pObj
->
ipList
,
pIpSet
))
{
return
;
}
SSqlCmd
*
pCmd
=
&
pObj
->
cmd
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
tscSetVgroupInfoWithIpSet
(
&
pTableMetaInfo
->
pTableMeta
->
vgroupInfo
,
pIpSet
);
}
void
tscPrintMgmtIp
()
{
SRpcIpSet
dump
;
tscDumpMgmtIpSet
(
&
dump
);
...
...
@@ -263,7 +279,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
}
if
(
pCmd
->
command
<
TSDB_SQL_MGMT
)
{
if
(
pIpSet
)
pSql
->
ipList
=
*
pIpSet
;
if
(
pIpSet
)
tscSetVgroupInfo
(
pSql
,
pIpSet
);
}
else
{
if
(
pIpSet
)
tscSetMgmtIpList
(
pIpSet
);
}
...
...
@@ -553,7 +569,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
// pSql->cmd.payloadLen is set during copying data into payload
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_SUBMIT
;
tsc
SetDnodeIpList
(
pSql
,
&
pTableMeta
->
vgroupInfo
);
tsc
DumpIpSetFromVgroupInfo
(
&
pTableMeta
->
vgroupInfo
,
&
pSql
->
ipList
,
NULL
);
tscDebug
(
"%p build submit msg, vgId:%d numOfTables:%d numberOfIP:%d"
,
pSql
,
vgId
,
pSql
->
cmd
.
numOfTablesInSubmit
,
pSql
->
ipList
.
numOfIps
);
...
...
@@ -595,11 +611,9 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
}
else
{
pVgroupInfo
=
&
pTableMeta
->
vgroupInfo
;
}
tscSetDnodeIpList
(
pSql
,
pVgroupInfo
);
if
(
pVgroupInfo
!=
NULL
)
{
pQueryMsg
->
head
.
vgId
=
htonl
(
pVgroupInfo
->
vgId
);
}
int32_t
vgId
=
0
;
tscDumpIpSetFromVgroupInfo
(
pVgroupInfo
,
&
pSql
->
ipList
,
&
vgId
);
pQueryMsg
->
head
.
vgId
=
htonl
(
vgId
);
STableIdInfo
*
pTableIdInfo
=
(
STableIdInfo
*
)
pMsg
;
pTableIdInfo
->
tid
=
htonl
(
pTableMeta
->
sid
);
...
...
@@ -618,8 +632,9 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
SVgroupTableInfo
*
pTableIdList
=
taosArrayGet
(
pTableMetaInfo
->
pVgroupTables
,
index
);
// set the vgroup info
tscSetDnodeIpList
(
pSql
,
&
pTableIdList
->
vgInfo
);
pQueryMsg
->
head
.
vgId
=
htonl
(
pTableIdList
->
vgInfo
.
vgId
);
int32_t
vgId
=
0
;
tscDumpIpSetFromVgroupInfo
(
&
pTableIdList
->
vgInfo
,
&
pSql
->
ipList
,
&
vgId
);
pQueryMsg
->
head
.
vgId
=
htonl
(
vgId
);
int32_t
numOfTables
=
taosArrayGetSize
(
pTableIdList
->
itemList
);
pQueryMsg
->
numOfTables
=
htonl
(
numOfTables
);
// set the number of tables
...
...
@@ -1351,7 +1366,7 @@ int tscBuildUpdateTagMsg(SSqlObj* pSql, SSqlInfo *pInfo) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
tsc
SetDnodeIpList
(
pSql
,
&
pTableMetaInfo
->
pTableMeta
->
vgroupInfo
);
tsc
DumpIpSetFromVgroupInfo
(
&
pTableMetaInfo
->
pTableMeta
->
vgroupInfo
,
&
pSql
->
ipList
,
NULL
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1875,11 +1890,11 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
memcpy
(
pInfo
->
vgroupList
,
pVgroupInfo
,
size
);
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgroupList
->
numOfVgroups
;
++
j
)
{
//just init, no need to lock
SCMVgroupInfo
*
pVgroups
=
&
pInfo
->
vgroupList
->
vgroups
[
j
];
pVgroups
->
version
=
0
;
pVgroups
->
vgId
=
htonl
(
pVgroups
->
vgId
);
assert
(
pVgroups
->
numOfIps
>=
1
);
for
(
int32_t
k
=
0
;
k
<
pVgroups
->
numOfIps
;
++
k
)
{
pVgroups
->
ipAddr
[
k
].
port
=
htons
(
pVgroups
->
ipAddr
[
k
].
port
);
}
...
...
src/inc/taosmsg.h
浏览文件 @
3d10b6f8
...
...
@@ -647,6 +647,7 @@ typedef struct SCMSTableVgroupMsg {
}
SCMSTableVgroupMsg
,
SCMSTableVgroupRspMsg
;
typedef
struct
{
int32_t
version
;
int32_t
vgId
;
int8_t
numOfIps
;
SIpAddr
ipAddr
[
TSDB_MAX_REPLICA
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录