Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
44dc05f3
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
44dc05f3
编写于
4月 23, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more refact meta
上级
3ed29b7b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
110 addition
and
16 deletion
+110
-16
include/common/tmsg.h
include/common/tmsg.h
+11
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+48
-0
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-1
source/dnode/vnode/src/vnd/vnodeCfg.c
source/dnode/vnode/src/vnd/vnodeCfg.c
+3
-3
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+1
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+38
-2
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+8
-8
未找到文件。
include/common/tmsg.h
浏览文件 @
44dc05f3
...
...
@@ -1558,13 +1558,23 @@ typedef struct {
int32_t
code
;
}
SVCreateTbRsp
,
SVUpdateTbRsp
;
int
tEncodeSVCreateTbRsp
(
SCoder
*
pCoder
,
const
SVCreateTbRsp
*
pRsp
);
int
tDecodeSVCreateTbRsp
(
SCoder
*
pCoder
,
SVCreateTbRsp
*
pRsp
);
int32_t
tSerializeSVCreateTbReq
(
void
**
buf
,
SVCreateTbReq
*
pReq
);
void
*
tDeserializeSVCreateTbReq
(
void
*
buf
,
SVCreateTbReq
*
pReq
);
typedef
struct
{
SArray
*
rspList
;
// SArray<SVCreateTbRsp>
int32_t
nRsps
;
union
{
SVCreateTbRsp
*
pRsps
;
SArray
*
pArray
;
};
}
SVCreateTbBatchRsp
;
int
tEncodeSVCreateTbBatchRsp
(
SCoder
*
pCoder
,
const
SVCreateTbBatchRsp
*
pRsp
);
int
tDecodeSVCreateTbBatchRsp
(
SCoder
*
pCoder
,
SVCreateTbBatchRsp
*
pRsp
);
int32_t
tSerializeSVCreateTbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SVCreateTbBatchRsp
*
pRsp
);
int32_t
tDeserializeSVCreateTbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SVCreateTbBatchRsp
*
pRsp
);
...
...
source/common/src/tmsg.c
浏览文件 @
44dc05f3
...
...
@@ -3418,6 +3418,36 @@ int32_t tDeserializeSVCreateTbBatchRsp(void *buf, int32_t bufLen, SVCreateTbBatc
return
0
;
}
int
tEncodeSVCreateTbBatchRsp
(
SCoder
*
pCoder
,
const
SVCreateTbBatchRsp
*
pRsp
)
{
int32_t
nRsps
=
taosArrayGetSize
(
pRsp
->
pArray
);
SVCreateTbRsp
*
pCreateRsp
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pCoder
,
nRsps
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
nRsps
;
i
++
)
{
pCreateRsp
=
taosArrayGet
(
pRsp
->
pArray
,
i
);
if
(
tEncodeSVCreateTbRsp
(
pCoder
,
pCreateRsp
)
<
0
)
return
-
1
;
}
tEndEncode
(
pCoder
);
return
0
;
}
int
tDecodeSVCreateTbBatchRsp
(
SCoder
*
pCoder
,
SVCreateTbBatchRsp
*
pRsp
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pRsp
->
nRsps
)
<
0
)
return
-
1
;
pRsp
->
pRsps
=
(
SVCreateTbRsp
*
)
TCODER_MALLOC
(
pCoder
,
sizeof
(
*
pRsp
->
pRsps
)
*
pRsp
->
nRsps
);
for
(
int32_t
i
=
0
;
i
<
pRsp
->
nRsps
;
i
++
)
{
if
(
tDecodeSVCreateTbRsp
(
pCoder
,
pRsp
->
pRsps
+
i
)
<
0
)
return
-
1
;
}
tEndDecode
(
pCoder
);
return
0
;
}
int32_t
tSerializeSVCreateTSmaReq
(
void
**
buf
,
SVCreateTSmaReq
*
pReq
)
{
int32_t
tlen
=
0
;
...
...
@@ -3642,6 +3672,24 @@ int tDecodeSVCreateTbBatchReq(SCoder *pCoder, SVCreateTbBatchReq *pReq) {
if
(
tDecodeSVCreateTbReq
(
pCoder
,
pReq
->
pReqs
+
iReq
)
<
0
)
return
-
1
;
}
tEndDecode
(
pCoder
);
return
0
;
}
int
tEncodeSVCreateTbRsp
(
SCoder
*
pCoder
,
const
SVCreateTbRsp
*
pRsp
)
{
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pRsp
->
code
)
<
0
)
return
-
1
;
tEndEncode
(
pCoder
);
return
0
;
}
int
tDecodeSVCreateTbRsp
(
SCoder
*
pCoder
,
SVCreateTbRsp
*
pRsp
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pRsp
->
code
)
<
0
)
return
-
1
;
tEndDecode
(
pCoder
);
return
0
;
}
\ No newline at end of file
source/dnode/vnode/inc/vnode.h
浏览文件 @
44dc05f3
...
...
@@ -58,7 +58,7 @@ int32_t vnodeAlter(SVnode *pVnode, const SVnodeCfg *pCfg);
int32_t
vnodeCompact
(
SVnode
*
pVnode
);
int32_t
vnodeSync
(
SVnode
*
pVnode
);
int32_t
vnodeGetLoad
(
SVnode
*
pVnode
,
SVnodeLoad
*
pLoad
);
int
vnodeValidateTableHash
(
SVnode
Cfg
*
pVnodeOptions
,
char
*
tableFName
);
int
vnodeValidateTableHash
(
SVnode
*
pVnode
,
char
*
tableFName
);
// meta
typedef
struct
SMeta
SMeta
;
// todo: remove
...
...
source/dnode/vnode/src/vnd/vnodeCfg.c
浏览文件 @
44dc05f3
...
...
@@ -126,10 +126,10 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
return
0
;
}
int
vnodeValidateTableHash
(
SVnode
Cfg
*
pVnodeOptions
,
char
*
tableFName
)
{
int
vnodeValidateTableHash
(
SVnode
*
pVnode
,
char
*
tableFName
)
{
uint32_t
hashValue
=
0
;
switch
(
pVnode
Options
->
hashMethod
)
{
switch
(
pVnode
->
config
.
hashMethod
)
{
default:
hashValue
=
MurmurHash3_32
(
tableFName
,
strlen
(
tableFName
));
break
;
...
...
@@ -143,5 +143,5 @@ int vnodeValidateTableHash(SVnodeCfg *pVnodeOptions, char *tableFName) {
}
#endif
return
TSDB_CODE_SUCCESS
;
return
0
;
}
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
44dc05f3
...
...
@@ -42,7 +42,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
memcpy
(
metaRsp
.
dbFName
,
infoReq
.
dbFName
,
sizeof
(
metaRsp
.
dbFName
));
metaRsp
.
dbId
=
pVnode
->
config
.
dbId
;
sprintf
(
tableFName
,
"%s.%s"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
code
=
vnodeValidateTableHash
(
&
pVnode
->
config
,
tableFName
);
code
=
vnodeValidateTableHash
(
pVnode
,
tableFName
);
if
(
code
)
{
goto
_exit
;
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
44dc05f3
...
...
@@ -249,8 +249,14 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
int
rcode
=
0
;
SVCreateTbBatchReq
req
=
{
0
};
SVCreateTbReq
*
pCreateReq
;
SVCreateTbBatchRsp
rsp
=
{
0
};
SVCreateTbRsp
cRsp
=
{
0
};
char
tbName
[
TSDB_TABLE_FNAME_LEN
];
pRsp
->
msgType
=
TDMT_VND_CREATE_TABLE_RSP
;
pRsp
->
code
=
TSDB_CODE_SUCCESS
;
pRsp
->
pCont
=
NULL
;
pRsp
->
contLen
=
0
;
// decode
tCoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pReq
,
len
,
TD_DECODER
);
...
...
@@ -260,17 +266,47 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
goto
_exit
;
}
rsp
.
pArray
=
taosArrayInit
(
sizeof
(
cRsp
),
req
.
nReqs
);
if
(
rsp
.
pArray
==
NULL
)
{
rcode
=
-
1
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
// loop to create table
for
(
int
iReq
=
0
;
iReq
<
req
.
nReqs
;
iReq
++
)
{
pCreateReq
=
req
.
pReqs
+
iReq
;
// validate hash
sprintf
(
tbName
,
"%s.%s"
,
pVnode
->
config
.
dbname
,
pCreateReq
->
name
);
if
(
vnodeValidateTableHash
(
pVnode
,
tbName
)
<
0
)
{
cRsp
.
code
=
TSDB_CODE_VND_HASH_MISMATCH
;
taosArrayPush
(
rsp
.
pArray
,
&
cRsp
);
continue
;
}
// do create table
if
(
metaCreateTable
(
pVnode
->
pMeta
,
version
,
pCreateReq
)
<
0
)
{
// TODO: fill request
cRsp
.
code
=
terrno
;
}
else
{
// TODO
cRsp
.
code
=
TSDB_CODE_SUCCESS
;
}
taosArrayPush
(
rsp
.
pArray
,
&
cRsp
);
}
tCoderClear
(
&
coder
);
// prepare rsp
tEncodeSize
(
tEncodeSVCreateTbBatchRsp
,
&
rsp
,
pRsp
->
contLen
);
pRsp
->
pCont
=
rpcMallocCont
(
pRsp
->
contLen
);
if
(
pRsp
->
pCont
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
rcode
=
-
1
;
goto
_exit
;
}
tCoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pRsp
->
pCont
,
pRsp
->
contLen
,
TD_ENCODER
);
tEncodeSVCreateTbBatchRsp
(
&
coder
,
&
rsp
);
_exit:
tCoderClear
(
&
coder
);
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
44dc05f3
...
...
@@ -1076,17 +1076,17 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch
SVCreateTbBatchRsp
batchRsp
=
{
0
};
if
(
msg
)
{
SCH_ERR_JRET
(
tDeserializeSVCreateTbBatchRsp
(
msg
,
msgSize
,
&
batchRsp
));
if
(
batchRsp
.
rspList
)
{
int32_t
num
=
taosArrayGetSize
(
batchRsp
.
rspList
);
if
(
batchRsp
.
pArray
)
{
int32_t
num
=
taosArrayGetSize
(
batchRsp
.
pArray
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SVCreateTbRsp
*
rsp
=
taosArrayGet
(
batchRsp
.
rspList
,
i
);
SVCreateTbRsp
*
rsp
=
taosArrayGet
(
batchRsp
.
pArray
,
i
);
if
(
NEED_CLIENT_HANDLE_ERROR
(
rsp
->
code
))
{
taosArrayDestroy
(
batchRsp
.
rspList
);
taosArrayDestroy
(
batchRsp
.
pArray
);
SCH_ERR_JRET
(
rsp
->
code
);
}
}
taosArrayDestroy
(
batchRsp
.
rspList
);
taosArrayDestroy
(
batchRsp
.
pArray
);
}
}
...
...
@@ -2734,7 +2734,7 @@ void schedulerFreeTaskList(SArray *taskList) {
void
schedulerDestroy
(
void
)
{
if
(
schMgmt
.
jobRef
)
{
SSchJob
*
pJob
=
taosIterateRef
(
schMgmt
.
jobRef
,
0
);
int64_t
refId
=
0
;
int64_t
refId
=
0
;
while
(
pJob
)
{
refId
=
pJob
->
refId
;
...
...
@@ -2751,12 +2751,12 @@ void schedulerDestroy(void) {
}
if
(
schMgmt
.
hbConnections
)
{
void
*
pIter
=
taosHashIterate
(
schMgmt
.
hbConnections
,
NULL
);
void
*
pIter
=
taosHashIterate
(
schMgmt
.
hbConnections
,
NULL
);
while
(
pIter
!=
NULL
)
{
SSchHbTrans
*
hb
=
pIter
;
schFreeRpcCtx
(
&
hb
->
rpcCtx
);
pIter
=
taosHashIterate
(
schMgmt
.
hbConnections
,
pIter
);
}
}
taosHashCleanup
(
schMgmt
.
hbConnections
);
schMgmt
.
hbConnections
=
NULL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录