Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a8f3ccd5
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看板
提交
a8f3ccd5
编写于
1月 06, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] fix the usage of hash bug.
上级
b043c544
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
15 deletion
+15
-15
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+1
-1
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+13
-13
source/libs/parser/src/dCDAstProcess.c
source/libs/parser/src/dCDAstProcess.c
+1
-1
未找到文件。
include/libs/catalog/catalog.h
浏览文件 @
a8f3ccd5
...
...
@@ -72,7 +72,7 @@ int32_t catalogGetDBVgroupVersion(struct SCatalog* pCatalog, const char* dbName,
* @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller)
* @return error code
*/
int32_t
catalogGetDBVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
pDBName
,
int32_t
forceUpdate
,
SArray
**
pVgroupList
);
int32_t
catalogGetDBVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
pDBName
,
bool
forceUpdate
,
SArray
**
pVgroupList
);
int32_t
catalogUpdateDBVgroup
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbName
,
SDBVgroupInfo
*
dbInfo
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
a8f3ccd5
...
...
@@ -302,6 +302,7 @@ int32_t ctgGetVgInfoFromHashValue(SDBVgroupInfo *dbInfo, const SName *pTableName
while
(
pIter
)
{
vgInfo
=
pIter
;
if
(
hashValue
>=
vgInfo
->
hashBegin
&&
hashValue
<=
vgInfo
->
hashEnd
)
{
taosHashCancelIterate
(
dbInfo
->
vgInfo
,
pIter
);
break
;
}
...
...
@@ -309,6 +310,8 @@ int32_t ctgGetVgInfoFromHashValue(SDBVgroupInfo *dbInfo, const SName *pTableName
vgInfo
=
NULL
;
}
ctgInfo
(
"numOfVgroup:%d"
,
taosHashGetSize
(
dbInfo
->
vgInfo
));
if
(
NULL
==
vgInfo
)
{
ctgError
(
"no hash range found for hash value [%u], numOfVgId:%d"
,
hashValue
,
taosHashGetSize
(
dbInfo
->
vgInfo
));
...
...
@@ -325,7 +328,7 @@ int32_t ctgGetVgInfoFromHashValue(SDBVgroupInfo *dbInfo, const SName *pTableName
*
pVgroup
=
*
vgInfo
;
_return:
CTG_RET
(
TSDB_CODE_SUCCESS
);
CTG_RET
(
code
);
}
int32_t
ctgGetTableMetaImpl
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
bool
forceUpdate
,
STableMeta
**
pTableMeta
)
{
...
...
@@ -424,33 +427,30 @@ int32_t ctgUpdateTableMetaCache(struct SCatalog *pCatalog, STableMetaOutput *out
CTG_RET
(
code
);
}
int32_t
ctgGetDBVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
dbName
,
int32_t
forceUpdate
,
SDBVgroupInfo
**
dbInfo
)
{
int32_t
ctgGetDBVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
dbName
,
bool
forceUpdate
,
SDBVgroupInfo
**
dbInfo
)
{
bool
inCache
=
false
;
if
(
0
==
forceUpdate
)
{
if
(
!
forceUpdate
)
{
CTG_ERR_RET
(
ctgGetDBVgroupFromCache
(
pCatalog
,
dbName
,
dbInfo
,
&
inCache
));
if
(
inCache
)
{
return
TSDB_CODE_SUCCESS
;
}
ctgDebug
(
"failed to get DB vgroupInfo from cache, dbName:%s, load it from mnode, update:%d"
,
dbName
,
forceUpdate
);
}
SUseDbOutput
DbOut
=
{
0
};
SBuildUseDBInput
input
=
{
0
};
strncpy
(
input
.
db
,
dbName
,
sizeof
(
input
.
db
));
input
.
db
[
sizeof
(
input
.
db
)
-
1
]
=
0
;
tstrncpy
(
input
.
db
,
dbName
,
tListLen
(
input
.
db
));
input
.
vgVersion
=
CTG_DEFAULT_INVALID_VERSION
;
while
(
true
)
{
CTG_ERR_RET
(
ctgGetDBVgroupFromMnode
(
pCatalog
,
pRpc
,
pMgmtEps
,
&
input
,
&
DbOut
));
CTG_ERR_RET
(
catalogUpdateDBVgroup
(
pCatalog
,
dbName
,
&
DbOut
.
dbVgroup
));
CTG_ERR_RET
(
ctgGetDBVgroupFromCache
(
pCatalog
,
dbName
,
dbInfo
,
&
inCache
));
if
(
!
inCache
)
{
ctgWarn
(
"get
db vgroup from cache failed, db
:%s"
,
dbName
);
ctgWarn
(
"get
DB vgroupInfo from cache failed, dbName
:%s"
,
dbName
);
continue
;
}
...
...
@@ -573,14 +573,15 @@ int32_t catalogGetDBVgroupVersion(struct SCatalog* pCatalog, const char* dbName,
return
TSDB_CODE_SUCCESS
;
}
int32_t
catalogGetDBVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
dbName
,
int32_t
forceUpdate
,
SArray
**
vgroupList
)
{
int32_t
catalogGetDBVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
dbName
,
bool
forceUpdate
,
SArray
**
vgroupList
)
{
if
(
NULL
==
pCatalog
||
NULL
==
dbName
||
NULL
==
pRpc
||
NULL
==
pMgmtEps
||
NULL
==
vgroupList
)
{
CTG_ERR_RET
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
SDBVgroupInfo
*
db
=
NULL
;
int32_t
code
=
0
;
SVgroupInfo
*
vgInfo
=
NULL
;
int32_t
code
=
0
;
SArray
*
vgList
=
NULL
;
CTG_ERR_JRET
(
ctgGetDBVgroup
(
pCatalog
,
pRpc
,
pMgmtEps
,
dbName
,
forceUpdate
,
&
db
));
...
...
@@ -776,7 +777,6 @@ int32_t catalogGetTableHashVgroup(struct SCatalog *pCatalog, void *pTransporter,
tNameGetFullDbName
(
pTableName
,
db
);
CTG_ERR_RET
(
ctgGetDBVgroup
(
pCatalog
,
pTransporter
,
pMgmtEps
,
db
,
false
,
&
dbInfo
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
dbInfo
,
pTableName
,
pVgroup
));
_return:
...
...
source/libs/parser/src/dCDAstProcess.c
浏览文件 @
a8f3ccd5
...
...
@@ -43,7 +43,7 @@ static int32_t setShowInfo(SShowInfo* pShowInfo, SParseBasicCtx* pCtx, void** ou
char
dbFname
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
name
,
dbFname
);
catalogGetDBVgroup
(
pCtx
->
pCatalog
,
pCtx
->
pTransporter
,
&
pCtx
->
mgmtEpSet
,
dbFname
,
0
,
&
array
);
catalogGetDBVgroup
(
pCtx
->
pCatalog
,
pCtx
->
pTransporter
,
&
pCtx
->
mgmtEpSet
,
dbFname
,
false
,
&
array
);
SVgroupInfo
*
info
=
taosArrayGet
(
array
,
0
);
pShowReq
->
head
.
vgId
=
htonl
(
info
->
vgId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录