Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
423fdeef
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看板
未验证
提交
423fdeef
编写于
6月 11, 2023
作者:
D
dapan1121
提交者:
GitHub
6月 11, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21684 from taosdata/fix/TD-24741
fix: systable vgroup empty issue
上级
8f2cfe91
5cd57cec
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
59 addition
and
21 deletion
+59
-21
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+2
-2
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+2
-2
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+11
-11
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+1
-1
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+43
-5
未找到文件。
source/libs/catalog/inc/catalogInt.h
浏览文件 @
423fdeef
...
@@ -950,8 +950,8 @@ int32_t ctgCloneMetaOutput(STableMetaOutput* output, STableMetaOutput** pOutput)
...
@@ -950,8 +950,8 @@ int32_t ctgCloneMetaOutput(STableMetaOutput* output, STableMetaOutput** pOutput)
int32_t
ctgGenerateVgList
(
SCatalog
*
pCtg
,
SHashObj
*
vgHash
,
SArray
**
pList
);
int32_t
ctgGenerateVgList
(
SCatalog
*
pCtg
,
SHashObj
*
vgHash
,
SArray
**
pList
);
void
ctgFreeJob
(
void
*
job
);
void
ctgFreeJob
(
void
*
job
);
void
ctgFreeHandleImpl
(
SCatalog
*
pCtg
);
void
ctgFreeHandleImpl
(
SCatalog
*
pCtg
);
int32_t
ctgGetVgInfoFromHashValue
(
SCatalog
*
pCtg
,
SDBVgInfo
*
dbInfo
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
);
int32_t
ctgGetVgInfoFromHashValue
(
SCatalog
*
pCtg
,
S
EpSet
*
pMgmtEps
,
S
DBVgInfo
*
dbInfo
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
);
int32_t
ctgGetVgInfosFromHashValue
(
SCatalog
*
pCtg
,
SCtgTaskReq
*
tReq
,
SDBVgInfo
*
dbInfo
,
SCtgTbHashsCtx
*
pCtx
,
int32_t
ctgGetVgInfosFromHashValue
(
SCatalog
*
pCtg
,
S
EpSet
*
pMgmgEpSet
,
S
CtgTaskReq
*
tReq
,
SDBVgInfo
*
dbInfo
,
SCtgTbHashsCtx
*
pCtx
,
char
*
dbFName
,
SArray
*
pNames
,
bool
update
);
char
*
dbFName
,
SArray
*
pNames
,
bool
update
);
int32_t
ctgGetVgIdsFromHashValue
(
SCatalog
*
pCtg
,
SDBVgInfo
*
dbInfo
,
char
*
dbFName
,
const
char
*
pTbs
[],
int32_t
tbNum
,
int32_t
ctgGetVgIdsFromHashValue
(
SCatalog
*
pCtg
,
SDBVgInfo
*
dbInfo
,
char
*
dbFName
,
const
char
*
pTbs
[],
int32_t
tbNum
,
int32_t
*
vgId
);
int32_t
*
vgId
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
423fdeef
...
@@ -568,7 +568,7 @@ int32_t ctgGetTbHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName*
...
@@ -568,7 +568,7 @@ int32_t ctgGetTbHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName*
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
vgInfo
?
vgInfo
:
dbCache
->
vgCache
.
vgInfo
,
pTableName
,
pVgroup
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
pConn
?
&
pConn
->
mgmtEps
:
NULL
,
vgInfo
?
vgInfo
:
dbCache
->
vgCache
.
vgInfo
,
pTableName
,
pVgroup
));
_return:
_return:
...
@@ -629,7 +629,7 @@ int32_t ctgGetCachedTbVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInf
...
@@ -629,7 +629,7 @@ int32_t ctgGetCachedTbVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInf
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
,
pTableName
,
pVgroup
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
NULL
,
dbCache
->
vgCache
.
vgInfo
,
pTableName
,
pVgroup
));
ctgRUnlockVgInfo
(
dbCache
);
ctgRUnlockVgInfo
(
dbCache
);
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
423fdeef
...
@@ -1112,7 +1112,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
...
@@ -1112,7 +1112,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
SUseDbOutput
*
pOut
=
(
SUseDbOutput
*
)
pMsgCtx
->
out
;
SUseDbOutput
*
pOut
=
(
SUseDbOutput
*
)
pMsgCtx
->
out
;
SVgroupInfo
vgInfo
=
{
0
};
SVgroupInfo
vgInfo
=
{
0
};
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
pOut
->
dbVgroup
,
pName
,
&
vgInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
&
pConn
->
mgmtEps
,
pOut
->
dbVgroup
,
pName
,
&
vgInfo
));
ctgDebug
(
"will refresh tbmeta, not supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
pName
),
flag
);
ctgDebug
(
"will refresh tbmeta, not supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
pName
),
flag
);
...
@@ -1132,7 +1132,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
...
@@ -1132,7 +1132,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
dbFName
,
&
dbCache
));
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
dbFName
,
&
dbCache
));
if
(
NULL
!=
dbCache
)
{
if
(
NULL
!=
dbCache
)
{
SVgroupInfo
vgInfo
=
{
0
};
SVgroupInfo
vgInfo
=
{
0
};
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
,
pName
,
&
vgInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
&
pConn
->
mgmtEps
,
dbCache
->
vgCache
.
vgInfo
,
pName
,
&
vgInfo
));
ctgDebug
(
"will refresh tbmeta, supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
pName
),
flag
);
ctgDebug
(
"will refresh tbmeta, supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
pName
),
flag
);
...
@@ -1282,7 +1282,7 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
...
@@ -1282,7 +1282,7 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
SUseDbOutput
*
pOut
=
(
SUseDbOutput
*
)
pMsgCtx
->
out
;
SUseDbOutput
*
pOut
=
(
SUseDbOutput
*
)
pMsgCtx
->
out
;
SVgroupInfo
vgInfo
=
{
0
};
SVgroupInfo
vgInfo
=
{
0
};
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
pOut
->
dbVgroup
,
pName
,
&
vgInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
&
pConn
->
mgmtEps
,
pOut
->
dbVgroup
,
pName
,
&
vgInfo
));
ctgTaskDebug
(
"will refresh tbmeta, not supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
pName
),
flag
);
ctgTaskDebug
(
"will refresh tbmeta, not supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
pName
),
flag
);
...
@@ -1302,7 +1302,7 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
...
@@ -1302,7 +1302,7 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
dbFName
,
&
dbCache
));
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
dbFName
,
&
dbCache
));
if
(
NULL
!=
dbCache
)
{
if
(
NULL
!=
dbCache
)
{
SVgroupInfo
vgInfo
=
{
0
};
SVgroupInfo
vgInfo
=
{
0
};
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
,
pName
,
&
vgInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
&
pConn
->
mgmtEps
,
dbCache
->
vgCache
.
vgInfo
,
pName
,
&
vgInfo
));
ctgTaskDebug
(
"will refresh tbmeta, supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
pName
),
flag
);
ctgTaskDebug
(
"will refresh tbmeta, supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
pName
),
flag
);
...
@@ -1501,7 +1501,7 @@ int32_t ctgHandleGetTbHashRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
...
@@ -1501,7 +1501,7 @@ int32_t ctgHandleGetTbHashRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
CTG_ERR_JRET
(
TSDB_CODE_OUT_OF_MEMORY
);
CTG_ERR_JRET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
}
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
pOut
->
dbVgroup
,
ctx
->
pName
,
(
SVgroupInfo
*
)
pTask
->
res
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
&
pTask
->
pJob
->
conn
.
mgmtEps
,
pOut
->
dbVgroup
,
ctx
->
pName
,
(
SVgroupInfo
*
)
pTask
->
res
));
CTG_ERR_JRET
(
ctgUpdateVgroupEnqueue
(
pCtg
,
ctx
->
dbFName
,
pOut
->
dbId
,
pOut
->
dbVgroup
,
false
));
CTG_ERR_JRET
(
ctgUpdateVgroupEnqueue
(
pCtg
,
ctx
->
dbFName
,
pOut
->
dbId
,
pOut
->
dbVgroup
,
false
));
pOut
->
dbVgroup
=
NULL
;
pOut
->
dbVgroup
=
NULL
;
...
@@ -1536,7 +1536,7 @@ int32_t ctgHandleGetTbHashsRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
...
@@ -1536,7 +1536,7 @@ int32_t ctgHandleGetTbHashsRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
SUseDbOutput
*
pOut
=
(
SUseDbOutput
*
)
pMsgCtx
->
out
;
SUseDbOutput
*
pOut
=
(
SUseDbOutput
*
)
pMsgCtx
->
out
;
STablesReq
*
pReq
=
taosArrayGet
(
ctx
->
pNames
,
pFetch
->
dbIdx
);
STablesReq
*
pReq
=
taosArrayGet
(
ctx
->
pNames
,
pFetch
->
dbIdx
);
CTG_ERR_JRET
(
ctgGetVgInfosFromHashValue
(
pCtg
,
tReq
,
pOut
->
dbVgroup
,
ctx
,
pMsgCtx
->
target
,
pReq
->
pTables
,
true
));
CTG_ERR_JRET
(
ctgGetVgInfosFromHashValue
(
pCtg
,
&
pTask
->
pJob
->
conn
.
mgmtEps
,
tReq
,
pOut
->
dbVgroup
,
ctx
,
pMsgCtx
->
target
,
pReq
->
pTables
,
true
));
CTG_ERR_JRET
(
ctgUpdateVgroupEnqueue
(
pCtg
,
pMsgCtx
->
target
,
pOut
->
dbId
,
pOut
->
dbVgroup
,
false
));
CTG_ERR_JRET
(
ctgUpdateVgroupEnqueue
(
pCtg
,
pMsgCtx
->
target
,
pOut
->
dbId
,
pOut
->
dbVgroup
,
false
));
pOut
->
dbVgroup
=
NULL
;
pOut
->
dbVgroup
=
NULL
;
...
@@ -1799,7 +1799,7 @@ int32_t ctgAsyncRefreshTbMeta(SCtgTaskReq* tReq, int32_t flag, SName* pName, int
...
@@ -1799,7 +1799,7 @@ int32_t ctgAsyncRefreshTbMeta(SCtgTaskReq* tReq, int32_t flag, SName* pName, int
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
dbFName
,
&
dbCache
));
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
dbFName
,
&
dbCache
));
if
(
dbCache
)
{
if
(
dbCache
)
{
SVgroupInfo
vgInfo
=
{
0
};
SVgroupInfo
vgInfo
=
{
0
};
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
,
pName
,
&
vgInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
&
pConn
->
mgmtEps
,
dbCache
->
vgCache
.
vgInfo
,
pName
,
&
vgInfo
));
ctgDebug
(
"will refresh tbmeta, not supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
pName
),
flag
);
ctgDebug
(
"will refresh tbmeta, not supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
pName
),
flag
);
...
@@ -1948,7 +1948,7 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask* pTask) {
...
@@ -1948,7 +1948,7 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask* pTask) {
if
(
NULL
==
pTask
->
res
)
{
if
(
NULL
==
pTask
->
res
)
{
CTG_ERR_JRET
(
TSDB_CODE_OUT_OF_MEMORY
);
CTG_ERR_JRET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
}
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
,
pCtx
->
pName
,
(
SVgroupInfo
*
)
pTask
->
res
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
&
pConn
->
mgmtEps
,
dbCache
->
vgCache
.
vgInfo
,
pCtx
->
pName
,
(
SVgroupInfo
*
)
pTask
->
res
));
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
dbCache
=
NULL
;
dbCache
=
NULL
;
...
@@ -1996,7 +1996,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
...
@@ -1996,7 +1996,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
tReq
.
pTask
=
pTask
;
tReq
.
pTask
=
pTask
;
tReq
.
msgIdx
=
-
1
;
tReq
.
msgIdx
=
-
1
;
CTG_ERR_JRET
(
CTG_ERR_JRET
(
ctgGetVgInfosFromHashValue
(
pCtg
,
&
tReq
,
dbCache
->
vgCache
.
vgInfo
,
pCtx
,
pReq
->
dbFName
,
pReq
->
pTables
,
false
));
ctgGetVgInfosFromHashValue
(
pCtg
,
&
pConn
->
mgmtEps
,
&
tReq
,
dbCache
->
vgCache
.
vgInfo
,
pCtx
,
pReq
->
dbFName
,
pReq
->
pTables
,
false
));
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
dbCache
=
NULL
;
dbCache
=
NULL
;
...
@@ -2375,7 +2375,7 @@ int32_t ctgGetTbCfgCb(SCtgTask* pTask) {
...
@@ -2375,7 +2375,7 @@ int32_t ctgGetTbCfgCb(SCtgTask* pTask) {
SDBVgInfo
*
pDb
=
(
SDBVgInfo
*
)
pTask
->
subRes
.
res
;
SDBVgInfo
*
pDb
=
(
SDBVgInfo
*
)
pTask
->
subRes
.
res
;
pCtx
->
pVgInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgroupInfo
));
pCtx
->
pVgInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgroupInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pTask
->
pJob
->
pCtg
,
pDb
,
pCtx
->
pName
,
pCtx
->
pVgInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pTask
->
pJob
->
pCtg
,
&
pTask
->
pJob
->
conn
.
mgmtEps
,
pDb
,
pCtx
->
pName
,
pCtx
->
pVgInfo
));
}
}
CTG_RET
(
ctgLaunchGetTbCfgTask
(
pTask
));
CTG_RET
(
ctgLaunchGetTbCfgTask
(
pTask
));
...
@@ -2395,7 +2395,7 @@ int32_t ctgGetTbTagCb(SCtgTask* pTask) {
...
@@ -2395,7 +2395,7 @@ int32_t ctgGetTbTagCb(SCtgTask* pTask) {
if
(
NULL
==
pCtx
->
pVgInfo
)
{
if
(
NULL
==
pCtx
->
pVgInfo
)
{
pCtx
->
pVgInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgroupInfo
));
pCtx
->
pVgInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgroupInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pTask
->
pJob
->
pCtg
,
pDb
,
pCtx
->
pName
,
pCtx
->
pVgInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pTask
->
pJob
->
pCtg
,
&
pTask
->
pJob
->
conn
.
mgmtEps
,
pDb
,
pCtx
->
pName
,
pCtx
->
pVgInfo
));
}
}
CTG_RET
(
ctgLaunchGetTbTagTask
(
pTask
));
CTG_RET
(
ctgLaunchGetTbTagTask
(
pTask
));
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
423fdeef
...
@@ -2989,7 +2989,7 @@ int32_t ctgGetTbHashVgroupFromCache(SCatalog *pCtg, const SName *pTableName, SVg
...
@@ -2989,7 +2989,7 @@ int32_t ctgGetTbHashVgroupFromCache(SCatalog *pCtg, const SName *pTableName, SVg
}
}
*
pVgroup
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgroupInfo
));
*
pVgroup
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgroupInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
,
pTableName
,
*
pVgroup
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
NULL
,
dbCache
->
vgCache
.
vgInfo
,
pTableName
,
*
pVgroup
));
_return:
_return:
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
423fdeef
...
@@ -969,7 +969,7 @@ int32_t ctgHashValueComp(void const* lp, void const* rp) {
...
@@ -969,7 +969,7 @@ int32_t ctgHashValueComp(void const* lp, void const* rp) {
return
0
;
return
0
;
}
}
int32_t
ctgGetVgInfoFromHashValue
(
SCatalog
*
pCtg
,
SDBVgInfo
*
dbInfo
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
)
{
int32_t
ctgGetVgInfoFromHashValue
(
SCatalog
*
pCtg
,
S
EpSet
*
pMgmtEps
,
S
DBVgInfo
*
dbInfo
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
CTG_ERR_RET
(
ctgMakeVgArray
(
dbInfo
));
CTG_ERR_RET
(
ctgMakeVgArray
(
dbInfo
));
...
@@ -977,6 +977,14 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName
...
@@ -977,6 +977,14 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName
char
db
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
char
db
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
pTableName
,
db
);
tNameGetFullDbName
(
pTableName
,
db
);
if
(
IS_SYS_DBNAME
(
pTableName
->
dbname
))
{
pVgroup
->
vgId
=
MNODE_HANDLE
;
if
(
pMgmtEps
)
{
memcpy
(
&
pVgroup
->
epSet
,
pMgmtEps
,
sizeof
(
pVgroup
->
epSet
));
}
return
TSDB_CODE_SUCCESS
;
}
if
(
vgNum
<=
0
)
{
if
(
vgNum
<=
0
)
{
ctgError
(
"db vgroup cache invalid, db:%s, vgroup number:%d"
,
db
,
vgNum
);
ctgError
(
"db vgroup cache invalid, db:%s, vgroup number:%d"
,
db
,
vgNum
);
CTG_ERR_RET
(
TSDB_CODE_TSC_DB_NOT_SELECTED
);
CTG_ERR_RET
(
TSDB_CODE_TSC_DB_NOT_SELECTED
);
...
@@ -1020,23 +1028,53 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName
...
@@ -1020,23 +1028,53 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName
CTG_RET
(
code
);
CTG_RET
(
code
);
}
}
int32_t
ctgGetVgInfosFromHashValue
(
SCatalog
*
pCtg
,
SCtgTaskReq
*
tReq
,
SDBVgInfo
*
dbInfo
,
SCtgTbHashsCtx
*
pCtx
,
int32_t
ctgGetVgInfosFromHashValue
(
SCatalog
*
pCtg
,
S
EpSet
*
pMgmgEpSet
,
S
CtgTaskReq
*
tReq
,
SDBVgInfo
*
dbInfo
,
SCtgTbHashsCtx
*
pCtx
,
char
*
dbFName
,
SArray
*
pNames
,
bool
update
)
{
char
*
dbFName
,
SArray
*
pNames
,
bool
update
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
SCtgTask
*
pTask
=
tReq
->
pTask
;
SCtgTask
*
pTask
=
tReq
->
pTask
;
SMetaRes
res
=
{
0
};
SMetaRes
res
=
{
0
};
SVgroupInfo
*
vgInfo
=
NULL
;
CTG_ERR_RET
(
ctgMakeVgArray
(
dbInfo
));
CTG_ERR_RET
(
ctgMakeVgArray
(
dbInfo
));
int32_t
tbNum
=
taosArrayGetSize
(
pNames
);
char
*
pSep
=
strchr
(
dbFName
,
'.'
);
if
(
pSep
&&
IS_SYS_DBNAME
(
pSep
+
1
))
{
SVgroupInfo
mgmtInfo
=
{
0
};
mgmtInfo
.
vgId
=
MNODE_HANDLE
;
if
(
pMgmgEpSet
)
{
memcpy
(
&
mgmtInfo
.
epSet
,
pMgmgEpSet
,
sizeof
(
mgmtInfo
.
epSet
));
}
for
(
int32_t
i
=
0
;
i
<
tbNum
;
++
i
)
{
vgInfo
=
taosMemoryMalloc
(
sizeof
(
SVgroupInfo
));
if
(
NULL
==
vgInfo
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
memcpy
(
vgInfo
,
&
mgmtInfo
,
sizeof
(
mgmtInfo
));
ctgDebug
(
"Got tb hash vgroup, vgId:%d, epNum %d, current %s port %d"
,
vgInfo
->
vgId
,
vgInfo
->
epSet
.
numOfEps
,
vgInfo
->
epSet
.
eps
[
vgInfo
->
epSet
.
inUse
].
fqdn
,
vgInfo
->
epSet
.
eps
[
vgInfo
->
epSet
.
inUse
].
port
);
if
(
update
)
{
SCtgFetch
*
pFetch
=
taosArrayGet
(
pCtx
->
pFetchs
,
tReq
->
msgIdx
);
SMetaRes
*
pRes
=
taosArrayGet
(
pCtx
->
pResList
,
pFetch
->
resIdx
+
i
);
pRes
->
pRes
=
vgInfo
;
}
else
{
res
.
pRes
=
vgInfo
;
taosArrayPush
(
pCtx
->
pResList
,
&
res
);
}
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
vgNum
=
taosArrayGetSize
(
dbInfo
->
vgArray
);
int32_t
vgNum
=
taosArrayGetSize
(
dbInfo
->
vgArray
);
if
(
vgNum
<=
0
)
{
if
(
vgNum
<=
0
)
{
ctgError
(
"db vgroup cache invalid, db:%s, vgroup number:%d"
,
dbFName
,
vgNum
);
ctgError
(
"db vgroup cache invalid, db:%s, vgroup number:%d"
,
dbFName
,
vgNum
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
}
}
SVgroupInfo
*
vgInfo
=
NULL
;
int32_t
tbNum
=
taosArrayGetSize
(
pNames
);
if
(
1
==
vgNum
)
{
if
(
1
==
vgNum
)
{
for
(
int32_t
i
=
0
;
i
<
tbNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
tbNum
;
++
i
)
{
vgInfo
=
taosMemoryMalloc
(
sizeof
(
SVgroupInfo
));
vgInfo
=
taosMemoryMalloc
(
sizeof
(
SVgroupInfo
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录