Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
eff9f9be
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
eff9f9be
编写于
6月 13, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add sma update
上级
17f62750
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
189 addition
and
54 deletion
+189
-54
include/common/tmsg.h
include/common/tmsg.h
+4
-2
source/client/src/clientHb.c
source/client/src/clientHb.c
+13
-3
source/common/src/tmsg.c
source/common/src/tmsg.c
+88
-14
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+2
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+16
-8
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+1
-3
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+49
-5
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+1
-2
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+8
-8
source/libs/catalog/src/ctgRemote.c
source/libs/catalog/src/ctgRemote.c
+6
-2
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+1
-7
未找到文件。
include/common/tmsg.h
浏览文件 @
eff9f9be
...
...
@@ -1136,8 +1136,8 @@ int32_t tDeserializeSTableMetaRsp(void* buf, int32_t bufLen, STableMetaRsp* pRsp
void
tFreeSTableMetaRsp
(
STableMetaRsp
*
pRsp
);
typedef
struct
{
SArray
*
p
Array
;
// Array of STableMetaRsp
S
TableIndexRsp
*
p
IndexRsp
;
SArray
*
p
MetaRsp
;
// Array of STableMetaRsp
S
Array
*
pIndexRsp
;
// Array of STable
IndexRsp;
}
SSTbHbRsp
;
int32_t
tSerializeSSTbHbRsp
(
void
*
buf
,
int32_t
bufLen
,
SSTbHbRsp
*
pRsp
);
...
...
@@ -2514,6 +2514,8 @@ typedef struct {
}
STableIndexInfo
;
typedef
struct
{
char
tbName
[
TSDB_TABLE_NAME_LEN
];
char
dbFName
[
TSDB_DB_FNAME_LEN
];
uint64_t
suid
;
int32_t
version
;
SArray
*
pIndex
;
...
...
source/client/src/clientHb.c
浏览文件 @
eff9f9be
...
...
@@ -105,9 +105,9 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo
return
-
1
;
}
int32_t
numOf
Batchs
=
taosArrayGetSize
(
hbRsp
.
pArray
);
for
(
int32_t
i
=
0
;
i
<
numOf
Batchs
;
++
i
)
{
STableMetaRsp
*
rsp
=
taosArrayGet
(
hbRsp
.
p
Array
,
i
);
int32_t
numOf
Meta
=
taosArrayGetSize
(
hbRsp
.
pMetaRsp
);
for
(
int32_t
i
=
0
;
i
<
numOf
Meta
;
++
i
)
{
STableMetaRsp
*
rsp
=
taosArrayGet
(
hbRsp
.
p
MetaRsp
,
i
);
if
(
rsp
->
numOfColumns
<
0
)
{
tscDebug
(
"hb remove stb, db:%s, stb:%s"
,
rsp
->
dbFName
,
rsp
->
stbName
);
...
...
@@ -124,6 +124,16 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo
}
}
int32_t
numOfIndex
=
taosArrayGetSize
(
hbRsp
.
pIndexRsp
);
for
(
int32_t
i
=
0
;
i
<
numOfIndex
;
++
i
)
{
STableIndexRsp
*
rsp
=
taosArrayGet
(
hbRsp
.
pIndexRsp
,
i
);
catalogUpdateTableIndex
(
pCatalog
,
rsp
);
}
taosArrayDestroy
(
hbRsp
.
pIndexRsp
);
hbRsp
.
pIndexRsp
=
NULL
;
tFreeSSTbHbRsp
(
&
hbRsp
);
return
TSDB_CODE_SUCCESS
;
}
...
...
source/common/src/tmsg.c
浏览文件 @
eff9f9be
...
...
@@ -2437,6 +2437,8 @@ int32_t tSerializeSTableIndexRsp(void *buf, int32_t bufLen, const STableIndexRsp
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
tbName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
if
(
tEncodeU64
(
&
encoder
,
pRsp
->
suid
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
version
)
<
0
)
return
-
1
;
int32_t
num
=
taosArrayGetSize
(
pRsp
->
pIndex
);
...
...
@@ -2473,6 +2475,8 @@ int32_t tDeserializeSTableIndexRsp(void *buf, int32_t bufLen, STableIndexRsp *pR
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
tbName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
if
(
tDecodeU64
(
&
decoder
,
&
pRsp
->
suid
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
version
)
<
0
)
return
-
1
;
int32_t
num
=
0
;
...
...
@@ -2640,12 +2644,30 @@ int32_t tSerializeSSTbHbRsp(void *buf, int32_t bufLen, SSTbHbRsp *pRsp) {
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
int32_t
numOf
Batch
=
taosArrayGetSize
(
pRsp
->
pArray
);
if
(
tEncodeI32
(
&
encoder
,
numOf
Batch
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
numOf
Batch
;
++
i
)
{
STableMetaRsp
*
pMetaRsp
=
taosArrayGet
(
pRsp
->
p
Array
,
i
);
int32_t
numOf
Meta
=
taosArrayGetSize
(
pRsp
->
pMetaRsp
);
if
(
tEncodeI32
(
&
encoder
,
numOf
Meta
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
numOf
Meta
;
++
i
)
{
STableMetaRsp
*
pMetaRsp
=
taosArrayGet
(
pRsp
->
p
MetaRsp
,
i
);
if
(
tEncodeSTableMetaRsp
(
&
encoder
,
pMetaRsp
)
<
0
)
return
-
1
;
}
int32_t
numOfIndex
=
taosArrayGetSize
(
pRsp
->
pIndexRsp
);
for
(
int32_t
i
=
0
;
i
<
numOfMeta
;
++
i
)
{
STableIndexRsp
*
pIndexRsp
=
taosArrayGet
(
pRsp
->
pIndexRsp
,
i
);
if
(
tEncodeCStr
(
&
encoder
,
pIndexRsp
->
tbName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pIndexRsp
->
dbFName
)
<
0
)
return
-
1
;
if
(
tEncodeU64
(
&
encoder
,
pIndexRsp
->
suid
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pIndexRsp
->
version
)
<
0
)
return
-
1
;
int32_t
num
=
taosArrayGetSize
(
pIndexRsp
->
pIndex
);
if
(
tEncodeI32
(
&
encoder
,
num
)
<
0
)
return
-
1
;
if
(
num
>
0
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
STableIndexInfo
*
pInfo
=
(
STableIndexInfo
*
)
taosArrayGet
(
pIndexRsp
->
pIndex
,
i
);
if
(
tSerializeSTableIndexInfo
(
&
encoder
,
pInfo
)
<
0
)
return
-
1
;
}
}
}
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -2671,20 +2693,53 @@ int32_t tDeserializeSSTbHbRsp(void *buf, int32_t bufLen, SSTbHbRsp *pRsp) {
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
int32_t
numOf
Batch
=
taosArrayGetSize
(
pRsp
->
pArray
);
if
(
tDecodeI32
(
&
decoder
,
&
numOf
Batch
)
<
0
)
return
-
1
;
int32_t
numOf
Meta
=
taosArrayGetSize
(
pRsp
->
pMetaRsp
);
if
(
tDecodeI32
(
&
decoder
,
&
numOf
Meta
)
<
0
)
return
-
1
;
pRsp
->
p
Array
=
taosArrayInit
(
numOfBatch
,
sizeof
(
STableMetaRsp
));
if
(
pRsp
->
p
Array
==
NULL
)
{
pRsp
->
p
MetaRsp
=
taosArrayInit
(
numOfMeta
,
sizeof
(
STableMetaRsp
));
if
(
pRsp
->
p
MetaRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
numOf
Batch
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOf
Meta
;
++
i
)
{
STableMetaRsp
tableMetaRsp
=
{
0
};
if
(
tDecodeSTableMetaRsp
(
&
decoder
,
&
tableMetaRsp
)
<
0
)
return
-
1
;
taosArrayPush
(
pRsp
->
pArray
,
&
tableMetaRsp
);
taosArrayPush
(
pRsp
->
pMetaRsp
,
&
tableMetaRsp
);
}
int32_t
numOfIndex
=
taosArrayGetSize
(
pRsp
->
pIndexRsp
);
if
(
tDecodeI32
(
&
decoder
,
&
numOfIndex
)
<
0
)
return
-
1
;
pRsp
->
pIndexRsp
=
taosArrayInit
(
numOfIndex
,
sizeof
(
STableIndexRsp
));
if
(
pRsp
->
pIndexRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
numOfIndex
;
++
i
)
{
STableIndexRsp
tableIndexRsp
=
{
0
};
if
(
tDecodeCStrTo
(
&
decoder
,
tableIndexRsp
.
tbName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
tableIndexRsp
.
dbFName
)
<
0
)
return
-
1
;
if
(
tDecodeU64
(
&
decoder
,
&
tableIndexRsp
.
suid
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
tableIndexRsp
.
version
)
<
0
)
return
-
1
;
int32_t
num
=
0
;
if
(
tDecodeI32
(
&
decoder
,
&
num
)
<
0
)
return
-
1
;
if
(
num
>
0
)
{
tableIndexRsp
.
pIndex
=
taosArrayInit
(
num
,
sizeof
(
STableIndexInfo
));
if
(
NULL
==
tableIndexRsp
.
pIndex
)
return
-
1
;
STableIndexInfo
info
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
if
(
tDeserializeSTableIndexInfo
(
&
decoder
,
&
info
)
<
0
)
return
-
1
;
if
(
NULL
==
taosArrayPush
(
tableIndexRsp
.
pIndex
,
&
info
))
{
taosMemoryFree
(
info
.
expr
);
return
-
1
;
}
}
}
taosArrayPush
(
pRsp
->
pIndexRsp
,
&
tableIndexRsp
);
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
@@ -2693,14 +2748,33 @@ int32_t tDeserializeSSTbHbRsp(void *buf, int32_t bufLen, SSTbHbRsp *pRsp) {
void
tFreeSTableMetaRsp
(
STableMetaRsp
*
pRsp
)
{
taosMemoryFreeClear
(
pRsp
->
pSchemas
);
}
void
tFreeSTableIndexRsp
(
void
*
info
)
{
if
(
NULL
==
info
)
{
return
;
}
STableIndexRsp
*
pInfo
=
(
STableIndexRsp
*
)
info
;
taosArrayDestroyEx
(
pInfo
->
pIndex
,
tFreeSTableIndexInfo
);
}
void
tFreeSSTbHbRsp
(
SSTbHbRsp
*
pRsp
)
{
int32_t
numOf
Batch
=
taosArrayGetSize
(
pRsp
->
pArray
);
for
(
int32_t
i
=
0
;
i
<
numOf
Batch
;
++
i
)
{
STableMetaRsp
*
pMetaRsp
=
taosArrayGet
(
pRsp
->
p
Array
,
i
);
int32_t
numOf
Meta
=
taosArrayGetSize
(
pRsp
->
pMetaRsp
);
for
(
int32_t
i
=
0
;
i
<
numOf
Meta
;
++
i
)
{
STableMetaRsp
*
pMetaRsp
=
taosArrayGet
(
pRsp
->
p
MetaRsp
,
i
);
tFreeSTableMetaRsp
(
pMetaRsp
);
}
taosArrayDestroy
(
pRsp
->
pArray
);
taosArrayDestroy
(
pRsp
->
pMetaRsp
);
int32_t
numOfIndex
=
taosArrayGetSize
(
pRsp
->
pIndexRsp
);
for
(
int32_t
i
=
0
;
i
<
numOfIndex
;
++
i
)
{
STableIndexRsp
*
pIndexRsp
=
taosArrayGet
(
pRsp
->
pIndexRsp
,
i
);
tFreeSTableIndexRsp
(
pIndexRsp
);
}
taosArrayDestroy
(
pRsp
->
pIndexRsp
);
}
int32_t
tSerializeSShowRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowRsp
*
pRsp
)
{
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
eff9f9be
...
...
@@ -885,6 +885,8 @@ static int32_t mndGetTableSma(SMnode *pMnode, char *tbFName, STableIndexRsp *rsp
return
TSDB_CODE_SUCCESS
;
}
strcpy
(
rsp
->
dbFName
,
pStb
->
db
);
strcpy
(
rsp
->
tbName
,
pStb
->
name
);
rsp
->
suid
=
pStb
->
uid
;
rsp
->
version
=
pStb
->
smaVer
;
mndReleaseStb
(
pMnode
,
pStb
);
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
eff9f9be
...
...
@@ -1674,15 +1674,15 @@ _OVER:
int32_t
mndValidateStbInfo
(
SMnode
*
pMnode
,
SSTableVersion
*
pStbVersions
,
int32_t
numOfStbs
,
void
**
ppRsp
,
int32_t
*
pRspLen
)
{
SSTbHbRsp
hbRsp
=
{
0
};
hbRsp
.
p
Array
=
taosArrayInit
(
numOfStbs
,
sizeof
(
STableMetaRsp
));
if
(
hbRsp
.
p
Array
==
NULL
)
{
hbRsp
.
p
MetaRsp
=
taosArrayInit
(
numOfStbs
,
sizeof
(
STableMetaRsp
));
if
(
hbRsp
.
p
MetaRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
hbRsp
.
pIndexRsp
=
taos
MemoryCalloc
(
1
,
sizeof
(
STableIndexRsp
));
hbRsp
.
pIndexRsp
=
taos
ArrayInit
(
numOfStbs
,
sizeof
(
STableIndexRsp
));
if
(
NULL
==
hbRsp
.
pIndexRsp
)
{
taosArrayDestroy
(
hbRsp
.
p
Array
);
taosArrayDestroy
(
hbRsp
.
p
MetaRsp
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
...
...
@@ -1700,12 +1700,12 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
if
(
mndBuildStbSchema
(
pMnode
,
pStbVersion
->
dbFName
,
pStbVersion
->
stbName
,
&
metaRsp
,
&
smaVer
)
!=
0
)
{
metaRsp
.
numOfColumns
=
-
1
;
metaRsp
.
suid
=
pStbVersion
->
suid
;
taosArrayPush
(
hbRsp
.
p
Array
,
&
metaRsp
);
taosArrayPush
(
hbRsp
.
p
MetaRsp
,
&
metaRsp
);
continue
;
}
if
(
pStbVersion
->
sversion
!=
metaRsp
.
sversion
||
pStbVersion
->
tversion
!=
metaRsp
.
tversion
)
{
taosArrayPush
(
hbRsp
.
p
Array
,
&
metaRsp
);
taosArrayPush
(
hbRsp
.
p
MetaRsp
,
&
metaRsp
);
}
else
{
tFreeSTableMetaRsp
(
&
metaRsp
);
}
...
...
@@ -1713,11 +1713,19 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
if
(
pStbVersion
->
smaVer
!=
smaVer
)
{
bool
exist
=
false
;
char
tbFName
[
TSDB_TABLE_FNAME_LEN
];
STableIndexRsp
indexRsp
=
{
0
};
sprintf
(
tbFName
,
"%s.%s"
,
pStbVersion
->
dbFName
,
pStbVersion
->
stbName
);
int32_t
code
=
mndGetTableSma
(
pMnode
,
tbFName
,
hbRsp
.
pI
ndexRsp
,
&
exist
);
int32_t
code
=
mndGetTableSma
(
pMnode
,
tbFName
,
&
i
ndexRsp
,
&
exist
);
if
(
code
||
!
exist
)
{
taosMemoryFreeClear
(
hbRsp
.
pIndexRsp
);
indexRsp
.
suid
=
pStbVersion
->
suid
;
indexRsp
.
version
=
-
1
;
indexRsp
.
pIndex
=
NULL
;
}
strcpy
(
indexRsp
->
dbFName
,
pStbVersion
->
dbFName
);
strcpy
(
indexRsp
->
tbName
,
pStbVersion
->
stbName
);
taosArrayPush
(
hbRsp
.
pIndexRsp
,
&
indexRsp
);
}
}
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
eff9f9be
...
...
@@ -319,8 +319,6 @@ typedef struct SCtgUpdateUserMsg {
typedef
struct
SCtgUpdateTbIndexMsg
{
SCatalog
*
pCtg
;
char
dbFName
[
TSDB_DB_FNAME_LEN
];
char
tbName
[
TSDB_TABLE_NAME_LEN
];
STableIndex
*
pIndex
;
}
SCtgUpdateTbIndexMsg
;
...
...
@@ -503,7 +501,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog* pCtg, const char *dbFName, int64_t dbId
int32_t
ctgUpdateTbMetaEnqueue
(
SCatalog
*
pCtg
,
STableMetaOutput
*
output
,
bool
syncReq
);
int32_t
ctgUpdateUserEnqueue
(
SCatalog
*
pCtg
,
SGetUserAuthRsp
*
pAuth
,
bool
syncReq
);
int32_t
ctgUpdateVgEpsetEnqueue
(
SCatalog
*
pCtg
,
char
*
dbFName
,
int32_t
vgId
,
SEpSet
*
pEpSet
);
int32_t
ctgUpdateTbIndexEnqueue
(
SCatalog
*
pCtg
,
S
Name
*
pName
,
S
TableIndex
*
pIndex
,
bool
syncOp
);
int32_t
ctgUpdateTbIndexEnqueue
(
SCatalog
*
pCtg
,
STableIndex
*
pIndex
,
bool
syncOp
);
int32_t
ctgMetaRentInit
(
SCtgRentMgmt
*
mgmt
,
uint32_t
rentSec
,
int8_t
type
);
int32_t
ctgMetaRentAdd
(
SCtgRentMgmt
*
mgmt
,
void
*
meta
,
int64_t
id
,
int32_t
size
);
int32_t
ctgMetaRentGet
(
SCtgRentMgmt
*
mgmt
,
void
**
res
,
uint32_t
*
num
,
int32_t
size
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
eff9f9be
...
...
@@ -751,6 +751,30 @@ _return:
CTG_API_LEAVE
(
code
);
}
int32_t
catalogUpdateTableIndex
(
SCatalog
*
pCtg
,
STableIndexRsp
*
pRsp
)
{
CTG_API_ENTER
();
int32_t
code
=
0
;
if
(
NULL
==
pCtg
||
NULL
==
pRsp
)
{
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
STableIndex
*
pIndex
=
taosMemoryCalloc
(
1
,
sizeof
(
STableIndex
));
if
(
NULL
==
pIndex
)
{
CTG_API_LEAVE
(
TSDB_CODE_OUT_OF_MEMORY
);
}
memcpy
(
pIndex
,
pRsp
,
sizeof
(
STableIndex
));
CTG_ERR_JRET
(
ctgUpdateTbIndexEnqueue
(
pCtg
,
&
pIndex
,
false
));
_return:
CTG_API_LEAVE
(
code
);
}
int32_t
catalogRemoveTableMeta
(
SCatalog
*
pCtg
,
SName
*
pTableName
)
{
CTG_API_ENTER
();
...
...
@@ -1153,16 +1177,36 @@ int32_t catalogGetTableIndex(SCatalog* pCtg, SRequestConnInfo *pConn, const SNam
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgGetTbIndexFromMnode
(
pCtg
,
pConn
,
(
SName
*
)
pTableName
,
pRes
,
NULL
));
CTG_ERR_RET
(
ctgReadTbIndexFromCache
(
pCtg
,
pTableName
,
pRes
));
if
(
*
pRes
)
{
CTG_API_LEAVE
(
TSDB_CODE_SUCCESS
);
}
SArray
*
pInfo
=
NULL
;
CTG_ERR_JRET
(
ctgCloneTableIndex
(
*
pRes
,
&
pInfo
));
STableIndex
*
pIndex
=
taosMemoryCalloc
(
1
,
sizeof
(
STableIndex
));
if
(
NULL
==
pIndex
)
{
CTG_API_LEAVE
(
TSDB_CODE_OUT_OF_MEMORY
);
}
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgGetTbIndexFromMnode
(
pCtg
,
pConn
,
(
SName
*
)
pTableName
,
pIndex
,
NULL
));
CTG_ERR_JRET
(
ctgUpdateTbIndexEnqueue
(
pCtg
,
pTableName
,
pInfo
,
false
));
SArray
*
pInfo
=
NULL
;
CTG_ERR_JRET
(
ctgCloneTableIndex
(
pIndex
->
pIndex
,
&
pInfo
));
*
pRes
=
pInfo
;
CTG_ERR_JRET
(
ctgUpdateTbIndexEnqueue
(
pCtg
,
pTableName
,
&
pIndex
,
false
));
CTG_API_LEAVE
(
code
);
_return:
tFreeSTableIndexRsp
(
pIndex
);
taosMemoryFree
(
pIndex
);
taosArrayDestroyEx
(
*
pRes
,
tFreeSTableIndexInfo
);
*
pRes
=
NULL
;
CTG_API_LEAVE
(
code
);
}
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
eff9f9be
...
...
@@ -876,10 +876,9 @@ int32_t ctgHandleGetTbIndexRsp(SCtgTask* pTask, int32_t reqType, const SDataBuf
SArray
*
pInfo
=
NULL
;
CTG_ERR_JRET
(
ctgCloneTableIndex
(
pOut
->
pIndex
,
&
pInfo
));
pTask
->
res
=
pInfo
;
pTask
->
msgCtx
.
out
=
NULL
;
SCtgTbIndexCtx
*
ctx
=
pTask
->
taskCtx
;
CTG_ERR_JRET
(
ctgUpdateTbIndexEnqueue
(
pTask
->
pJob
->
pCtg
,
ctx
->
pName
,
pO
ut
,
false
));
CTG_ERR_JRET
(
ctgUpdateTbIndexEnqueue
(
pTask
->
pJob
->
pCtg
,
(
STableIndex
**
)
&
pTask
->
msgCtx
.
o
ut
,
false
));
_return:
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
eff9f9be
...
...
@@ -838,7 +838,7 @@ _return:
CTG_RET
(
code
);
}
int32_t
ctgUpdateTbIndexEnqueue
(
SCatalog
*
pCtg
,
S
Name
*
pName
,
STableIndex
*
pIndex
,
bool
syncOp
)
{
int32_t
ctgUpdateTbIndexEnqueue
(
SCatalog
*
pCtg
,
S
TableIndex
*
*
pIndex
,
bool
syncOp
)
{
int32_t
code
=
0
;
SCtgCacheOperation
*
op
=
taosMemoryCalloc
(
1
,
sizeof
(
SCtgCacheOperation
));
op
->
opId
=
CTG_OP_UPDATE_TB_INDEX
;
...
...
@@ -851,19 +851,19 @@ int32_t ctgUpdateTbIndexEnqueue(SCatalog* pCtg, SName* pName, STableIndex *pInde
}
msg
->
pCtg
=
pCtg
;
msg
->
pIndex
=
pIndex
;
tNameGetFullDbName
(
pName
,
msg
->
dbFName
);
strcpy
(
msg
->
tbName
,
pName
->
tname
);
msg
->
pIndex
=
*
pIndex
;
op
->
data
=
msg
;
CTG_ERR_JRET
(
ctgEnqueue
(
pCtg
,
op
));
*
pIndex
=
NULL
;
return
TSDB_CODE_SUCCESS
;
_return:
taosArrayDestroyEx
(
pIndex
,
tFreeSTableIndexInfo
);
taosArrayDestroyEx
(
*
pIndex
,
tFreeSTableIndexInfo
);
taosMemoryFreeClear
(
*
pIndex
);
taosMemoryFreeClear
(
msg
);
CTG_RET
(
code
);
...
...
@@ -1745,12 +1745,12 @@ int32_t ctgOpUpdateTbIndex(SCtgCacheOperation *operation) {
STableIndex
*
pIndex
=
msg
->
pIndex
;
SCtgDBCache
*
dbCache
=
NULL
;
CTG_ERR_JRET
(
ctgGetAddDBCache
(
pCtg
,
msg
->
dbFName
,
0
,
&
dbCache
));
CTG_ERR_JRET
(
ctgGetAddDBCache
(
pCtg
,
pIndex
->
dbFName
,
0
,
&
dbCache
));
if
(
NULL
==
dbCache
)
{
CTG_ERR_JRET
(
code
);
}
CTG_ERR_JRET
(
ctgWriteTbIndexToCache
(
pCtg
,
dbCache
,
msg
->
dbFName
,
msg
->
tbName
,
&
pIndex
));
CTG_ERR_JRET
(
ctgWriteTbIndexToCache
(
pCtg
,
dbCache
,
pIndex
->
dbFName
,
pIndex
->
tbName
,
&
pIndex
));
_return:
...
...
source/libs/catalog/src/ctgRemote.c
浏览文件 @
eff9f9be
...
...
@@ -431,7 +431,7 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgGetTbIndexFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SName
*
name
,
S
Array
*
*
out
,
SCtgTask
*
pTask
)
{
int32_t
ctgGetTbIndexFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SName
*
name
,
S
TableIndex
*
out
,
SCtgTask
*
pTask
)
{
char
*
msg
=
NULL
;
int32_t
msgLen
=
0
;
int32_t
reqType
=
TDMT_MND_GET_TABLE_INDEX
;
...
...
@@ -448,7 +448,11 @@ int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SName *n
}
if
(
pTask
)
{
void
*
pOut
=
NULL
;
void
*
pOut
=
taosMemoryCalloc
(
1
,
sizeof
(
STableIndex
));
if
(
NULL
==
pOut
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
CTG_ERR_RET
(
ctgUpdateMsgCtx
(
&
pTask
->
msgCtx
,
reqType
,
pOut
,
(
char
*
)
tbFName
));
CTG_RET
(
ctgAsyncSendMsg
(
pCtg
,
pConn
,
pTask
,
reqType
,
msg
,
msgLen
));
...
...
source/libs/qcom/src/querymsg.c
浏览文件 @
eff9f9be
...
...
@@ -484,17 +484,11 @@ int32_t queryProcessGetTbIndexRsp(void *output, char *msg, int32_t msgSize) {
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
STableIndexRsp
*
out
=
taosMemoryCalloc
(
1
,
sizeof
(
STableIndexRsp
));
if
(
NULL
==
out
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
STableIndexRsp
*
out
=
(
STableIndexRsp
*
)
output
;
if
(
tDeserializeSTableIndexRsp
(
msg
,
msgSize
,
out
)
!=
0
)
{
qError
(
"tDeserializeSTableIndexRsp failed, msgSize:%d"
,
msgSize
);
return
TSDB_CODE_INVALID_MSG
;
}
*
(
void
**
)
output
=
out
;
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录