Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Rattenking
TDengine
提交
3c4e620f
T
TDengine
项目概览
Rattenking
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3c4e620f
编写于
7月 18, 2020
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bugfix
上级
a28e9a94
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
27 deletion
+50
-27
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+9
-1
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+12
-4
src/client/src/tscServer.c
src/client/src/tscServer.c
+29
-20
src/inc/taosmsg.h
src/inc/taosmsg.h
+0
-2
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
3c4e620f
...
@@ -52,12 +52,20 @@ typedef struct STableComInfo {
...
@@ -52,12 +52,20 @@ typedef struct STableComInfo {
int32_t
rowSize
;
int32_t
rowSize
;
}
STableComInfo
;
}
STableComInfo
;
typedef
struct
SCMCorVgroupInfo
{
int32_t
version
;
int8_t
inUse
;
int8_t
numOfIps
;
SIpAddr
ipAddr
[
TSDB_MAX_REPLICA
];
}
SCMCorVgroupInfo
;
typedef
struct
STableMeta
{
typedef
struct
STableMeta
{
STableComInfo
tableInfo
;
STableComInfo
tableInfo
;
uint8_t
tableType
;
uint8_t
tableType
;
int16_t
sversion
;
int16_t
sversion
;
int16_t
tversion
;
int16_t
tversion
;
SCMVgroupInfo
vgroupInfo
;
SCMVgroupInfo
vgroupInfo
;
SCMCorVgroupInfo
corVgroupInfo
;
int32_t
sid
;
// the index of one table in a virtual node
int32_t
sid
;
// the index of one table in a virtual node
uint64_t
uid
;
// unique id of a table
uint64_t
uid
;
// unique id of a table
SSchema
schema
[];
// if the table is TSDB_CHILD_TABLE, schema is acquired by super table meta info
SSchema
schema
[];
// if the table is TSDB_CHILD_TABLE, schema is acquired by super table meta info
...
...
src/client/src/tscSchemaUtil.c
浏览文件 @
3c4e620f
...
@@ -140,7 +140,15 @@ struct SSchema tscGetTbnameColumnSchema() {
...
@@ -140,7 +140,15 @@ struct SSchema tscGetTbnameColumnSchema() {
strcpy
(
s
.
name
,
TSQL_TBNAME_L
);
strcpy
(
s
.
name
,
TSQL_TBNAME_L
);
return
s
;
return
s
;
}
}
static
void
tscInitCorVgroupInfo
(
SCMCorVgroupInfo
*
corVgroupInfo
,
SCMVgroupInfo
*
vgroupInfo
)
{
corVgroupInfo
->
version
=
0
;
corVgroupInfo
->
inUse
=
0
;
corVgroupInfo
->
numOfIps
=
vgroupInfo
->
numOfIps
;
for
(
int32_t
i
=
0
;
i
<
corVgroupInfo
->
numOfIps
;
i
++
)
{
strncpy
(
corVgroupInfo
->
ipAddr
[
i
].
fqdn
,
vgroupInfo
->
ipAddr
[
i
].
fqdn
,
TSDB_FQDN_LEN
);
corVgroupInfo
->
ipAddr
[
i
].
port
=
vgroupInfo
->
ipAddr
[
i
].
port
;
}
}
STableMeta
*
tscCreateTableMetaFromMsg
(
STableMetaMsg
*
pTableMetaMsg
,
size_t
*
size
)
{
STableMeta
*
tscCreateTableMetaFromMsg
(
STableMetaMsg
*
pTableMetaMsg
,
size_t
*
size
)
{
assert
(
pTableMetaMsg
!=
NULL
);
assert
(
pTableMetaMsg
!=
NULL
);
...
@@ -157,9 +165,9 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size
...
@@ -157,9 +165,9 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size
pTableMeta
->
sid
=
pTableMetaMsg
->
sid
;
pTableMeta
->
sid
=
pTableMetaMsg
->
sid
;
pTableMeta
->
uid
=
pTableMetaMsg
->
uid
;
pTableMeta
->
uid
=
pTableMetaMsg
->
uid
;
pTableMeta
->
vgroupInfo
=
pTableMetaMsg
->
vgroup
;
pTableMeta
->
vgroupInfo
=
pTableMetaMsg
->
vgroup
;
//init version here
pTableMeta
->
vgroupInfo
.
version
=
0
;
tscInitCorVgroupInfo
(
&
pTableMeta
->
corVgroupInfo
,
&
pTableMeta
->
vgroupInfo
);
pTableMeta
->
sversion
=
pTableMetaMsg
->
sversion
;
pTableMeta
->
sversion
=
pTableMetaMsg
->
sversion
;
pTableMeta
->
tversion
=
pTableMetaMsg
->
tversion
;
pTableMeta
->
tversion
=
pTableMetaMsg
->
tversion
;
...
...
src/client/src/tscServer.c
浏览文件 @
3c4e620f
...
@@ -45,6 +45,20 @@ void tscSaveSubscriptionProgress(void* sub);
...
@@ -45,6 +45,20 @@ void tscSaveSubscriptionProgress(void* sub);
static
int32_t
minMsgSize
()
{
return
tsRpcHeadSize
+
100
;
}
static
int32_t
minMsgSize
()
{
return
tsRpcHeadSize
+
100
;
}
static
void
tscSetDnodeIpList
(
SSqlObj
*
pSql
,
SCMVgroupInfo
*
pVgroupInfo
)
{
SRpcIpSet
*
pIpList
=
&
pSql
->
ipList
;
pIpList
->
inUse
=
0
;
if
(
pVgroupInfo
==
NULL
)
{
pIpList
->
numOfIps
=
0
;
return
;
}
pIpList
->
numOfIps
=
pVgroupInfo
->
numOfIps
;
for
(
int32_t
i
=
0
;
i
<
pVgroupInfo
->
numOfIps
;
++
i
)
{
strcpy
(
pIpList
->
fqdn
[
i
],
pVgroupInfo
->
ipAddr
[
i
].
fqdn
);
pIpList
->
port
[
i
]
=
pVgroupInfo
->
ipAddr
[
i
].
port
;
}
}
void
tscIpSetCopy
(
SRpcIpSet
*
dst
,
SRpcIpSet
*
src
)
{
void
tscIpSetCopy
(
SRpcIpSet
*
dst
,
SRpcIpSet
*
src
)
{
dst
->
numOfIps
=
src
->
numOfIps
;
dst
->
numOfIps
=
src
->
numOfIps
;
dst
->
inUse
=
src
->
inUse
;
dst
->
inUse
=
src
->
inUse
;
...
@@ -83,12 +97,9 @@ void tscUpdateMgmtIpList(SRpcIpSet *pIpSet) {
...
@@ -83,12 +97,9 @@ void tscUpdateMgmtIpList(SRpcIpSet *pIpSet) {
tscIpSetCopy
(
mgmtIpSet
,
pIpSet
);
tscIpSetCopy
(
mgmtIpSet
,
pIpSet
);
taosCorEndWrite
(
&
tscMgmtIpSet
.
version
);
taosCorEndWrite
(
&
tscMgmtIpSet
.
version
);
}
}
static
void
tscDumpIpSetFromVgroupInfo
(
SCM
VgroupInfo
*
pVgroupInfo
,
SRpcIpSet
*
pIpSet
,
int32_t
*
vgId
)
{
static
void
tscDumpIpSetFromVgroupInfo
(
SCM
CorVgroupInfo
*
pVgroupInfo
,
SRpcIpSet
*
pIpSet
)
{
if
(
pVgroupInfo
==
NULL
)
{
return
;}
if
(
pVgroupInfo
==
NULL
)
{
return
;}
//taosCorBeginRead(&pVgroupInfo->version);
taosCorBeginRead
(
&
pVgroupInfo
->
version
);
if
(
vgId
)
{
*
vgId
=
pVgroupInfo
->
vgId
;
}
int8_t
inUse
=
pVgroupInfo
->
inUse
;
int8_t
inUse
=
pVgroupInfo
->
inUse
;
pIpSet
->
inUse
=
(
inUse
>=
0
&&
inUse
<
TSDB_MAX_REPLICA
)
?
inUse
:
0
;
pIpSet
->
inUse
=
(
inUse
>=
0
&&
inUse
<
TSDB_MAX_REPLICA
)
?
inUse
:
0
;
pIpSet
->
numOfIps
=
pVgroupInfo
->
numOfIps
;
pIpSet
->
numOfIps
=
pVgroupInfo
->
numOfIps
;
...
@@ -96,16 +107,16 @@ static void tscDumpIpSetFromVgroupInfo(SCMVgroupInfo *pVgroupInfo, SRpcIpSet *pI
...
@@ -96,16 +107,16 @@ static void tscDumpIpSetFromVgroupInfo(SCMVgroupInfo *pVgroupInfo, SRpcIpSet *pI
strncpy
(
pIpSet
->
fqdn
[
i
],
pVgroupInfo
->
ipAddr
[
i
].
fqdn
,
TSDB_FQDN_LEN
);
strncpy
(
pIpSet
->
fqdn
[
i
],
pVgroupInfo
->
ipAddr
[
i
].
fqdn
,
TSDB_FQDN_LEN
);
pIpSet
->
port
[
i
]
=
pVgroupInfo
->
ipAddr
[
i
].
port
;
pIpSet
->
port
[
i
]
=
pVgroupInfo
->
ipAddr
[
i
].
port
;
}
}
//
taosCorEndRead(&pVgroupInfo->version);
taosCorEndRead
(
&
pVgroupInfo
->
version
);
}
}
static
void
tscUpdateVgroupInfo
(
SSqlObj
*
pObj
,
SRpcIpSet
*
pIpSet
)
{
static
void
tscUpdateVgroupInfo
(
SSqlObj
*
pObj
,
SRpcIpSet
*
pIpSet
)
{
SSqlCmd
*
pCmd
=
&
pObj
->
cmd
;
SSqlCmd
*
pCmd
=
&
pObj
->
cmd
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
if
(
pTableMetaInfo
==
NULL
||
pTableMetaInfo
->
pTableMeta
==
NULL
)
{
return
;}
if
(
pTableMetaInfo
==
NULL
||
pTableMetaInfo
->
pTableMeta
==
NULL
)
{
return
;}
SCM
VgroupInfo
*
pVgroupInfo
=
&
pTableMetaInfo
->
pTableMeta
->
v
groupInfo
;
SCM
CorVgroupInfo
*
pVgroupInfo
=
&
pTableMetaInfo
->
pTableMeta
->
corV
groupInfo
;
//
taosCorBeginWrite(&pVgroupInfo->version);
taosCorBeginWrite
(
&
pVgroupInfo
->
version
);
//TODO(dengyihao), dont care vgid
//TODO(dengyihao), dont care vgid
pVgroupInfo
->
inUse
=
pIpSet
->
inUse
;
pVgroupInfo
->
inUse
=
pIpSet
->
inUse
;
pVgroupInfo
->
numOfIps
=
pIpSet
->
numOfIps
;
pVgroupInfo
->
numOfIps
=
pIpSet
->
numOfIps
;
...
@@ -113,7 +124,7 @@ static void tscUpdateVgroupInfo(SSqlObj *pObj, SRpcIpSet *pIpSet) {
...
@@ -113,7 +124,7 @@ static void tscUpdateVgroupInfo(SSqlObj *pObj, SRpcIpSet *pIpSet) {
strncpy
(
pVgroupInfo
->
ipAddr
[
i
].
fqdn
,
pIpSet
->
fqdn
[
i
],
TSDB_FQDN_LEN
);
strncpy
(
pVgroupInfo
->
ipAddr
[
i
].
fqdn
,
pIpSet
->
fqdn
[
i
],
TSDB_FQDN_LEN
);
pVgroupInfo
->
ipAddr
[
i
].
port
=
pIpSet
->
port
[
i
];
pVgroupInfo
->
ipAddr
[
i
].
port
=
pIpSet
->
port
[
i
];
}
}
//
taosCorEndWrite(&pVgroupInfo->version);
taosCorEndWrite
(
&
pVgroupInfo
->
version
);
}
}
void
tscPrintMgmtIp
()
{
void
tscPrintMgmtIp
()
{
SRpcIpSet
dump
;
SRpcIpSet
dump
;
...
@@ -577,7 +588,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -577,7 +588,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
// pSql->cmd.payloadLen is set during copying data into payload
// pSql->cmd.payloadLen is set during copying data into payload
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_SUBMIT
;
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_SUBMIT
;
tscDumpIpSetFromVgroupInfo
(
&
pTableMeta
->
vgroupInfo
,
&
pSql
->
ipList
,
NULL
);
tscDumpIpSetFromVgroupInfo
(
&
pTableMeta
->
corVgroupInfo
,
&
pSql
->
ipList
);
tscDebug
(
"%p build submit msg, vgId:%d numOfTables:%d numberOfIP:%d"
,
pSql
,
vgId
,
pSql
->
cmd
.
numOfTablesInSubmit
,
tscDebug
(
"%p build submit msg, vgId:%d numOfTables:%d numberOfIP:%d"
,
pSql
,
vgId
,
pSql
->
cmd
.
numOfTablesInSubmit
,
pSql
->
ipList
.
numOfIps
);
pSql
->
ipList
.
numOfIps
);
...
@@ -619,9 +630,10 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
...
@@ -619,9 +630,10 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
}
else
{
}
else
{
pVgroupInfo
=
&
pTableMeta
->
vgroupInfo
;
pVgroupInfo
=
&
pTableMeta
->
vgroupInfo
;
}
}
int32_t
vgId
=
0
;
tscSetDnodeIpList
(
pSql
,
pVgroupInfo
);
tscDumpIpSetFromVgroupInfo
(
pVgroupInfo
,
&
pSql
->
ipList
,
&
vgId
);
if
(
pVgroupInfo
!=
NULL
)
{
pQueryMsg
->
head
.
vgId
=
htonl
(
vgId
);
pQueryMsg
->
head
.
vgId
=
htonl
(
pVgroupInfo
->
vgId
);
}
STableIdInfo
*
pTableIdInfo
=
(
STableIdInfo
*
)
pMsg
;
STableIdInfo
*
pTableIdInfo
=
(
STableIdInfo
*
)
pMsg
;
pTableIdInfo
->
tid
=
htonl
(
pTableMeta
->
sid
);
pTableIdInfo
->
tid
=
htonl
(
pTableMeta
->
sid
);
...
@@ -639,10 +651,9 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
...
@@ -639,10 +651,9 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
SVgroupTableInfo
*
pTableIdList
=
taosArrayGet
(
pTableMetaInfo
->
pVgroupTables
,
index
);
SVgroupTableInfo
*
pTableIdList
=
taosArrayGet
(
pTableMetaInfo
->
pVgroupTables
,
index
);
// set the vgroup info
// set the vgroup info
int32_t
vgId
=
0
;
tscSetDnodeIpList
(
pSql
,
&
pTableIdList
->
vgInfo
);
tscDumpIpSetFromVgroupInfo
(
&
pTableIdList
->
vgInfo
,
&
pSql
->
ipList
,
&
vgId
);
pQueryMsg
->
head
.
vgId
=
htonl
(
pTableIdList
->
vgInfo
.
vgId
);
pQueryMsg
->
head
.
vgId
=
htonl
(
vgId
);
int32_t
numOfTables
=
taosArrayGetSize
(
pTableIdList
->
itemList
);
int32_t
numOfTables
=
taosArrayGetSize
(
pTableIdList
->
itemList
);
pQueryMsg
->
numOfTables
=
htonl
(
numOfTables
);
// set the number of tables
pQueryMsg
->
numOfTables
=
htonl
(
numOfTables
);
// set the number of tables
...
@@ -1374,7 +1385,7 @@ int tscBuildUpdateTagMsg(SSqlObj* pSql, SSqlInfo *pInfo) {
...
@@ -1374,7 +1385,7 @@ int tscBuildUpdateTagMsg(SSqlObj* pSql, SSqlInfo *pInfo) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
tscDumpIpSetFromVgroupInfo
(
&
pTableMetaInfo
->
pTableMeta
->
vgroupInfo
,
&
pSql
->
ipList
,
NULL
);
tscDumpIpSetFromVgroupInfo
(
&
pTableMetaInfo
->
pTableMeta
->
corVgroupInfo
,
&
pSql
->
ipList
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1900,8 +1911,6 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
...
@@ -1900,8 +1911,6 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgroupList
->
numOfVgroups
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgroupList
->
numOfVgroups
;
++
j
)
{
//just init, no need to lock
//just init, no need to lock
SCMVgroupInfo
*
pVgroups
=
&
pInfo
->
vgroupList
->
vgroups
[
j
];
SCMVgroupInfo
*
pVgroups
=
&
pInfo
->
vgroupList
->
vgroups
[
j
];
pVgroups
->
version
=
0
;
pVgroups
->
inUse
=
0
;
pVgroups
->
vgId
=
htonl
(
pVgroups
->
vgId
);
pVgroups
->
vgId
=
htonl
(
pVgroups
->
vgId
);
assert
(
pVgroups
->
numOfIps
>=
1
);
assert
(
pVgroups
->
numOfIps
>=
1
);
for
(
int32_t
k
=
0
;
k
<
pVgroups
->
numOfIps
;
++
k
)
{
for
(
int32_t
k
=
0
;
k
<
pVgroups
->
numOfIps
;
++
k
)
{
...
...
src/inc/taosmsg.h
浏览文件 @
3c4e620f
...
@@ -647,9 +647,7 @@ typedef struct SCMSTableVgroupMsg {
...
@@ -647,9 +647,7 @@ typedef struct SCMSTableVgroupMsg {
}
SCMSTableVgroupMsg
,
SCMSTableVgroupRspMsg
;
}
SCMSTableVgroupMsg
,
SCMSTableVgroupRspMsg
;
typedef
struct
{
typedef
struct
{
int32_t
version
;
int32_t
vgId
;
int32_t
vgId
;
int8_t
inUse
;
int8_t
numOfIps
;
int8_t
numOfIps
;
SIpAddr
ipAddr
[
TSDB_MAX_REPLICA
];
SIpAddr
ipAddr
[
TSDB_MAX_REPLICA
];
}
SCMVgroupInfo
;
}
SCMVgroupInfo
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录