Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bf4efa77
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看板
提交
bf4efa77
编写于
2月 25, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
5a383152
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
137 addition
and
101 deletion
+137
-101
source/common/src/tname.c
source/common/src/tname.c
+3
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+2
-1
source/dnode/mnode/impl/src/mndInfoSchema.c
source/dnode/mnode/impl/src/mndInfoSchema.c
+83
-85
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+2
-1
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+40
-9
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+5
-2
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+2
-2
未找到文件。
source/common/src/tname.c
浏览文件 @
bf4efa77
...
...
@@ -111,7 +111,9 @@ int32_t tNameExtractFullName(const SName* name, char* dst) {
return
-
1
;
}
int32_t
len
=
snprintf
(
dst
,
TSDB_DB_FNAME_LEN
,
"%d.%s"
,
name
->
acctId
,
name
->
dbname
);
int32_t
len
=
0
;
snprintf
(
dst
,
TSDB_DB_FNAME_LEN
,
"%d.%s"
,
name
->
acctId
,
name
->
dbname
);
size_t
tnameLen
=
strlen
(
name
->
tname
);
if
(
tnameLen
>
0
)
{
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
bf4efa77
...
...
@@ -937,7 +937,8 @@ static int32_t mndProcessUseDbReq(SMnodeMsg *pReq) {
goto
USE_DB_OVER
;
}
if
(
0
==
strcmp
(
usedbReq
.
db
,
TSDB_INFORMATION_SCHEMA_DB
))
{
char
*
p
=
strchr
(
usedbReq
.
db
,
'.'
);
if
(
p
&&
0
==
strcmp
(
p
+
1
,
TSDB_INFORMATION_SCHEMA_DB
))
{
memcpy
(
usedbRsp
.
db
,
usedbReq
.
db
,
TSDB_DB_FNAME_LEN
);
}
else
{
pDb
=
mndAcquireDb
(
pMnode
,
usedbReq
.
db
);
...
...
source/dnode/mnode/impl/src/mndInfoSchema.c
浏览文件 @
bf4efa77
此差异已折叠。
点击以展开。
source/libs/catalog/inc/catalogInt.h
浏览文件 @
bf4efa77
...
...
@@ -198,11 +198,12 @@ typedef struct SCtgAction {
#define CTG_IS_NOT_STB(_flag) ((_flag) & CTG_FLAG_NOT_STB)
#define CTG_IS_UNKNOWN_STB(_flag) ((_flag) & CTG_FLAG_UNKNOWN_STB)
#define CTG_IS_INF_DB(_flag) ((_flag) & CTG_FLAG_INF_DB)
#define CTG_SET_INF_DB(_flag) ((_flag) |= CTG_FLAG_INF_DB)
#define CTG_SET_STB(_flag, tbType) do { (_flag) |= ((tbType) == TSDB_SUPER_TABLE) ? CTG_FLAG_STB : ((tbType) > TSDB_SUPER_TABLE ? CTG_FLAG_NOT_STB : CTG_FLAG_UNKNOWN_STB); } while (0)
#define CTG_GEN_STB_FLAG(_isStb) ((_isStb) == 1) ? CTG_FLAG_STB : ((_isStb) == 0 ? CTG_FLAG_NOT_STB : CTG_FLAG_UNKNOWN_STB)
#define CTG_TBTYPE_MATCH(_flag, tbType) (CTG_IS_UNKNOWN_STB(_flag) || (CTG_IS_STB(_flag) && (tbType) == TSDB_SUPER_TABLE) || (CTG_IS_NOT_STB(_flag) && (tbType) != TSDB_SUPER_TABLE))
#define CTG_IS_INF_DBNAME(_
sname) ((_sname)->dbname[0] == 'i' && 0 == strcmp((_sname)->dbname, TSDB_INFORMATION_SCHEMA_DB
))
#define CTG_IS_INF_DBNAME(_
dbname) ((*(_dbname) == 'i') && (0 == strcmp(_dbname, TSDB_INFORMATION_SCHEMA_DB)
))
#define CTG_META_SIZE(pMeta) (sizeof(STableMeta) + ((pMeta)->tableInfo.numOfTags + (pMeta)->tableInfo.numOfColumns) * sizeof(SSchema))
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
bf4efa77
...
...
@@ -509,7 +509,7 @@ int32_t ctgIsTableMetaExistInCache(SCatalog* pCtg, char *dbFName, char* tbName,
}
int32_t
ctgGetTableMetaFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
,
int32_t
*
exist
)
{
int32_t
ctgGetTableMetaFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
,
int32_t
*
exist
,
int32_t
flag
)
{
if
(
NULL
==
pCtg
->
dbCache
)
{
*
exist
=
0
;
ctgWarn
(
"empty tbmeta cache, tbName:%s"
,
pTableName
->
tname
);
...
...
@@ -517,7 +517,11 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable
}
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
pTableName
,
dbFName
);
if
(
CTG_IS_INF_DB
(
flag
))
{
strcpy
(
dbFName
,
pTableName
->
dbname
);
}
else
{
tNameGetFullDbName
(
pTableName
,
dbFName
);
}
*
pTableMeta
=
NULL
;
...
...
@@ -590,15 +594,19 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgGetTableTypeFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
int32_t
*
tbType
)
{
int32_t
ctgGetTableTypeFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
int32_t
*
tbType
,
int32_t
flag
)
{
if
(
NULL
==
pCtg
->
dbCache
)
{
ctgWarn
(
"empty db cache, tbName:%s"
,
pTableName
->
tname
);
return
TSDB_CODE_SUCCESS
;
}
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
pTableName
,
dbFName
);
if
(
CTG_IS_INF_DB
(
flag
))
{
strcpy
(
dbFName
,
pTableName
->
dbname
);
}
else
{
tNameGetFullDbName
(
pTableName
,
dbFName
);
}
SCtgDBCache
*
dbCache
=
NULL
;
ctgAcquireDBCache
(
pCtg
,
dbFName
,
&
dbCache
);
if
(
NULL
==
dbCache
)
{
...
...
@@ -1078,6 +1086,10 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
ctgDebug
(
"db added to cache, dbFName:%s, dbId:%"
PRIx64
,
dbFName
,
dbId
);
if
(
CTG_IS_INF_DBNAME
(
dbFName
))
{
return
TSDB_CODE_SUCCESS
;
}
CTG_ERR_RET
(
ctgMetaRentAdd
(
&
pCtg
->
dbRent
,
&
vgVersion
,
dbId
,
sizeof
(
SDbVgVersion
)));
ctgDebug
(
"db added to rent, dbFName:%s, vgVersion:%d, dbId:%"
PRIx64
,
dbFName
,
vgVersion
.
vgVersion
,
dbId
);
...
...
@@ -1544,8 +1556,12 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
int32_t
exist
=
0
;
int32_t
code
=
0
;
if
((
!
forceUpdate
)
||
(
CTG_IS_INF_DBNAME
(
pTableName
)))
{
CTG_ERR_RET
(
ctgGetTableMetaFromCache
(
pCtg
,
pTableName
,
pTableMeta
,
&
exist
));
if
(
CTG_IS_INF_DBNAME
(
pTableName
->
dbname
))
{
CTG_SET_INF_DB
(
flag
);
}
if
((
!
forceUpdate
)
||
(
CTG_IS_INF_DB
(
flag
)))
{
CTG_ERR_RET
(
ctgGetTableMetaFromCache
(
pCtg
,
pTableName
,
pTableMeta
,
&
exist
,
flag
));
if
(
exist
&&
CTG_TBTYPE_MATCH
(
flag
,
(
*
pTableMeta
)
->
tableType
))
{
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1555,7 +1571,7 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
}
else
if
(
CTG_IS_UNKNOWN_STB
(
flag
))
{
int32_t
tbType
=
0
;
CTG_ERR_RET
(
ctgGetTableTypeFromCache
(
pCtg
,
pTableName
,
&
tbType
));
CTG_ERR_RET
(
ctgGetTableTypeFromCache
(
pCtg
,
pTableName
,
&
tbType
,
flag
));
CTG_SET_STB
(
flag
,
tbType
);
}
...
...
@@ -1588,7 +1604,7 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
SName
stbName
=
*
pTableName
;
strcpy
(
stbName
.
tname
,
output
->
tbName
);
CTG_ERR_JRET
(
ctgGetTableMetaFromCache
(
pCtg
,
&
stbName
,
pTableMeta
,
&
exist
));
CTG_ERR_JRET
(
ctgGetTableMetaFromCache
(
pCtg
,
&
stbName
,
pTableMeta
,
&
exist
,
flag
));
if
(
0
==
exist
)
{
ctgDebug
(
"stb no longer exist, dbFName:%s, tbName:%s"
,
output
->
dbFName
,
pTableName
->
tname
);
continue
;
...
...
@@ -1669,6 +1685,11 @@ int32_t ctgActUpdateTbl(SCtgMetaAction *action) {
CTG_ERR_JRET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
}
char
*
p
=
strchr
(
output
->
dbFName
,
'.'
);
if
(
p
&&
CTG_IS_INF_DBNAME
(
p
+
1
))
{
memmove
(
output
->
dbFName
,
p
+
1
,
strlen
(
p
+
1
));
}
CTG_ERR_JRET
(
ctgGetAddDBCache
(
pCtg
,
output
->
dbFName
,
output
->
dbId
,
&
dbCache
));
if
(
NULL
==
dbCache
)
{
ctgInfo
(
"conflict db update, ignore this update, dbFName:%s, dbId:%"
PRIx64
,
output
->
dbFName
,
output
->
dbId
);
...
...
@@ -2232,6 +2253,11 @@ int32_t catalogGetTableDistVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgm
if
(
NULL
==
pCtg
||
NULL
==
pRpc
||
NULL
==
pMgmtEps
||
NULL
==
pTableName
||
NULL
==
pVgList
)
{
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
if
(
CTG_IS_INF_DBNAME
(
pTableName
->
dbname
))
{
ctgError
(
"no valid vgInfo for db, dbname:%s"
,
pTableName
->
dbname
);
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
STableMeta
*
tbMeta
=
NULL
;
int32_t
code
=
0
;
...
...
@@ -2316,6 +2342,11 @@ _return:
int32_t
catalogGetTableHashVgroup
(
SCatalog
*
pCtg
,
void
*
pTrans
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
)
{
CTG_API_ENTER
();
if
(
CTG_IS_INF_DBNAME
(
pTableName
->
dbname
))
{
ctgError
(
"no valid vgInfo for db, dbname:%s"
,
pTableName
->
dbname
);
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
SCtgDBCache
*
dbCache
=
NULL
;
int32_t
code
=
0
;
char
db
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
bf4efa77
...
...
@@ -38,7 +38,7 @@
namespace
{
extern
"C"
int32_t
ctgGetTableMetaFromCache
(
struct
SCatalog
*
pCatalog
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
,
int32_t
*
exist
);
int32_t
*
exist
,
int32_t
flag
);
extern
"C"
int32_t
ctgDbgGetClusterCacheNum
(
struct
SCatalog
*
pCatalog
,
int32_t
type
);
extern
"C"
int32_t
ctgActUpdateTbl
(
SCtgMetaAction
*
action
);
extern
"C"
int32_t
ctgDbgEnableDebug
(
char
*
option
);
...
...
@@ -243,6 +243,8 @@ void ctgTestBuildSTableMetaRsp(STableMetaRsp *rspMsg) {
rspMsg
->
suid
=
ctgTestSuid
+
1
;
rspMsg
->
tuid
=
ctgTestSuid
+
1
;
rspMsg
->
vgId
=
1
;
rspMsg
->
pSchemas
=
(
SSchema
*
)
calloc
(
rspMsg
->
numOfTags
+
rspMsg
->
numOfColumns
,
sizeof
(
SSchema
));
SSchema
*
s
=
NULL
;
s
=
&
rspMsg
->
pSchemas
[
0
];
...
...
@@ -770,7 +772,7 @@ void *ctgTestGetCtableMetaThread(void *param) {
strcpy
(
cn
.
tname
,
ctgTestCTablename
);
while
(
!
ctgTestStop
)
{
code
=
ctgGetTableMetaFromCache
(
pCtg
,
&
cn
,
&
tbMeta
,
&
exist
);
code
=
ctgGetTableMetaFromCache
(
pCtg
,
&
cn
,
&
tbMeta
,
&
exist
,
0
);
if
(
code
||
0
==
exist
)
{
assert
(
0
);
}
...
...
@@ -1290,6 +1292,7 @@ TEST(tableMeta, updateStbMeta) {
code = catalogUpdateSTableMeta(pCtg, &rsp);
ASSERT_EQ(code, 0);
tfree(rsp.pSchemas);
while (true) {
uint64_t n = 0;
...
...
source/libs/qcom/src/querymsg.c
浏览文件 @
bf4efa77
...
...
@@ -198,7 +198,7 @@ int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isSuperTable, STabl
}
int32_t
queryProcessTableMetaRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
int32_t
code
=
-
1
;
int32_t
code
=
0
;
STableMetaRsp
metaRsp
=
{
0
};
if
(
NULL
==
output
||
NULL
==
msg
||
msgSize
<=
0
)
{
...
...
@@ -216,7 +216,7 @@ int32_t queryProcessTableMetaRsp(void *output, char *msg, int32_t msgSize) {
goto
PROCESS_META_OVER
;
}
if
(
!
tIsValidSchema
(
metaRsp
.
pSchemas
,
metaRsp
.
numOfColumns
,
metaRsp
.
numOfTags
))
{
if
(
0
!=
strcmp
(
metaRsp
.
dbFName
,
TSDB_INFORMATION_SCHEMA_DB
)
&&
!
tIsValidSchema
(
metaRsp
.
pSchemas
,
metaRsp
.
numOfColumns
,
metaRsp
.
numOfTags
))
{
code
=
TSDB_CODE_TSC_INVALID_VALUE
;
goto
PROCESS_META_OVER
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录