Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0627cead
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0627cead
编写于
6月 09, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: systable vgroup empty issue
上级
422a6043
变更
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
浏览文件 @
0627cead
...
...
@@ -950,8 +950,8 @@ int32_t ctgCloneMetaOutput(STableMetaOutput* output, STableMetaOutput** pOutput)
int32_t
ctgGenerateVgList
(
SCatalog
*
pCtg
,
SHashObj
*
vgHash
,
SArray
**
pList
);
void
ctgFreeJob
(
void
*
job
);
void
ctgFreeHandleImpl
(
SCatalog
*
pCtg
);
int32_t
ctgGetVgInfoFromHashValue
(
SCatalog
*
pCtg
,
SDBVgInfo
*
dbInfo
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
);
int32_t
ctgGetVgInfosFromHashValue
(
SCatalog
*
pCtg
,
SCtgTaskReq
*
tReq
,
SDBVgInfo
*
dbInfo
,
SCtgTbHashsCtx
*
pCtx
,
int32_t
ctgGetVgInfoFromHashValue
(
SCatalog
*
pCtg
,
S
EpSet
*
pMgmtEps
,
S
DBVgInfo
*
dbInfo
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
);
int32_t
ctgGetVgInfosFromHashValue
(
SCatalog
*
pCtg
,
S
EpSet
*
pMgmgEpSet
,
S
CtgTaskReq
*
tReq
,
SDBVgInfo
*
dbInfo
,
SCtgTbHashsCtx
*
pCtx
,
char
*
dbFName
,
SArray
*
pNames
,
bool
update
);
int32_t
ctgGetVgIdsFromHashValue
(
SCatalog
*
pCtg
,
SDBVgInfo
*
dbInfo
,
char
*
dbFName
,
const
char
*
pTbs
[],
int32_t
tbNum
,
int32_t
*
vgId
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
0627cead
...
...
@@ -568,7 +568,7 @@ int32_t ctgGetTbHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName*
return
TSDB_CODE_SUCCESS
;
}
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
vgInfo
?
vgInfo
:
dbCache
->
vgCache
.
vgInfo
,
pTableName
,
pVgroup
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
&
pConn
->
mgmtEps
,
vgInfo
?
vgInfo
:
dbCache
->
vgCache
.
vgInfo
,
pTableName
,
pVgroup
));
_return:
...
...
@@ -629,7 +629,7 @@ int32_t ctgGetCachedTbVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInf
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
);
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
0627cead
...
...
@@ -1112,7 +1112,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
SUseDbOutput
*
pOut
=
(
SUseDbOutput
*
)
pMsgCtx
->
out
;
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
);
...
...
@@ -1132,7 +1132,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
dbFName
,
&
dbCache
));
if
(
NULL
!=
dbCache
)
{
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
);
...
...
@@ -1282,7 +1282,7 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
SUseDbOutput
*
pOut
=
(
SUseDbOutput
*
)
pMsgCtx
->
out
;
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
);
...
...
@@ -1302,7 +1302,7 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
dbFName
,
&
dbCache
));
if
(
NULL
!=
dbCache
)
{
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
);
...
...
@@ -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
(
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
));
pOut
->
dbVgroup
=
NULL
;
...
...
@@ -1536,7 +1536,7 @@ int32_t ctgHandleGetTbHashsRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
SUseDbOutput
*
pOut
=
(
SUseDbOutput
*
)
pMsgCtx
->
out
;
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
));
pOut
->
dbVgroup
=
NULL
;
...
...
@@ -1799,7 +1799,7 @@ int32_t ctgAsyncRefreshTbMeta(SCtgTaskReq* tReq, int32_t flag, SName* pName, int
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
dbFName
,
&
dbCache
));
if
(
dbCache
)
{
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
);
...
...
@@ -1948,7 +1948,7 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask* pTask) {
if
(
NULL
==
pTask
->
res
)
{
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
);
dbCache
=
NULL
;
...
...
@@ -1996,7 +1996,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
tReq
.
pTask
=
pTask
;
tReq
.
msgIdx
=
-
1
;
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
);
dbCache
=
NULL
;
...
...
@@ -2375,7 +2375,7 @@ int32_t ctgGetTbCfgCb(SCtgTask* pTask) {
SDBVgInfo
*
pDb
=
(
SDBVgInfo
*
)
pTask
->
subRes
.
res
;
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
));
...
...
@@ -2395,7 +2395,7 @@ int32_t ctgGetTbTagCb(SCtgTask* pTask) {
if
(
NULL
==
pCtx
->
pVgInfo
)
{
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
));
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
0627cead
...
...
@@ -2989,7 +2989,7 @@ int32_t ctgGetTbHashVgroupFromCache(SCatalog *pCtg, const SName *pTableName, SVg
}
*
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:
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
0627cead
...
...
@@ -969,7 +969,7 @@ int32_t ctgHashValueComp(void const* lp, void const* rp) {
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
;
CTG_ERR_RET
(
ctgMakeVgArray
(
dbInfo
));
...
...
@@ -977,6 +977,14 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName
char
db
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
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
)
{
ctgError
(
"db vgroup cache invalid, db:%s, vgroup number:%d"
,
db
,
vgNum
);
CTG_ERR_RET
(
TSDB_CODE_TSC_DB_NOT_SELECTED
);
...
...
@@ -1020,23 +1028,53 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName
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
)
{
int32_t
code
=
0
;
SCtgTask
*
pTask
=
tReq
->
pTask
;
SMetaRes
res
=
{
0
};
SVgroupInfo
*
vgInfo
=
NULL
;
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
);
if
(
vgNum
<=
0
)
{
ctgError
(
"db vgroup cache invalid, db:%s, vgroup number:%d"
,
dbFName
,
vgNum
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
}
SVgroupInfo
*
vgInfo
=
NULL
;
int32_t
tbNum
=
taosArrayGetSize
(
pNames
);
if
(
1
==
vgNum
)
{
for
(
int32_t
i
=
0
;
i
<
tbNum
;
++
i
)
{
vgInfo
=
taosMemoryMalloc
(
sizeof
(
SVgroupInfo
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录