Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5c7332c2
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
5c7332c2
编写于
12月 13, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
catalog update
上级
3d5f9a24
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
138 addition
and
33 deletion
+138
-33
include/common/taosmsg.h
include/common/taosmsg.h
+7
-0
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+27
-9
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/common/src/tmessage.c
source/common/src/tmessage.c
+64
-3
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+17
-1
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+21
-3
source/libs/parser/src/parserUtil.c
source/libs/parser/src/parserUtil.c
+0
-17
source/util/src/terror.c
source/util/src/terror.c
+1
-0
未找到文件。
include/common/taosmsg.h
浏览文件 @
5c7332c2
...
@@ -214,6 +214,12 @@ typedef enum _mgmt_table {
...
@@ -214,6 +214,12 @@ typedef enum _mgmt_table {
extern
char
*
taosMsg
[];
extern
char
*
taosMsg
[];
typedef
struct
SBuildTableMetaInput
{
int32_t
vgId
;
STagData
*
tagData
;
char
*
tableFullName
;
}
SBuildTableMetaInput
;
#pragma pack(push, 1)
#pragma pack(push, 1)
// null-terminated string instead of char array to avoid too many memory consumption in case of more than 1M tableMeta
// null-terminated string instead of char array to avoid too many memory consumption in case of more than 1M tableMeta
...
@@ -768,6 +774,7 @@ typedef struct {
...
@@ -768,6 +774,7 @@ typedef struct {
}
SStableInfoMsg
;
}
SStableInfoMsg
;
typedef
struct
{
typedef
struct
{
SMsgHead
msgHead
;
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
int8_t
createFlag
;
int8_t
createFlag
;
char
tags
[];
char
tags
[];
...
...
include/libs/catalog/catalog.h
浏览文件 @
5c7332c2
...
@@ -30,6 +30,19 @@ extern "C" {
...
@@ -30,6 +30,19 @@ extern "C" {
struct
SCatalog
;
struct
SCatalog
;
typedef
struct
SVgroupInfo
{
int32_t
vgId
;
int8_t
numOfEps
;
SEpAddrMsg
epAddr
[
TSDB_MAX_REPLICA
];
}
SVgroupInfo
;
typedef
struct
SDBVgroupInfo
{
int32_t
vgroupVersion
;
SArray
*
vgId
;
int32_t
hashRange
;
int32_t
hashNum
;
}
SDBVgroupInfo
;
typedef
struct
SCatalogReq
{
typedef
struct
SCatalogReq
{
char
clusterId
[
TSDB_CLUSTER_ID_LEN
];
//????
char
clusterId
[
TSDB_CLUSTER_ID_LEN
];
//????
SArray
*
pTableName
;
// table full name
SArray
*
pTableName
;
// table full name
...
@@ -38,8 +51,8 @@ typedef struct SCatalogReq {
...
@@ -38,8 +51,8 @@ typedef struct SCatalogReq {
}
SCatalogReq
;
}
SCatalogReq
;
typedef
struct
SCatalogRsp
{
typedef
struct
SCatalogRsp
{
SArray
*
pTableMeta
;
//
tableMeta
SArray
*
pTableMeta
;
//
STableMeta array
SArray
*
pVgroupInfo
;
//
v
groupInfo list
SArray
*
pVgroupInfo
;
//
SV
groupInfo list
SArray
*
pUdfList
;
// udf info list
SArray
*
pUdfList
;
// udf info list
SEpSet
*
pEpSet
;
// qnode epset list
SEpSet
*
pEpSet
;
// qnode epset list
}
SCatalogRsp
;
}
SCatalogRsp
;
...
@@ -78,11 +91,6 @@ typedef struct STableMeta {
...
@@ -78,11 +91,6 @@ typedef struct STableMeta {
SSchema
schema
[];
SSchema
schema
[];
}
STableMeta
;
}
STableMeta
;
typedef
struct
SCatalogCfg
{
}
SCatalogCfg
;
int32_t
catalogInit
(
SCatalog
*
cfg
);
int32_t
catalogInit
(
SCatalog
*
cfg
);
/**
/**
...
@@ -91,9 +99,19 @@ int32_t catalogInit(SCatalog *cfg);
...
@@ -91,9 +99,19 @@ int32_t catalogInit(SCatalog *cfg);
* @param clusterId
* @param clusterId
* @return
* @return
*/
*/
struct
SCatalog
*
catalogGetHandle
(
const
char
*
clusterId
);
int32_t
catalogGetHandle
(
const
char
*
clusterId
,
struct
SCatalog
**
catalogHandle
);
int32_t
catalogGetVgroupVersion
(
struct
SCatalog
*
pCatalog
,
int32_t
*
version
);
int32_t
catalogUpdateVgroupList
(
struct
SCatalog
*
pCatalog
,
int32_t
version
,
SArray
*
vgroupList
);
int32_t
catalogGetDBVgroupVersion
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbName
,
int32_t
*
version
);
int32_t
catalogGetDBVgroupInfo
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbName
,
SDBVgroupInfo
*
dbInfo
);
int32_t
catalogUpdateDBVgroupInfo
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbName
,
SDBVgroupInfo
*
dbInfo
);
int32_t
catalogGetTableMeta
(
struct
SCatalog
*
pCatalog
,
const
SEpSet
*
pMgmtEps
,
const
char
*
pTableName
,
const
STagData
*
tagData
,
STableMeta
*
pTableMeta
);
int32_t
catalogGetTableMeta
(
struct
SCatalog
*
pCatalog
,
SRpcObj
*
pRpcObj
,
const
SEpSet
*
pMgmtEps
,
const
char
*
pTableName
,
const
STagData
*
tagData
,
STableMeta
*
pTableMeta
);
/**
/**
...
...
include/util/taoserror.h
浏览文件 @
5c7332c2
...
@@ -117,6 +117,7 @@ int32_t* taosGetErrno();
...
@@ -117,6 +117,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TSC_INVALID_JSON TAOS_DEF_ERROR_CODE(0, 0x0221) //"Invalid JSON format")
#define TSDB_CODE_TSC_INVALID_JSON TAOS_DEF_ERROR_CODE(0, 0x0221) //"Invalid JSON format")
#define TSDB_CODE_TSC_INVALID_JSON_TYPE TAOS_DEF_ERROR_CODE(0, 0x0222) //"Invalid JSON data type")
#define TSDB_CODE_TSC_INVALID_JSON_TYPE TAOS_DEF_ERROR_CODE(0, 0x0222) //"Invalid JSON data type")
#define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0223) //"Value out of range")
#define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0223) //"Value out of range")
#define TSDB_CODE_TSC_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0X0224) //"Invalid tsc input")
// mnode
// mnode
#define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300)
#define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300)
...
...
source/common/src/tmessage.c
浏览文件 @
5c7332c2
...
@@ -17,14 +17,16 @@
...
@@ -17,14 +17,16 @@
#include "taosmsg.h"
#include "taosmsg.h"
int32_t
(
*
tscBuildMsg
[
TSDB_MSG_TYPE_MAX
])(
void
*
input
,
char
**
msg
,
int32_t
msgSize
)
=
{
0
};
int32_t
(
*
tscBuildMsg
[
TSDB_MSG_TYPE_MAX
])(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
)
=
{
0
};
int32_t
(
*
tscProcessMsgRsp
[
TSDB_MSG_TYPE_MAX
])(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
=
{
0
};
int32_t
(
*
tscProcessMsgRsp
[
TSDB_MSG_TYPE_MAX
])(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
=
{
0
};
void
msgInit
()
{
void
msgInit
()
{
tscBuildMsg
[
TSDB_MSG_TYPE_TABLE_META
]
=
buildTableMetaReqMsg
;
tscBuildMsg
[
TSDB_MSG_TYPE_TABLE_META
]
=
tscBuildTableMetaReqMsg
;
tscProcessMsgRsp
[
TSDB_MSG_TYPE_TABLE_META
]
=
;
tscProcessMsgRsp
[
TSDB_MSG_TYPE_TABLE_META
]
=
;
/*
/*
...
@@ -104,4 +106,63 @@ void msgInit() {
...
@@ -104,4 +106,63 @@ void msgInit() {
}
}
char
*
msgSerializeTagData
(
STagData
*
pTagData
,
char
*
pMsg
)
{
int32_t
n
=
(
int32_t
)
strlen
(
pTagData
->
name
);
*
(
int32_t
*
)
pMsg
=
htonl
(
n
);
pMsg
+=
sizeof
(
n
);
memcpy
(
pMsg
,
pTagData
->
name
,
n
);
pMsg
+=
n
;
*
(
int32_t
*
)
pMsg
=
htonl
(
pTagData
->
dataLen
);
pMsg
+=
sizeof
(
int32_t
);
memcpy
(
pMsg
,
pTagData
->
data
,
pTagData
->
dataLen
);
pMsg
+=
pTagData
->
dataLen
;
return
pMsg
;
}
int32_t
tscBuildTableMetaReqMsg
(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
)
{
if
(
NULL
==
input
||
NULL
==
msg
||
NULL
==
msgLen
)
{
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
SBuildTableMetaInput
*
bInput
=
(
SBuildTableMetaInput
*
)
input
;
int32_t
estimateSize
=
sizeof
(
STableInfoMsg
)
+
(
bInput
->
tagData
?
(
sizeof
(
*
bInput
->
tagData
)
+
bInput
->
tagData
->
dataLen
)
:
0
);
if
(
NULL
==
*
msg
||
msgSize
<
estimateSize
)
{
tfree
(
*
msg
);
*
msg
=
calloc
(
1
,
estimateSize
);
if
(
NULL
==
*
msg
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
STableInfoMsg
*
bMsg
=
(
STableInfoMsg
*
)
*
msg
;
bMsg
->
msgHead
.
vgId
=
bInput
->
vgId
;
strncpy
(
bMsg
->
tableFname
,
bInput
->
tableFullName
,
sizeof
(
bMsg
->
tableFname
));
bMsg
->
tableFname
[
sizeof
(
bMsg
->
tableFname
)
-
1
]
=
0
;
int32_t
autoCreate
=
(
bInput
->
tagData
&&
bInput
->
tagData
->
dataLen
>
0
);
bMsg
->
createFlag
=
htons
(
autoCreate
?
1
:
0
);
char
*
pMsg
=
NULL
;
// tag data exists
if
(
autoCreate
)
{
pMsg
=
msgSerializeTagData
(
bInput
->
tagData
,
(
char
*
)
bMsg
->
tags
);
}
*
msgLen
=
(
int32_t
)(
pMsg
-
(
char
*
)
bMsg
);
return
TSDB_CODE_SUCCESS
;
}
source/libs/catalog/inc/catalogInt.h
浏览文件 @
5c7332c2
...
@@ -24,8 +24,24 @@ extern "C" {
...
@@ -24,8 +24,24 @@ extern "C" {
#define CTG_DEFAULT_CLUSTER_NUMBER 3
#define CTG_DEFAULT_CLUSTER_NUMBER 3
typedef
struct
SCatalog
{
typedef
struct
SVgroupListCache
{
int32_t
vgroupNum
;
int32_t
vgroupVersion
;
SHashObj
*
cache
;
//key:vgId, value:SVgroupInfo
}
SVgroupListCache
;
typedef
struct
SDBVgroupCache
{
SHashObj
*
cache
;
//key:dbname, value:SDBVgroupInfo
}
SDBVgroupCache
;
typedef
struct
STableMetaCache
{
SHashObj
*
cache
;
//key:fulltablename, value:STableMeta
}
STableMetaCache
;
typedef
struct
SCatalog
{
SVgroupListCache
vgroupCache
;
SDBVgroupCache
dbCache
;
STableMetaCache
tableCache
;
}
SCatalog
;
}
SCatalog
;
typedef
struct
SCatalogMgmt
{
typedef
struct
SCatalogMgmt
{
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
5c7332c2
...
@@ -24,8 +24,6 @@ int32_t catalogInit(SCatalog *cfg) {
...
@@ -24,8 +24,6 @@ int32_t catalogInit(SCatalog *cfg) {
CTG_ERR_LRET
(
TSDB_CODE_CTG_INTERNAL_EROR
,
"init %d cluster cache failed"
,
CTG_DEFAULT_CLUSTER_NUMBER
);
CTG_ERR_LRET
(
TSDB_CODE_CTG_INTERNAL_EROR
,
"init %d cluster cache failed"
,
CTG_DEFAULT_CLUSTER_NUMBER
);
}
}
ctgGetVnodeInfo
();
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -62,11 +60,31 @@ struct SCatalog* catalogGetHandle(const char *clusterId) {
...
@@ -62,11 +60,31 @@ struct SCatalog* catalogGetHandle(const char *clusterId) {
return
clusterCtg
;
return
clusterCtg
;
}
}
int32_t
catalogGetTableMeta
(
struct
SCatalog
*
pCatalog
,
const
SEpSet
*
pMgmtEps
,
const
char
*
pTableName
,
STableMeta
*
pTableMeta
)
{
int32_t
catalogGetTableMeta
(
struct
SCatalog
*
pCatalog
,
SRpcObj
*
pRpcObj
,
const
SEpSet
*
pMgmtEps
,
const
char
*
pTableName
,
const
STagData
*
tagData
,
STableMeta
*
pTableMeta
)
{
if
(
NULL
==
pCatalog
||
NULL
==
pMgmtEps
||
NULL
==
pTableName
||
NULL
==
pTableMeta
)
{
if
(
NULL
==
pCatalog
||
NULL
==
pMgmtEps
||
NULL
==
pTableName
||
NULL
==
pTableMeta
)
{
return
TSDB_CODE_CTG_INVALID_INPUT
;
return
TSDB_CODE_CTG_INVALID_INPUT
;
}
}
SBuildTableMetaInput
bInput
=
{
0
};
char
*
msg
=
NULL
;
SEpSet
*
pVnodeEpSet
=
NULL
;
int32_t
msgLen
=
0
;
int32_t
code
=
tscBuildMsg
[
TSDB_MSG_TYPE_TABLE_META
](
&
bInput
,
&
msg
,
0
,
&
msgLen
);
if
(
code
)
{
return
code
;
}
SRpcMsg
rpcMsg
=
{
.
msgType
=
TSDB_MSG_TYPE_TABLE_META
,
.
pCont
=
msg
,
.
contLen
=
msgLen
,
.
ahandle
=
(
void
*
)
pSql
->
self
,
.
handle
=
NULL
,
.
code
=
0
};
rpcSendRequest
(
pRpcObj
->
pDnodeConn
,
pVnodeEpSet
,
&
rpcMsg
,
&
pSql
->
rpcRid
);
}
}
...
...
source/libs/parser/src/parserUtil.c
浏览文件 @
5c7332c2
...
@@ -1433,23 +1433,6 @@ void* vgroupInfoClear(SVgroupsInfo *vgroupList) {
...
@@ -1433,23 +1433,6 @@ void* vgroupInfoClear(SVgroupsInfo *vgroupList) {
return
NULL
;
return
NULL
;
}
}
char
*
serializeTagData
(
STagData
*
pTagData
,
char
*
pMsg
)
{
int32_t
n
=
(
int32_t
)
strlen
(
pTagData
->
name
);
*
(
int32_t
*
)
pMsg
=
htonl
(
n
);
pMsg
+=
sizeof
(
n
);
memcpy
(
pMsg
,
pTagData
->
name
,
n
);
pMsg
+=
n
;
*
(
int32_t
*
)
pMsg
=
htonl
(
pTagData
->
dataLen
);
pMsg
+=
sizeof
(
int32_t
);
memcpy
(
pMsg
,
pTagData
->
data
,
pTagData
->
dataLen
);
pMsg
+=
pTagData
->
dataLen
;
return
pMsg
;
}
int32_t
copyTagData
(
STagData
*
dst
,
const
STagData
*
src
)
{
int32_t
copyTagData
(
STagData
*
dst
,
const
STagData
*
src
)
{
dst
->
dataLen
=
src
->
dataLen
;
dst
->
dataLen
=
src
->
dataLen
;
tstrncpy
(
dst
->
name
,
src
->
name
,
tListLen
(
dst
->
name
));
tstrncpy
(
dst
->
name
,
src
->
name
,
tListLen
(
dst
->
name
));
...
...
source/util/src/terror.c
浏览文件 @
5c7332c2
...
@@ -127,6 +127,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_DUP_TAG_NAMES, "duplicated tag names"
...
@@ -127,6 +127,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_DUP_TAG_NAMES, "duplicated tag names"
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_JSON
,
"Invalid JSON format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_JSON
,
"Invalid JSON format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_JSON_TYPE
,
"Invalid JSON data type"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_JSON_TYPE
,
"Invalid JSON data type"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
,
"Value out of range"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
,
"Value out of range"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_INPUT
,
"Invalid tsc input"
)
// mnode
// mnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MSG_NOT_PROCESSED
,
"Message not processed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MSG_NOT_PROCESSED
,
"Message not processed"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录