Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f6acf035
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f6acf035
编写于
2月 24, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: sys db vgroup update issue
上级
8ea6b545
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
60 addition
and
27 deletion
+60
-27
include/libs/qcom/query.h
include/libs/qcom/query.h
+5
-3
source/client/src/clientHb.c
source/client/src/clientHb.c
+54
-24
tests/system-test/7-tmq/tmq_taosx.py
tests/system-test/7-tmq/tmq_taosx.py
+1
-0
未找到文件。
include/libs/qcom/query.h
浏览文件 @
f6acf035
...
...
@@ -26,6 +26,7 @@ extern "C" {
#include "tlog.h"
#include "tmsg.h"
#include "tmsgcb.h"
#include "systable.h"
typedef
enum
{
JOB_TASK_STATUS_NULL
=
0
,
...
...
@@ -284,9 +285,10 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
#define REQUEST_TOTAL_EXEC_TIMES 2
#define IS_SYS_DBNAME(_dbname) \
(((*(_dbname) == 'i') && (0 == strcmp(_dbname, TSDB_INFORMATION_SCHEMA_DB))) || \
((*(_dbname) == 'p') && (0 == strcmp(_dbname, TSDB_PERFORMANCE_SCHEMA_DB))))
#define IS_INFORMATION_SCHEMA_DB(_name) ((*(_name) == 'i') && (0 == strcmp(_name, TSDB_INFORMATION_SCHEMA_DB)))
#define IS_PERFORMANCE_SCHEMA_DB(_name) ((*(_name) == 'p') && (0 == strcmp(_name, TSDB_PERFORMANCE_SCHEMA_DB)))
#define IS_SYS_DBNAME(_dbname) (IS_INFORMATION_SCHEMA_DB(_dbname) || IS_PERFORMANCE_SCHEMA_DB(_dbname))
#define qFatal(...) \
do { \
...
...
source/client/src/clientHb.c
浏览文件 @
f6acf035
...
...
@@ -49,6 +49,48 @@ static int32_t hbProcessUserAuthInfoRsp(void *value, int32_t valueLen, struct SC
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
hbGenerateVgInfoFromRsp
(
SDBVgInfo
**
pInfo
,
SUseDbRsp
*
rsp
)
{
int32_t
code
=
0
;
SDBVgInfo
*
vgInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SDBVgInfo
));
if
(
NULL
==
vgInfo
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
code
;
}
vgInfo
->
vgVersion
=
rsp
->
vgVersion
;
vgInfo
->
stateTs
=
rsp
->
stateTs
;
vgInfo
->
hashMethod
=
rsp
->
hashMethod
;
vgInfo
->
hashPrefix
=
rsp
->
hashPrefix
;
vgInfo
->
hashSuffix
=
rsp
->
hashSuffix
;
vgInfo
->
vgHash
=
taosHashInit
(
rsp
->
vgNum
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
,
HASH_ENTRY_LOCK
);
if
(
NULL
==
vgInfo
->
vgHash
)
{
taosMemoryFree
(
vgInfo
);
tscError
(
"hash init[%d] failed"
,
rsp
->
vgNum
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_return
;
}
for
(
int32_t
j
=
0
;
j
<
rsp
->
vgNum
;
++
j
)
{
SVgroupInfo
*
pInfo
=
taosArrayGet
(
rsp
->
pVgroupInfos
,
j
);
if
(
taosHashPut
(
vgInfo
->
vgHash
,
&
pInfo
->
vgId
,
sizeof
(
int32_t
),
pInfo
,
sizeof
(
SVgroupInfo
))
!=
0
)
{
tscError
(
"hash push failed, errno:%d"
,
errno
);
taosHashCleanup
(
vgInfo
->
vgHash
);
taosMemoryFree
(
vgInfo
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_return
;
}
}
_return:
if
(
code
)
{
taosHashCleanup
(
vgInfo
->
vgHash
);
taosMemoryFreeClear
(
vgInfo
);
}
*
pInfo
=
vgInfo
;
return
code
;
}
static
int32_t
hbProcessDBInfoRsp
(
void
*
value
,
int32_t
valueLen
,
struct
SCatalog
*
pCatalog
)
{
int32_t
code
=
0
;
...
...
@@ -67,37 +109,22 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
if
(
rsp
->
vgVersion
<
0
)
{
code
=
catalogRemoveDB
(
pCatalog
,
rsp
->
db
,
rsp
->
uid
);
}
else
{
SDBVgInfo
*
vgInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SDBVgInfo
))
;
if
(
NULL
==
vgInfo
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
SDBVgInfo
*
vgInfo
=
NULL
;
code
=
hbGenerateVgInfoFromRsp
(
&
vgInfo
,
rsp
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
goto
_return
;
}
vgInfo
->
vgVersion
=
rsp
->
vgVersion
;
vgInfo
->
stateTs
=
rsp
->
stateTs
;
vgInfo
->
hashMethod
=
rsp
->
hashMethod
;
vgInfo
->
hashPrefix
=
rsp
->
hashPrefix
;
vgInfo
->
hashSuffix
=
rsp
->
hashSuffix
;
vgInfo
->
vgHash
=
taosHashInit
(
rsp
->
vgNum
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
,
HASH_ENTRY_LOCK
);
if
(
NULL
==
vgInfo
->
vgHash
)
{
taosMemoryFree
(
vgInfo
);
tscError
(
"hash init[%d] failed"
,
rsp
->
vgNum
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_return
;
}
catalogUpdateDBVgInfo
(
pCatalog
,
rsp
->
db
,
rsp
->
uid
,
vgInfo
);
for
(
int32_t
j
=
0
;
j
<
rsp
->
vgNum
;
++
j
)
{
SVgroupInfo
*
pInfo
=
taosArrayGet
(
rsp
->
pVgroupInfos
,
j
);
if
(
taosHashPut
(
vgInfo
->
vgHash
,
&
pInfo
->
vgId
,
sizeof
(
int32_t
),
pInfo
,
sizeof
(
SVgroupInfo
))
!=
0
)
{
tscError
(
"hash push failed, errno:%d"
,
errno
);
taosHashCleanup
(
vgInfo
->
vgHash
);
taosMemoryFree
(
vgInfo
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
if
(
IS_SYS_DBNAME
(
rsp
->
db
))
{
code
=
hbGenerateVgInfoFromRsp
(
&
vgInfo
,
rsp
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
goto
_return
;
}
}
catalogUpdateDBVgInfo
(
pCatalog
,
rsp
->
db
,
rsp
->
uid
,
vgInfo
);
catalogUpdateDBVgInfo
(
pCatalog
,
(
rsp
->
db
[
0
]
==
'i'
)
?
TSDB_PERFORMANCE_SCHEMA_DB
:
TSDB_INFORMATION_SCHEMA_DB
,
rsp
->
uid
,
vgInfo
);
}
}
if
(
code
)
{
...
...
@@ -492,6 +519,9 @@ int32_t hbGetExpiredDBInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SCl
for
(
int32_t
i
=
0
;
i
<
dbNum
;
++
i
)
{
SDbVgVersion
*
db
=
&
dbs
[
i
];
tscDebug
(
"the %dth expired dbFName:%s, dbId:%"
PRId64
", vgVersion:%d, numOfTable:%d, startTs:%"
PRId64
,
i
,
db
->
dbFName
,
db
->
dbId
,
db
->
vgVersion
,
db
->
numOfTable
,
db
->
stateTs
);
db
->
dbId
=
htobe64
(
db
->
dbId
);
db
->
vgVersion
=
htonl
(
db
->
vgVersion
);
db
->
numOfTable
=
htonl
(
db
->
numOfTable
);
...
...
tests/system-test/7-tmq/tmq_taosx.py
浏览文件 @
f6acf035
...
...
@@ -195,6 +195,7 @@ class TDTestCase:
tdSql
.
checkData
(
1
,
1
,
1
)
tdSql
.
checkData
(
1
,
2
,
'{"k1":1,"k2":"hello"}'
)
time
.
sleep
(
10
)
tdSql
.
query
(
"select * from information_schema.ins_tables where table_name = 'stt4'"
)
uid1
=
tdSql
.
getData
(
0
,
5
)
uid2
=
tdSql
.
getData
(
1
,
5
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录