Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d8093c91
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看板
提交
d8093c91
编写于
6月 01, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
alter table return meta
上级
6aece127
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
379 addition
and
123 deletion
+379
-123
include/common/tmsg.h
include/common/tmsg.h
+6
-1
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+1
-1
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+2
-1
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+27
-0
source/client/src/clientHb.c
source/client/src/clientHb.c
+1
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+88
-65
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+22
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+84
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+50
-0
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-1
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+23
-3
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+20
-7
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+1
-1
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+33
-24
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+12
-12
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+1
-1
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+5
-5
source/libs/scheduler/src/schRemote.c
source/libs/scheduler/src/schRemote.c
+2
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
d8093c91
...
...
@@ -1131,6 +1131,10 @@ typedef struct {
SSchema
*
pSchemas
;
}
STableMetaRsp
;
typedef
struct
{
STableMetaRsp
*
pMeta
;
}
SMAlterStbRsp
;
int32_t
tSerializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
);
int32_t
tDeserializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
);
void
tFreeSTableMetaRsp
(
STableMetaRsp
*
pRsp
);
...
...
@@ -1875,7 +1879,8 @@ int32_t tEncodeSVAlterTbReq(SEncoder* pEncoder, const SVAlterTbReq* pReq);
int32_t
tDecodeSVAlterTbReq
(
SDecoder
*
pDecoder
,
SVAlterTbReq
*
pReq
);
typedef
struct
{
int32_t
code
;
int32_t
code
;
STableMetaRsp
*
pMeta
;
}
SVAlterTbRsp
;
int32_t
tEncodeSVAlterTbRsp
(
SEncoder
*
pEncoder
,
const
SVAlterTbRsp
*
pRsp
);
...
...
include/libs/catalog/catalog.h
浏览文件 @
d8093c91
...
...
@@ -183,7 +183,7 @@ int32_t catalogGetTableMeta(SCatalog* pCatalog, void * pTransporter, const SEpSe
*/
int32_t
catalogGetSTableMeta
(
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
int32_t
catalogUpdate
S
TableMeta
(
SCatalog
*
pCatalog
,
STableMetaRsp
*
rspMsg
);
int32_t
catalogUpdateTableMeta
(
SCatalog
*
pCatalog
,
STableMetaRsp
*
rspMsg
);
/**
...
...
source/client/inc/clientInt.h
浏览文件 @
d8093c91
...
...
@@ -162,6 +162,7 @@ typedef struct SResultColumn {
}
SResultColumn
;
typedef
struct
SReqResultInfo
{
void
*
pExecRes
;
const
char
*
pRspMsg
;
const
char
*
pData
;
TAOS_FIELD
*
fields
;
// todo, column names are not needed.
...
...
@@ -317,7 +318,7 @@ void hbMgrInitMqHbRspHandle();
SRequestObj
*
launchQueryImpl
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
int32_t
code
,
bool
keepQuery
,
void
**
res
);
int32_t
getQueryPlan
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
SArray
**
pNodeList
);
int32_t
scheduleQuery
(
SRequestObj
*
pRequest
,
SQueryPlan
*
pDag
,
SArray
*
pNodeList
,
void
**
res
);
int32_t
scheduleQuery
(
SRequestObj
*
pRequest
,
SQueryPlan
*
pDag
,
SArray
*
pNodeList
);
int32_t
refreshMeta
(
STscObj
*
pTscObj
,
SRequestObj
*
pRequest
);
int32_t
updateQnodeList
(
SAppInstInfo
*
pInfo
,
SArray
*
pNodeList
);
...
...
source/client/src/clientEnv.c
浏览文件 @
d8093c91
...
...
@@ -212,6 +212,31 @@ void doFreeReqResultInfo(SReqResultInfo *pResInfo) {
}
}
static
void
destroyExecRes
(
SRequestObj
*
pRequest
)
{
if
(
NULL
==
pRequest
||
NULL
==
pRequest
->
body
.
resInfo
.
pExecRes
)
{
return
;
}
switch
(
pRequest
->
type
)
{
case
TDMT_VND_ALTER_TABLE
:
case
TDMT_MND_ALTER_STB
:
{
tFreeSTableMetaRsp
((
STableMetaRsp
*
)
pRequest
->
body
.
resInfo
.
pExecRes
);
taosMemoryFree
(
pRequest
->
body
.
resInfo
.
pExecRes
);
break
;
}
case
TDMT_VND_SUBMIT
:
{
tFreeSSubmitRsp
((
SSubmitRsp
*
)
pRequest
->
body
.
resInfo
.
pExecRes
);
break
;
}
case
TDMT_VND_QUERY
:
{
taosArrayDestroy
((
SArray
*
)
pRequest
->
body
.
resInfo
.
pExecRes
);
break
;
}
default:
tscError
(
"invalid exec result for request type %d"
,
pRequest
->
type
);
}
}
static
void
doDestroyRequest
(
void
*
p
)
{
assert
(
p
!=
NULL
);
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
p
;
...
...
@@ -234,6 +259,8 @@ static void doDestroyRequest(void *p) {
taosArrayDestroy
(
pRequest
->
tableList
);
taosArrayDestroy
(
pRequest
->
dbList
);
destroyExecRes
(
pRequest
);
deregisterRequest
(
pRequest
);
taosMemoryFreeClear
(
pRequest
);
}
...
...
source/client/src/clientHb.c
浏览文件 @
d8093c91
...
...
@@ -120,7 +120,7 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
catalogUpdate
S
TableMeta
(
pCatalog
,
rsp
);
catalogUpdateTableMeta
(
pCatalog
,
rsp
);
}
}
...
...
source/client/src/clientImpl.c
浏览文件 @
d8093c91
...
...
@@ -386,18 +386,20 @@ int32_t scheduleAsyncQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNod
}
int32_t
scheduleQuery
(
SRequestObj
*
pRequest
,
SQueryPlan
*
pDag
,
SArray
*
pNodeList
,
void
**
pRes
)
{
int32_t
scheduleQuery
(
SRequestObj
*
pRequest
,
SQueryPlan
*
pDag
,
SArray
*
pNodeList
)
{
void
*
pTransporter
=
pRequest
->
pTscObj
->
pAppInfo
->
pTransporter
;
SQueryResult
res
=
{.
code
=
0
,
.
numOfRows
=
0
};
int32_t
code
=
schedulerExecJob
(
pTransporter
,
pNodeList
,
pDag
,
&
pRequest
->
body
.
queryJob
,
pRequest
->
sqlstr
,
pRequest
->
metric
.
start
,
&
res
);
pRequest
->
body
.
resInfo
.
pExecRes
=
res
.
res
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
pRequest
->
body
.
queryJob
!=
0
)
{
schedulerFreeJob
(
pRequest
->
body
.
queryJob
);
}
*
pRes
=
res
.
res
;
pRequest
->
code
=
code
;
terrno
=
code
;
...
...
@@ -412,8 +414,6 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
}
}
*
pRes
=
res
.
res
;
pRequest
->
code
=
res
.
code
;
terrno
=
res
.
code
;
return
pRequest
->
code
;
...
...
@@ -423,80 +423,104 @@ int32_t getQueryPlan(SRequestObj* pRequest, SQuery* pQuery, SArray** pNodeList)
return
getPlan
(
pRequest
,
pQuery
,
&
pRequest
->
body
.
pDag
,
pNodeList
);
}
int32_t
validateSversion
(
SRequestObj
*
pRequest
,
void
*
res
)
{
SArray
*
pArray
=
NULL
;
int32_t
handleSubmitExecRes
(
SRequestObj
*
pRequest
,
void
*
res
,
SCatalog
*
pCatalog
,
SEpSet
*
epset
)
{
int32_t
code
=
0
;
if
(
TDMT_VND_SUBMIT
==
pRequest
->
type
)
{
SSubmitRsp
*
pRsp
=
(
SSubmitRsp
*
)
res
;
if
(
pRsp
->
nBlocks
<=
0
)
{
return
TSDB_CODE_SUCCESS
;
}
pArray
=
taosArrayInit
(
pRsp
->
nBlocks
,
sizeof
(
STbSVersion
));
if
(
NULL
==
pArray
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
SArray
*
pArray
=
NULL
;
SSubmitRsp
*
pRsp
=
(
SSubmitRsp
*
)
res
;
if
(
pRsp
->
nBlocks
<=
0
)
{
return
TSDB_CODE_SUCCESS
;
}
pArray
=
taosArrayInit
(
pRsp
->
nBlocks
,
sizeof
(
STbSVersion
));
if
(
NULL
==
pArray
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
for
(
int32_t
i
=
0
;
i
<
pRsp
->
nBlocks
;
++
i
)
{
SSubmitBlkRsp
*
blk
=
pRsp
->
pBlocks
+
i
;
if
(
NULL
==
blk
->
tblFName
||
0
==
blk
->
tblFName
[
0
])
{
continue
;
}
STbSVersion
tbSver
=
{.
tbFName
=
blk
->
tblFName
,
.
sver
=
blk
->
sver
};
taosArrayPush
(
pArray
,
&
tbSver
);
}
for
(
int32_t
i
=
0
;
i
<
pRsp
->
nBlocks
;
++
i
)
{
SSubmitBlkRsp
*
blk
=
pRsp
->
pBlocks
+
i
;
if
(
NULL
==
blk
->
tblFName
||
0
==
blk
->
tblFName
[
0
])
{
continue
;
}
code
=
catalogChkTbMetaVersion
(
pCatalog
,
pRequest
->
pTscObj
->
pAppInfo
->
pTransporter
,
epset
,
pArray
);
STbSVersion
tbSver
=
{.
tbFName
=
blk
->
tblFName
,
.
sver
=
blk
->
sver
};
taosArrayPush
(
pArray
,
&
tbSver
);
}
}
else
if
(
TDMT_VND_QUERY
==
pRequest
->
type
)
{
SArray
*
pTbArray
=
(
SArray
*
)
res
;
int32_t
tbNum
=
taosArrayGetSize
(
pTbArray
);
if
(
tbNum
<=
0
)
{
return
TSDB_CODE_SUCCESS
;
}
_return:
pArray
=
taosArrayInit
(
tbNum
,
sizeof
(
STbSVersion
));
if
(
NULL
==
pArray
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
taosArrayDestroy
(
pArray
);
return
code
;
}
for
(
int32_t
i
=
0
;
i
<
tbNum
;
++
i
)
{
STbVerInfo
*
tbInfo
=
taosArrayGet
(
pTbArray
,
i
);
STbSVersion
tbSver
=
{.
tbFName
=
tbInfo
->
tbFName
,
.
sver
=
tbInfo
->
sversion
,
.
tver
=
tbInfo
->
tversion
};
taosArrayPush
(
pArray
,
&
tbSver
);
}
int32_t
handleQueryExecRes
(
SRequestObj
*
pRequest
,
void
*
res
,
SCatalog
*
pCatalog
,
SEpSet
*
epset
)
{
int32_t
code
=
0
;
SArray
*
pArray
=
NULL
;
SArray
*
pTbArray
=
(
SArray
*
)
res
;
int32_t
tbNum
=
taosArrayGetSize
(
pTbArray
);
if
(
tbNum
<=
0
)
{
return
TSDB_CODE_SUCCESS
;
}
pArray
=
taosArrayInit
(
tbNum
,
sizeof
(
STbSVersion
));
if
(
NULL
==
pArray
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
for
(
int32_t
i
=
0
;
i
<
tbNum
;
++
i
)
{
STbVerInfo
*
tbInfo
=
taosArrayGet
(
pTbArray
,
i
);
STbSVersion
tbSver
=
{.
tbFName
=
tbInfo
->
tbFName
,
.
sver
=
tbInfo
->
sversion
,
.
tver
=
tbInfo
->
tversion
};
taosArrayPush
(
pArray
,
&
tbSver
);
}
SCatalog
*
pCatalog
=
NULL
;
CHECK_CODE_GOTO
(
catalogGetHandle
(
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
&
pCatalog
),
_return
);
SEpSet
epset
=
getEpSet_s
(
&
pRequest
->
pTscObj
->
pAppInfo
->
mgmtEp
);
code
=
catalogChkTbMetaVersion
(
pCatalog
,
pRequest
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
epset
,
pArray
);
code
=
catalogChkTbMetaVersion
(
pCatalog
,
pRequest
->
pTscObj
->
pAppInfo
->
pTransporter
,
epset
,
pArray
);
_return:
taosArrayDestroy
(
pArray
);
return
code
;
}
return
code
;
int32_t
handleAlterTbExecRes
(
void
*
res
,
SCatalog
*
pCatalog
)
{
return
catalogUpdateTableMeta
(
pCatalog
,
(
STableMetaRsp
*
)
res
);
}
void
freeRequestRes
(
SRequestObj
*
pRequest
,
void
*
res
)
{
if
(
NULL
==
pRequest
||
NULL
==
res
)
{
return
;
int32_t
handleExecRes
(
SRequestObj
*
pRequest
)
{
int32_t
code
=
0
;
SCatalog
*
pCatalog
=
NULL
;
code
=
catalogGetHandle
(
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
&
pCatalog
);
if
(
code
)
{
return
code
;
}
SEpSet
epset
=
getEpSet_s
(
&
pRequest
->
pTscObj
->
pAppInfo
->
mgmtEp
);
if
(
TDMT_VND_SUBMIT
==
pRequest
->
type
)
{
tFreeSSubmitRsp
((
SSubmitRsp
*
)
res
);
}
else
if
(
TDMT_VND_QUERY
==
pRequest
->
type
)
{
taosArrayDestroy
((
SArray
*
)
res
);
switch
(
pRequest
->
type
)
{
case
TDMT_VND_ALTER_TABLE
:
case
TDMT_MND_ALTER_STB
:
{
code
=
handleAlterTbExecRes
(
pRequest
->
body
.
resInfo
.
pExecRes
,
pCatalog
);
break
;
}
case
TDMT_VND_SUBMIT
:
{
code
=
handleSubmitExecRes
(
pRequest
,
pRequest
->
body
.
resInfo
.
pExecRes
,
pCatalog
,
&
epset
);
break
;
}
case
TDMT_VND_QUERY
:
{
code
=
handleQueryExecRes
(
pRequest
,
pRequest
->
body
.
resInfo
.
pExecRes
,
pCatalog
,
&
epset
);
break
;
}
default:
tscError
(
"invalid exec result for request type %d"
,
pRequest
->
type
);
return
TSDB_CODE_APP_ERROR
;
}
return
code
;
}
SRequestObj
*
launchQueryImpl
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
int32_t
code
,
bool
keepQuery
,
void
**
res
)
{
void
*
pRes
=
NULL
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
switch
(
pQuery
->
execMode
)
{
case
QUERY_EXEC_MODE_LOCAL
:
...
...
@@ -509,10 +533,7 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, int32_t code
SArray
*
pNodeList
=
NULL
;
code
=
getPlan
(
pRequest
,
pQuery
,
&
pRequest
->
body
.
pDag
,
&
pNodeList
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
scheduleQuery
(
pRequest
,
pRequest
->
body
.
pDag
,
pNodeList
,
&
pRes
);
if
(
NULL
!=
pRes
)
{
code
=
validateSversion
(
pRequest
,
pRes
);
}
code
=
scheduleQuery
(
pRequest
,
pRequest
->
body
.
pDag
,
pNodeList
);
}
taosArrayDestroy
(
pNodeList
);
break
;
...
...
@@ -529,15 +550,17 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, int32_t code
qDestroyQuery
(
pQuery
);
}
if
(
NULL
!=
pRequest
->
body
.
resInfo
.
pExecRes
)
{
handleExecRes
(
pRequest
);
}
if
(
NULL
!=
pRequest
&&
TSDB_CODE_SUCCESS
!=
code
)
{
pRequest
->
code
=
terrno
;
}
if
(
res
)
{
*
res
=
pRes
;
}
else
{
freeRequestRes
(
pRequest
,
pRes
);
pRes
=
NULL
;
*
res
=
pRequest
->
body
.
resInfo
.
pExecRes
;
pRequest
->
body
.
resInfo
.
pExecRes
=
NULL
;
}
return
pRequest
;
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
d8093c91
...
...
@@ -223,10 +223,32 @@ int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
return
code
;
}
int32_t
processAlterStbRsp
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SRequestObj
*
pRequest
=
param
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
setErrno
(
pRequest
,
code
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
return
code
;
}
SMAlterStbRsp
alterRsp
=
{
0
};
SDecoder
coder
=
{
0
};
tDecoderInit
(
&
coder
,
pMsg
->
pData
,
pMsg
->
len
);
tDecodeSMAlterStbRsp
(
&
coder
,
&
alterRsp
);
tDecoderClear
(
&
coder
);
pRequest
->
body
.
resInfo
.
pExecRes
=
alterRsp
.
pMeta
;
tsem_post
(
&
pRequest
->
body
.
rspSem
);
return
code
;
}
void
initMsgHandleFp
()
{
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_CONNECT
)]
=
processConnectRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_CREATE_DB
)]
=
processCreateDbRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_USE_DB
)]
=
processUseDbRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_CREATE_STB
)]
=
processCreateTableRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_DROP_DB
)]
=
processDropDbRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_ALTER_STB
)]
=
processAlterStbRsp
;
}
source/common/src/tmsg.c
浏览文件 @
d8093c91
...
...
@@ -694,6 +694,7 @@ void tFreeSMAltertbReq(SMAlterStbReq *pReq) {
pReq
->
pFields
=
NULL
;
}
int32_t
tSerializeSEpSet
(
void
*
buf
,
int32_t
bufLen
,
const
SEpSet
*
pEpset
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
...
...
@@ -4348,13 +4349,96 @@ int32_t tDecodeSVAlterTbReq(SDecoder *pDecoder, SVAlterTbReq *pReq) {
int32_t
tEncodeSVAlterTbRsp
(
SEncoder
*
pEncoder
,
const
SVAlterTbRsp
*
pRsp
)
{
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
code
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
pMeta
?
1
:
0
)
<
0
)
return
-
1
;
if
(
pRsp
->
pMeta
)
{
if
(
tEncodeSTableMetaRsp
(
pEncoder
,
pRsp
->
pMeta
)
<
0
)
return
-
1
;
}
tEndEncode
(
pEncoder
);
return
0
;
}
int32_t
tDecodeSVAlterTbRsp
(
SDecoder
*
pDecoder
,
SVAlterTbRsp
*
pRsp
)
{
int32_t
meta
=
0
;
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
code
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
meta
)
<
0
)
return
-
1
;
if
(
meta
)
{
pRsp
->
pMeta
=
taosMemoryCalloc
(
1
,
sizeof
(
STableMetaRsp
));
if
(
NULL
==
pRsp
->
pMeta
)
return
-
1
;
if
(
tDecodeSTableMetaRsp
(
pDecoder
,
pRsp
->
pMeta
)
<
0
)
return
-
1
;
}
tEndDecode
(
pDecoder
);
return
0
;
}
int32_t
tDeserializeSVAlterTbRsp
(
void
*
buf
,
int32_t
bufLen
,
SVAlterTbRsp
*
pRsp
)
{
int32_t
meta
=
0
;
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
code
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
meta
)
<
0
)
return
-
1
;
if
(
meta
)
{
pRsp
->
pMeta
=
taosMemoryCalloc
(
1
,
sizeof
(
STableMetaRsp
));
if
(
NULL
==
pRsp
->
pMeta
)
return
-
1
;
if
(
tDecodeSTableMetaRsp
(
&
decoder
,
pRsp
->
pMeta
)
<
0
)
return
-
1
;
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tEncodeSMAlterStbRsp
(
SEncoder
*
pEncoder
,
const
SMAlterStbRsp
*
pRsp
)
{
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
pMeta
->
pSchemas
?
1
:
0
)
<
0
)
return
-
1
;
if
(
pRsp
->
pMeta
->
pSchemas
)
{
if
(
tEncodeSTableMetaRsp
(
pEncoder
,
pRsp
->
pMeta
)
<
0
)
return
-
1
;
}
tEndEncode
(
pEncoder
);
return
0
;
}
int32_t
tDecodeSMAlterStbRsp
(
SDecoder
*
pDecoder
,
SMAlterStbRsp
*
pRsp
)
{
int32_t
meta
=
0
;
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
meta
)
<
0
)
return
-
1
;
if
(
meta
)
{
pRsp
->
pMeta
=
taosMemoryCalloc
(
1
,
sizeof
(
STableMetaRsp
));
if
(
NULL
==
pRsp
->
pMeta
)
return
-
1
;
if
(
tDecodeSTableMetaRsp
(
pDecoder
,
pRsp
->
pMeta
)
<
0
)
return
-
1
;
}
tEndDecode
(
pDecoder
);
return
0
;
}
int32_t
tDeserializeSMAlterStbRsp
(
void
*
buf
,
int32_t
bufLen
,
SMAlterStbRsp
*
pRsp
)
{
int32_t
meta
=
0
;
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
meta
)
<
0
)
return
-
1
;
if
(
meta
)
{
pRsp
->
pMeta
=
taosMemoryCalloc
(
1
,
sizeof
(
STableMetaRsp
));
if
(
NULL
==
pRsp
->
pMeta
)
return
-
1
;
if
(
tDecodeSTableMetaRsp
(
&
decoder
,
pRsp
->
pMeta
)
<
0
)
return
-
1
;
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
void
tFreeSMAlterStbRsp
(
SMAlterStbRsp
*
pRsp
)
{
if
(
NULL
==
pRsp
)
{
return
;
}
if
(
pRsp
->
pMeta
)
{
taosMemoryFree
(
pRsp
->
pMeta
->
pSchemas
);
taosMemoryFree
(
pRsp
->
pMeta
);
}
}
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
d8093c91
...
...
@@ -1207,13 +1207,54 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
return
0
;
}
static
int32_t
mndBuildSMAlterStbRsp
(
SDbObj
*
pDb
,
const
SMAlterStbReq
*
pAlter
,
SStbObj
*
pObj
,
void
**
pCont
,
int32_t
*
pLen
)
{
int
ret
;
SEncoder
ec
=
{
0
};
uint32_t
contLen
=
0
;
SMAlterStbRsp
alterRsp
=
{
0
};
SName
name
=
{
0
};
tNameFromString
(
&
name
,
pAlter
->
name
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
alterRsp
.
pMeta
=
taosMemoryCalloc
(
1
,
sizeof
(
STableMetaRsp
));
if
(
NULL
==
alterRsp
.
pMeta
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
ret
=
mndBuildStbSchemaImp
(
pDb
,
pObj
,
name
.
tname
,
&
alterRsp
.
meta
);
if
(
ret
)
{
tFreeSMAlterStbRsp
(
&
alterRsp
);
return
ret
;
}
tEncodeSize
(
tEncodeSMAlterStbRsp
,
&
alterRsp
,
contLen
,
ret
);
if
(
ret
)
{
tFreeSMAlterStbRsp
(
&
alterRsp
);
return
ret
;
}
void
*
cont
=
taosMemoryMalloc
(
contLen
);
tEncoderInit
(
&
ec
,
cont
,
contLen
);
tEncodeSMAlterStbRsp
(
&
ec
,
&
alterRsp
);
tEncoderClear
(
&
ec
);
tFreeSMAlterStbRsp
(
&
alterRsp
);
*
pCont
=
cont
;
*
pLen
=
contLen
;
return
0
;
}
static
int32_t
mndAlterStb
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
const
SMAlterStbReq
*
pAlter
,
SDbObj
*
pDb
,
SStbObj
*
pOld
)
{
bool
needRsp
=
true
;
SStbObj
stbObj
=
{
0
};
taosRLockLatch
(
&
pOld
->
lock
);
memcpy
(
&
stbObj
,
pOld
,
sizeof
(
SStbObj
));
stbObj
.
pColumns
=
NULL
;
stbObj
.
pTags
=
NULL
;
stbObj
.
updateTime
=
taosGetTimestampMs
();
stbObj
.
lock
=
0
;
taosRUnLockLatch
(
&
pOld
->
lock
);
int32_t
code
=
-
1
;
...
...
@@ -1247,9 +1288,11 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p
code
=
mndAlterStbColumnBytes
(
pOld
,
&
stbObj
,
pField0
);
break
;
case
TSDB_ALTER_TABLE_UPDATE_OPTIONS
:
needRsp
=
false
;
code
=
mndUpdateStbCommentAndTTL
(
pOld
,
&
stbObj
,
pAlter
->
comment
,
pAlter
->
commentLen
,
pAlter
->
ttl
);
break
;
default:
needRsp
=
false
;
terrno
=
TSDB_CODE_OPS_NOT_SUPPORT
;
break
;
}
...
...
@@ -1263,6 +1306,13 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p
mDebug
(
"trans:%d, used to alter stb:%s"
,
pTrans
->
id
,
pAlter
->
name
);
mndTransSetDbInfo
(
pTrans
,
pDb
);
if
(
needRsp
)
{
void
*
pCont
=
NULL
;
int32_t
contLen
=
0
;
if
(
mndBuildSMAlterStbRsp
(
pDb
,
pAlter
,
&
stbObj
,
&
pCont
,
&
contLen
))
goto
_OVER
;
mndTransSetRpcRsp
(
pTrans
,
pCont
,
contLen
);
}
if
(
mndSetAlterStbRedoLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetAlterStbCommitLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetAlterStbRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
_OVER
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
d8093c91
...
...
@@ -87,7 +87,7 @@ int metaAlterSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* p
int
metaDropSTable
(
SMeta
*
pMeta
,
int64_t
verison
,
SVDropStbReq
*
pReq
);
int
metaCreateTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateTbReq
*
pReq
);
int
metaDropTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVDropTbReq
*
pReq
,
SArray
*
tbUids
);
int
metaAlterTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pReq
);
int
metaAlterTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pReq
,
STableMetaRsp
*
pMetaRsp
);
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
);
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
);
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
);
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
d8093c91
...
...
@@ -25,6 +25,24 @@ static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME);
static
int
metaUpdateTagIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pCtbEntry
);
static
int
metaDropTableByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int
*
type
);
static
int
metaUpdateMetaRsp
(
tb_uid_t
uid
,
char
*
tbName
,
SSchemaWrapper
*
pSchema
,
STableMetaRsp
*
pMetaRsp
)
{
pMetaRsp
->
pSchemas
=
taosMemoryMalloc
(
pSchema
->
nCols
*
sizeof
(
SSchema
));
if
(
NULL
==
pMetaRsp
->
pSchemas
)
{
terrno
=
TSDB_CODE_VND_OUT_OF_MEMORY
;
return
-
1
;
}
strcpy
(
pMetaRsp
->
tbName
,
tbName
);
pMetaRsp
->
numOfColumns
=
pSchema
->
nCols
;
pMetaRsp
->
tableType
=
TSDB_NORMAL_TABLE
;
pMetaRsp
->
sversion
=
pSchema
->
version
;
pMetaRsp
->
tuid
=
uid
;
memcpy
(
pMetaRsp
->
pSchemas
,
pSchema
->
pSchema
,
pSchema
->
nCols
*
sizeof
(
SSchema
));
return
0
;
}
int
metaCreateSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
)
{
SMetaEntry
me
=
{
0
};
int
kLen
=
0
;
...
...
@@ -323,7 +341,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
return
0
;
}
static
int
metaAlterTableColumn
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pAlterTbReq
)
{
static
int
metaAlterTableColumn
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pAlterTbReq
,
STableMetaRsp
*
pMetaRsp
)
{
void
*
pVal
=
NULL
;
int
nVal
=
0
;
const
void
*
pData
=
NULL
;
...
...
@@ -463,6 +481,8 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
metaULock
(
pMeta
);
metaUpdateMetaRsp
(
uid
,
pAlterTbReq
->
tbName
,
pSchema
,
pMetaRsp
);
if
(
pNewSchema
)
taosMemoryFree
(
pNewSchema
);
tDecoderClear
(
&
dc
);
tdbTbcClose
(
pTbDbc
);
...
...
@@ -619,13 +639,13 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
return
0
;
}
int
metaAlterTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pReq
)
{
int
metaAlterTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pReq
,
STableMetaRsp
*
pMetaRsp
)
{
switch
(
pReq
->
action
)
{
case
TSDB_ALTER_TABLE_ADD_COLUMN
:
case
TSDB_ALTER_TABLE_DROP_COLUMN
:
case
TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES
:
case
TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME
:
return
metaAlterTableColumn
(
pMeta
,
version
,
pReq
);
return
metaAlterTableColumn
(
pMeta
,
version
,
pReq
,
pMetaRsp
);
case
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
:
return
metaUpdateTableTagVal
(
pMeta
,
version
,
pReq
);
case
TSDB_ALTER_TABLE_UPDATE_OPTIONS
:
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
d8093c91
...
...
@@ -248,6 +248,13 @@ void smaHandleRes(void *pVnode, int64_t smaId, const SArray *data) {
tdProcessTSmaInsert
(((
SVnode
*
)
pVnode
)
->
pSma
,
smaId
,
(
const
char
*
)
data
);
}
void
vnodeUpdateMetaRsp
(
SVnode
*
pVnode
,
STableMetaRsp
*
pMetaRsp
)
{
strcpy
(
pMetaRsp
->
dbFName
,
pVnode
->
config
.
dbname
);
pMetaRsp
->
dbId
=
pVnode
->
config
.
dbId
;
pMetaRsp
->
vgId
=
TD_VID
(
pVnode
);
pMetaRsp
->
precision
=
pVnode
->
config
.
tsdbCfg
.
precision
;
}
int
vnodeProcessSyncReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
int32_t
ret
=
TAOS_SYNC_PROPOSE_OTHER_ERROR
;
...
...
@@ -517,12 +524,13 @@ _exit:
}
static
int
vnodeProcessAlterTbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
SVAlterTbReq
vAlterTbReq
=
{
0
};
SVAlterTbRsp
vAlterTbRsp
=
{
0
};
SDecoder
dc
=
{
0
};
int
rcode
=
0
;
int
ret
;
SEncoder
ec
=
{
0
};
SVAlterTbReq
vAlterTbReq
=
{
0
};
SVAlterTbRsp
vAlterTbRsp
=
{
0
};
SDecoder
dc
=
{
0
};
int
rcode
=
0
;
int
ret
;
SEncoder
ec
=
{
0
};
STableMetaRsp
vMetaRsp
=
{
0
};
pRsp
->
msgType
=
TDMT_VND_ALTER_TABLE_RSP
;
pRsp
->
pCont
=
NULL
;
...
...
@@ -540,7 +548,7 @@ static int vnodeProcessAlterTbReq(SVnode *pVnode, int64_t version, void *pReq, i
}
// process
if
(
metaAlterTable
(
pVnode
->
pMeta
,
version
,
&
vAlterTbReq
)
<
0
)
{
if
(
metaAlterTable
(
pVnode
->
pMeta
,
version
,
&
vAlterTbReq
,
&
vMetaRsp
)
<
0
)
{
vAlterTbRsp
.
code
=
TSDB_CODE_INVALID_MSG
;
tDecoderClear
(
&
dc
);
rcode
=
-
1
;
...
...
@@ -548,6 +556,11 @@ static int vnodeProcessAlterTbReq(SVnode *pVnode, int64_t version, void *pReq, i
}
tDecoderClear
(
&
dc
);
if
(
NULL
!=
vMetaRsp
.
pSchemas
)
{
vnodeUpdateMetaRsp
(
pVnode
,
&
vMetaRsp
);
vAlterTbRsp
.
pMeta
=
&
vMetaRsp
;
}
_exit:
tEncodeSize
(
tEncodeSVAlterTbRsp
,
&
vAlterTbRsp
,
pRsp
->
contLen
,
ret
);
pRsp
->
pCont
=
rpcMallocCont
(
pRsp
->
contLen
);
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
d8093c91
...
...
@@ -302,7 +302,7 @@ typedef struct SCtgUpdateEpsetMsg {
typedef
struct
SCtgCacheOperation
{
int32_t
opId
;
void
*
data
;
bool
sync
Req
;
bool
sync
Op
;
uint64_t
seqId
;
}
SCtgCacheOperation
;
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
d8093c91
...
...
@@ -314,6 +314,36 @@ _return:
CTG_RET
(
code
);
}
int32_t
ctgUpdateTbMeta
(
SCatalog
*
pCtg
,
STableMetaRsp
*
rspMsg
,
bool
syncOp
)
{
STableMetaOutput
*
output
=
taosMemoryCalloc
(
1
,
sizeof
(
STableMetaOutput
));
if
(
NULL
==
output
)
{
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
STableMetaOutput
));
CTG_ERR_RET
(
TSDB_CODE_CTG_MEM_ERROR
);
}
int32_t
code
=
0
;
strcpy
(
output
->
dbFName
,
rspMsg
->
dbFName
);
strcpy
(
output
->
tbName
,
rspMsg
->
tbName
);
output
->
dbId
=
rspMsg
->
dbId
;
SET_META_TYPE_TABLE
(
output
->
metaType
);
CTG_ERR_JRET
(
queryCreateTableMetaFromMsg
(
rspMsg
,
rspMsg
->
tableType
==
TSDB_SUPER_TABLE
,
&
output
->
tbMeta
));
CTG_ERR_JRET
(
ctgUpdateTbMetaEnqueue
(
pCtg
,
output
,
syncOp
));
return
TSDB_CODE_SUCCESS
;
_return:
taosMemoryFreeClear
(
output
->
tbMeta
);
taosMemoryFreeClear
(
output
);
CTG_RET
(
code
);
}
int32_t
ctgChkAuth
(
SCatalog
*
pCtg
,
void
*
pTrans
,
const
SEpSet
*
pMgmtEps
,
const
char
*
user
,
const
char
*
dbFName
,
AUTH_TYPE
type
,
bool
*
pass
)
{
bool
inCache
=
false
;
...
...
@@ -779,38 +809,17 @@ int32_t catalogGetSTableMeta(SCatalog* pCtg, void * pTrans, const SEpSet* pMgmtE
CTG_API_LEAVE
(
ctgGetTbMeta
(
CTG_PARAMS_LIST
(),
&
ctx
,
pTableMeta
));
}
int32_t
catalogUpdate
STableMeta
(
SCatalog
*
pCtg
,
STableMetaRsp
*
rs
pMsg
)
{
int32_t
catalogUpdate
TableMeta
(
SCatalog
*
pCtg
,
STableMetaRsp
*
pMsg
)
{
CTG_API_ENTER
();
if
(
NULL
==
pCtg
||
NULL
==
rs
pMsg
)
{
if
(
NULL
==
pCtg
||
NULL
==
pMsg
)
{
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
STableMetaOutput
*
output
=
taosMemoryCalloc
(
1
,
sizeof
(
STableMetaOutput
));
if
(
NULL
==
output
)
{
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
STableMetaOutput
));
CTG_API_LEAVE
(
TSDB_CODE_CTG_MEM_ERROR
);
}
int32_t
code
=
0
;
strcpy
(
output
->
dbFName
,
rspMsg
->
dbFName
);
strcpy
(
output
->
tbName
,
rspMsg
->
tbName
);
output
->
dbId
=
rspMsg
->
dbId
;
SET_META_TYPE_TABLE
(
output
->
metaType
);
CTG_ERR_JRET
(
queryCreateTableMetaFromMsg
(
rspMsg
,
true
,
&
output
->
tbMeta
));
CTG_ERR_JRET
(
ctgUpdateTbMetaEnqueue
(
pCtg
,
output
,
false
));
CTG_API_LEAVE
(
code
);
CTG_ERR_JRET
(
ctgUpdateTbMeta
(
pCtg
,
pMsg
,
true
));
_return:
taosMemoryFreeClear
(
output
->
tbMeta
);
taosMemoryFreeClear
(
output
);
CTG_API_LEAVE
(
code
);
}
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
d8093c91
...
...
@@ -552,7 +552,7 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) {
ctgDebug
(
"action [%s] added into queue"
,
gCtgCacheOperation
[
operation
->
opId
].
name
);
if
(
operation
->
sync
Req
)
{
if
(
operation
->
sync
Op
)
{
ctgWaitOpDone
(
operation
);
}
...
...
@@ -591,9 +591,9 @@ _return:
}
int32_t
ctgDropStbMetaEnqueue
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int64_t
dbId
,
const
char
*
stbName
,
uint64_t
suid
,
bool
sync
Req
)
{
int32_t
ctgDropStbMetaEnqueue
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int64_t
dbId
,
const
char
*
stbName
,
uint64_t
suid
,
bool
sync
Op
)
{
int32_t
code
=
0
;
SCtgCacheOperation
action
=
{.
opId
=
CTG_OP_DROP_STB_META
,
.
sync
Req
=
syncReq
};
SCtgCacheOperation
action
=
{.
opId
=
CTG_OP_DROP_STB_META
,
.
sync
Op
=
syncOp
};
SCtgRemoveStbMsg
*
msg
=
taosMemoryMalloc
(
sizeof
(
SCtgRemoveStbMsg
));
if
(
NULL
==
msg
)
{
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
SCtgRemoveStbMsg
));
...
...
@@ -620,9 +620,9 @@ _return:
int32_t
ctgDropTbMetaEnqueue
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int64_t
dbId
,
const
char
*
tbName
,
bool
sync
Req
)
{
int32_t
ctgDropTbMetaEnqueue
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int64_t
dbId
,
const
char
*
tbName
,
bool
sync
Op
)
{
int32_t
code
=
0
;
SCtgCacheOperation
action
=
{.
opId
=
CTG_OP_DROP_TB_META
,
.
sync
Req
=
syncReq
};
SCtgCacheOperation
action
=
{.
opId
=
CTG_OP_DROP_TB_META
,
.
sync
Op
=
syncOp
};
SCtgRemoveTblMsg
*
msg
=
taosMemoryMalloc
(
sizeof
(
SCtgRemoveTblMsg
));
if
(
NULL
==
msg
)
{
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
SCtgRemoveTblMsg
));
...
...
@@ -646,9 +646,9 @@ _return:
CTG_RET
(
code
);
}
int32_t
ctgUpdateVgroupEnqueue
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int64_t
dbId
,
SDBVgInfo
*
dbInfo
,
bool
sync
Req
)
{
int32_t
ctgUpdateVgroupEnqueue
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int64_t
dbId
,
SDBVgInfo
*
dbInfo
,
bool
sync
Op
)
{
int32_t
code
=
0
;
SCtgCacheOperation
action
=
{.
opId
=
CTG_OP_UPDATE_VGROUP
,
.
sync
Req
=
syncReq
};
SCtgCacheOperation
action
=
{.
opId
=
CTG_OP_UPDATE_VGROUP
,
.
sync
Op
=
syncOp
};
SCtgUpdateVgMsg
*
msg
=
taosMemoryMalloc
(
sizeof
(
SCtgUpdateVgMsg
));
if
(
NULL
==
msg
)
{
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
SCtgUpdateVgMsg
));
...
...
@@ -679,9 +679,9 @@ _return:
CTG_RET
(
code
);
}
int32_t
ctgUpdateTbMetaEnqueue
(
SCatalog
*
pCtg
,
STableMetaOutput
*
output
,
bool
sync
Req
)
{
int32_t
ctgUpdateTbMetaEnqueue
(
SCatalog
*
pCtg
,
STableMetaOutput
*
output
,
bool
sync
Op
)
{
int32_t
code
=
0
;
SCtgCacheOperation
action
=
{.
opId
=
CTG_OP_UPDATE_TB_META
,
.
sync
Req
=
syncReq
};
SCtgCacheOperation
action
=
{.
opId
=
CTG_OP_UPDATE_TB_META
,
.
sync
Op
=
syncOp
};
SCtgUpdateTblMsg
*
msg
=
taosMemoryMalloc
(
sizeof
(
SCtgUpdateTblMsg
));
if
(
NULL
==
msg
)
{
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
SCtgUpdateTblMsg
));
...
...
@@ -738,9 +738,9 @@ _return:
int32_t
ctgUpdateUserEnqueue
(
SCatalog
*
pCtg
,
SGetUserAuthRsp
*
pAuth
,
bool
sync
Req
)
{
int32_t
ctgUpdateUserEnqueue
(
SCatalog
*
pCtg
,
SGetUserAuthRsp
*
pAuth
,
bool
sync
Op
)
{
int32_t
code
=
0
;
SCtgCacheOperation
action
=
{.
opId
=
CTG_OP_UPDATE_USER
,
.
sync
Req
=
syncReq
};
SCtgCacheOperation
action
=
{.
opId
=
CTG_OP_UPDATE_USER
,
.
sync
Op
=
syncOp
};
SCtgUpdateUserMsg
*
msg
=
taosMemoryMalloc
(
sizeof
(
SCtgUpdateUserMsg
));
if
(
NULL
==
msg
)
{
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
SCtgUpdateUserMsg
));
...
...
@@ -1574,7 +1574,7 @@ void* ctgUpdateThreadFunc(void* param) {
gCtgMgmt
.
queue
.
seqDone
=
operation
->
seqId
;
if
(
operation
->
sync
Req
)
{
if
(
operation
->
sync
Op
)
{
tsem_post
(
&
gCtgMgmt
.
queue
.
rspSem
);
}
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
d8093c91
...
...
@@ -1380,7 +1380,7 @@ TEST(tableMeta, updateStbMeta) {
STableMetaRsp
rsp
=
{
0
};
ctgTestBuildSTableMetaRsp
(
&
rsp
);
code
=
catalogUpdate
S
TableMeta
(
pCtg
,
&
rsp
);
code
=
catalogUpdateTableMeta
(
pCtg
,
&
rsp
);
ASSERT_EQ
(
code
,
0
);
taosMemoryFreeClear
(
rsp
.
pSchemas
);
...
...
source/libs/qcom/src/querymsg.c
浏览文件 @
d8093c91
...
...
@@ -273,7 +273,7 @@ static int32_t queryConvertTableMetaMsg(STableMetaRsp *pMetaMsg) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
queryCreateTableMetaFromMsg
(
STableMetaRsp
*
msg
,
bool
isS
uperTable
,
STableMeta
**
pMeta
)
{
int32_t
queryCreateTableMetaFromMsg
(
STableMetaRsp
*
msg
,
bool
isS
tb
,
STableMeta
**
pMeta
)
{
int32_t
total
=
msg
->
numOfColumns
+
msg
->
numOfTags
;
int32_t
metaSize
=
sizeof
(
STableMeta
)
+
sizeof
(
SSchema
)
*
total
;
...
...
@@ -283,14 +283,14 @@ int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isSuperTable, STabl
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
pTableMeta
->
vgId
=
isS
uperTable
?
0
:
msg
->
vgId
;
pTableMeta
->
tableType
=
isS
uperTable
?
TSDB_SUPER_TABLE
:
msg
->
tableType
;
pTableMeta
->
uid
=
isS
uperTable
?
msg
->
suid
:
msg
->
tuid
;
pTableMeta
->
vgId
=
isS
tb
?
0
:
msg
->
vgId
;
pTableMeta
->
tableType
=
isS
tb
?
TSDB_SUPER_TABLE
:
msg
->
tableType
;
pTableMeta
->
uid
=
isS
tb
?
msg
->
suid
:
msg
->
tuid
;
pTableMeta
->
suid
=
msg
->
suid
;
pTableMeta
->
sversion
=
msg
->
sversion
;
pTableMeta
->
tversion
=
msg
->
tversion
;
if
(
isS
uperTable
)
{
if
(
isS
tb
)
{
qDebug
(
"stable %s meta returned, suid:%"
PRIx64
,
msg
->
stbName
,
pTableMeta
->
suid
);
}
...
...
source/libs/scheduler/src/schRemote.c
浏览文件 @
d8093c91
...
...
@@ -162,6 +162,8 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch
tDecoderClear
(
&
coder
);
SCH_ERR_JRET
(
code
);
SCH_ERR_JRET
(
rsp
.
code
);
pJob
->
queryRes
=
rsp
.
pMeta
;
}
SCH_ERR_JRET
(
rspCode
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录