Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
80d44b2f
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
80d44b2f
编写于
8月 06, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] refactor codes
上级
49f476c3
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
34 addition
and
34 deletion
+34
-34
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+2
-2
src/client/src/tscServer.c
src/client/src/tscServer.c
+3
-3
src/client/src/tscSql.c
src/client/src/tscSql.c
+1
-1
src/inc/taosdef.h
src/inc/taosdef.h
+1
-1
src/inc/taosmsg.h
src/inc/taosmsg.h
+13
-13
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+1
-1
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+1
-1
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+11
-11
src/plugins/monitor/src/monitorMain.c
src/plugins/monitor/src/monitorMain.c
+1
-1
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
80d44b2f
...
...
@@ -989,7 +989,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
}
int
validateTableName
(
char
*
tblName
,
int
len
,
SSQLToken
*
psTblToken
)
{
tstrncpy
(
psTblToken
->
z
,
tblName
,
TSDB_TABLE_
ID
_LEN
);
tstrncpy
(
psTblToken
->
z
,
tblName
,
TSDB_TABLE_
FNAME
_LEN
);
psTblToken
->
n
=
len
;
psTblToken
->
type
=
TK_ID
;
...
...
@@ -1077,7 +1077,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
}
pCmd
->
curSql
=
sToken
.
z
;
char
buf
[
TSDB_TABLE_
ID
_LEN
];
char
buf
[
TSDB_TABLE_
FNAME
_LEN
];
SSQLToken
sTblToken
;
sTblToken
.
z
=
buf
;
// Check if the table name available or not
...
...
src/client/src/tscServer.c
浏览文件 @
80d44b2f
...
...
@@ -1551,7 +1551,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
// fill head info
SMgmtHead *pMgmt = (SMgmtHead *)(pCmd->payload + tsRpcHeadSize);
memset(pMgmt->db, 0, TSDB_TABLE_
ID
_LEN); // server don't need the db
memset(pMgmt->db, 0, TSDB_TABLE_
FNAME
_LEN); // server don't need the db
SCMMultiTableInfoMsg *pInfoMsg = (SCMMultiTableInfoMsg *)(pCmd->payload + tsRpcHeadSize + sizeof(SMgmtHead));
pInfoMsg->numOfTables = htonl((int32_t)pCmd->count);
...
...
@@ -1592,7 +1592,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
//// tagLen += strlen(pQueryInfo->tagCond.tbnameCond.cond) * TSDB_NCHAR_SIZE;
//// }
////
//// int32_t joinCondLen = (TSDB_TABLE_
ID
_LEN + sizeof(int16_t)) * 2;
//// int32_t joinCondLen = (TSDB_TABLE_
FNAME
_LEN + sizeof(int16_t)) * 2;
//// int32_t elemSize = sizeof(SSuperTableMetaElemMsg) * pQueryInfo->numOfTables;
////
//// int32_t colSize = pQueryInfo->groupbyExpr.numOfGroupCols*sizeof(SColIndex);
...
...
@@ -1954,7 +1954,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
}
int
tscProcessConnectRsp
(
SSqlObj
*
pSql
)
{
char
temp
[
TSDB_TABLE_
ID
_LEN
*
2
];
char
temp
[
TSDB_TABLE_
FNAME
_LEN
*
2
];
STscObj
*
pObj
=
pSql
->
pTscObj
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
...
...
src/client/src/tscSql.c
浏览文件 @
80d44b2f
...
...
@@ -812,7 +812,7 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t
}
char
*
nextStr
;
char
tblName
[
TSDB_TABLE_
ID
_LEN
];
char
tblName
[
TSDB_TABLE_
FNAME
_LEN
];
int
payloadLen
=
0
;
char
*
pMsg
=
pCmd
->
payload
;
while
(
1
)
{
...
...
src/inc/taosdef.h
浏览文件 @
80d44b2f
...
...
@@ -232,7 +232,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_NODE_NAME_LEN 64
#define TSDB_TABLE_NAME_LEN 193 // it is a null-terminated string
#define TSDB_DB_NAME_LEN 33
#define TSDB_TABLE_
ID_LEN
(TSDB_ACCT_LEN + TSDB_DB_NAME_LEN + TSDB_TABLE_NAME_LEN)
#define TSDB_TABLE_
FNAME_LEN
(TSDB_ACCT_LEN + TSDB_DB_NAME_LEN + TSDB_TABLE_NAME_LEN)
#define TSDB_COL_NAME_LEN 65
#define TSDB_MAX_SAVED_SQL_LEN TSDB_MAX_COLUMNS * 64
#define TSDB_MAX_SQL_LEN TSDB_PAYLOAD_SIZE
...
...
src/inc/taosmsg.h
浏览文件 @
80d44b2f
...
...
@@ -246,13 +246,13 @@ typedef struct {
uint64_t
uid
;
uint64_t
superTableUid
;
uint64_t
createdTime
;
char
tableId
[
TSDB_TABLE_
ID
_LEN
];
char
superTableId
[
TSDB_TABLE_
ID
_LEN
];
char
tableId
[
TSDB_TABLE_
FNAME
_LEN
];
char
superTableId
[
TSDB_TABLE_
FNAME
_LEN
];
char
data
[];
}
SMDCreateTableMsg
;
typedef
struct
{
char
tableId
[
TSDB_TABLE_
ID
_LEN
];
char
tableId
[
TSDB_TABLE_
FNAME
_LEN
];
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
int8_t
igExists
;
int8_t
getMeta
;
...
...
@@ -265,12 +265,12 @@ typedef struct {
}
SCMCreateTableMsg
;
typedef
struct
{
char
tableId
[
TSDB_TABLE_
ID
_LEN
];
char
tableId
[
TSDB_TABLE_
FNAME
_LEN
];
int8_t
igNotExists
;
}
SCMDropTableMsg
;
typedef
struct
{
char
tableId
[
TSDB_TABLE_
ID
_LEN
];
char
tableId
[
TSDB_TABLE_
FNAME
_LEN
];
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
int16_t
type
;
/* operation type */
int16_t
numOfCols
;
/* number of schema */
...
...
@@ -297,7 +297,7 @@ typedef struct {
typedef
struct
{
char
clientVersion
[
TSDB_VERSION_LEN
];
char
msgVersion
[
TSDB_VERSION_LEN
];
char
db
[
TSDB_TABLE_
ID
_LEN
];
char
db
[
TSDB_TABLE_
FNAME
_LEN
];
}
SCMConnectMsg
;
typedef
struct
{
...
...
@@ -347,14 +347,14 @@ typedef struct {
int32_t
vgId
;
int32_t
sid
;
uint64_t
uid
;
char
tableId
[
TSDB_TABLE_
ID
_LEN
];
char
tableId
[
TSDB_TABLE_
FNAME
_LEN
];
}
SMDDropTableMsg
;
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
uint64_t
uid
;
char
tableId
[
TSDB_TABLE_
ID
_LEN
];
char
tableId
[
TSDB_TABLE_
FNAME
_LEN
];
}
SMDDropSTableMsg
;
typedef
struct
{
...
...
@@ -527,7 +527,7 @@ typedef struct {
}
SCMCreateDbMsg
,
SCMAlterDbMsg
;
typedef
struct
{
char
db
[
TSDB_TABLE_
ID
_LEN
];
char
db
[
TSDB_TABLE_
FNAME
_LEN
];
uint8_t
ignoreNotExists
;
}
SCMDropDbMsg
,
SCMUseDbMsg
;
...
...
@@ -637,7 +637,7 @@ typedef struct {
}
SMDCreateVnodeMsg
,
SMDAlterVnodeMsg
;
typedef
struct
{
char
tableId
[
TSDB_TABLE_
ID
_LEN
];
char
tableId
[
TSDB_TABLE_
FNAME
_LEN
];
int16_t
createFlag
;
char
tags
[];
}
SCMTableInfoMsg
;
...
...
@@ -664,7 +664,7 @@ typedef struct {
typedef
struct
STableMetaMsg
{
int32_t
contLen
;
char
tableId
[
TSDB_TABLE_
ID
_LEN
];
// table id
char
tableId
[
TSDB_TABLE_
FNAME
_LEN
];
// table id
uint8_t
numOfTags
;
uint8_t
precision
;
uint8_t
tableType
;
...
...
@@ -685,7 +685,7 @@ typedef struct SMultiTableMeta {
typedef
struct
{
int32_t
dataLen
;
char
name
[
TSDB_TABLE_
ID
_LEN
];
char
name
[
TSDB_TABLE_
FNAME
_LEN
];
char
data
[
TSDB_MAX_TAGS_LEN
+
TD_KV_ROW_HEAD_SIZE
+
sizeof
(
SColIdx
)
*
TSDB_MAX_TAGS
];
}
STagData
;
...
...
@@ -771,7 +771,7 @@ typedef struct {
uint64_t
uid
;
uint64_t
stime
;
// stream starting time
int32_t
status
;
char
tableId
[
TSDB_TABLE_
ID
_LEN
];
char
tableId
[
TSDB_TABLE_
FNAME
_LEN
];
}
SMDAlterStreamMsg
;
typedef
struct
{
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
80d44b2f
...
...
@@ -189,7 +189,7 @@ void mnodeDecDbRef(SDbObj *pDb) {
}
SDbObj
*
mnodeGetDbByTableId
(
char
*
tableId
)
{
char
db
[
TSDB_TABLE_
ID
_LEN
],
*
pos
;
char
db
[
TSDB_TABLE_
FNAME
_LEN
],
*
pos
;
// tableId format should be : acct.db.table
pos
=
strstr
(
tableId
,
TS_PATH_DELIMITER
);
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
80d44b2f
...
...
@@ -302,7 +302,7 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
SAcctObj
*
pAcct
=
pUser
->
pAcct
;
if
(
pConnectMsg
->
db
[
0
])
{
char
dbName
[
TSDB_TABLE_
ID
_LEN
*
3
]
=
{
0
};
char
dbName
[
TSDB_TABLE_
FNAME
_LEN
*
3
]
=
{
0
};
sprintf
(
dbName
,
"%x%s%s"
,
pAcct
->
acctId
,
TS_PATH_DELIMITER
,
pConnectMsg
->
db
);
SDbObj
*
pDb
=
mnodeGetDb
(
dbName
);
if
(
pDb
==
NULL
)
{
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
80d44b2f
...
...
@@ -215,7 +215,7 @@ static int32_t mnodeChildTableActionEncode(SSdbOper *pOper) {
assert
(
pTable
!=
NULL
&&
pOper
->
rowData
!=
NULL
);
int32_t
len
=
strlen
(
pTable
->
info
.
tableId
);
if
(
len
>=
TSDB_TABLE_
ID
_LEN
)
return
TSDB_CODE_MND_INVALID_TABLE_ID
;
if
(
len
>=
TSDB_TABLE_
FNAME
_LEN
)
return
TSDB_CODE_MND_INVALID_TABLE_ID
;
memcpy
(
pOper
->
rowData
,
pTable
->
info
.
tableId
,
len
);
memset
(
pOper
->
rowData
+
len
,
0
,
1
);
...
...
@@ -246,7 +246,7 @@ static int32_t mnodeChildTableActionDecode(SSdbOper *pOper) {
if
(
pTable
==
NULL
)
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
int32_t
len
=
strlen
(
pOper
->
rowData
);
if
(
len
>=
TSDB_TABLE_
ID
_LEN
)
{
if
(
len
>=
TSDB_TABLE_
FNAME
_LEN
)
{
free
(
pTable
);
return
TSDB_CODE_MND_INVALID_TABLE_ID
;
}
...
...
@@ -348,7 +348,7 @@ static int32_t mnodeInitChildTables() {
.
tableId
=
SDB_TABLE_CTABLE
,
.
tableName
=
"ctables"
,
.
hashSessions
=
TSDB_DEFAULT_CTABLES_HASH_SIZE
,
.
maxRowSize
=
sizeof
(
SChildTableObj
)
+
sizeof
(
SSchema
)
*
(
TSDB_MAX_TAGS
+
TSDB_MAX_COLUMNS
+
16
)
+
TSDB_TABLE_
ID
_LEN
+
TSDB_CQ_SQL_SIZE
,
.
maxRowSize
=
sizeof
(
SChildTableObj
)
+
sizeof
(
SSchema
)
*
(
TSDB_MAX_TAGS
+
TSDB_MAX_COLUMNS
+
16
)
+
TSDB_TABLE_
FNAME
_LEN
+
TSDB_CQ_SQL_SIZE
,
.
refCountPos
=
(
int8_t
*
)(
&
tObj
.
refCount
)
-
(
int8_t
*
)
&
tObj
,
.
keyType
=
SDB_KEY_VAR_STRING
,
.
insertFp
=
mnodeChildTableActionInsert
,
...
...
@@ -471,7 +471,7 @@ static int32_t mnodeSuperTableActionEncode(SSdbOper *pOper) {
assert
(
pOper
->
pObj
!=
NULL
&&
pOper
->
rowData
!=
NULL
);
int32_t
len
=
strlen
(
pStable
->
info
.
tableId
);
if
(
len
>=
TSDB_TABLE_
ID
_LEN
)
len
=
TSDB_CODE_MND_INVALID_TABLE_ID
;
if
(
len
>=
TSDB_TABLE_
FNAME
_LEN
)
len
=
TSDB_CODE_MND_INVALID_TABLE_ID
;
memcpy
(
pOper
->
rowData
,
pStable
->
info
.
tableId
,
len
);
memset
(
pOper
->
rowData
+
len
,
0
,
1
);
...
...
@@ -495,7 +495,7 @@ static int32_t mnodeSuperTableActionDecode(SSdbOper *pOper) {
if
(
pStable
==
NULL
)
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
int32_t
len
=
strlen
(
pOper
->
rowData
);
if
(
len
>=
TSDB_TABLE_
ID
_LEN
){
if
(
len
>=
TSDB_TABLE_
FNAME
_LEN
){
free
(
pStable
);
return
TSDB_CODE_MND_INVALID_TABLE_ID
;
}
...
...
@@ -531,7 +531,7 @@ static int32_t mnodeInitSuperTables() {
.
tableId
=
SDB_TABLE_STABLE
,
.
tableName
=
"stables"
,
.
hashSessions
=
TSDB_DEFAULT_STABLES_HASH_SIZE
,
.
maxRowSize
=
sizeof
(
SSuperTableObj
)
+
sizeof
(
SSchema
)
*
(
TSDB_MAX_TAGS
+
TSDB_MAX_COLUMNS
+
16
)
+
TSDB_TABLE_
ID
_LEN
,
.
maxRowSize
=
sizeof
(
SSuperTableObj
)
+
sizeof
(
SSchema
)
*
(
TSDB_MAX_TAGS
+
TSDB_MAX_COLUMNS
+
16
)
+
TSDB_TABLE_
FNAME
_LEN
,
.
refCountPos
=
(
int8_t
*
)(
&
tObj
.
refCount
)
-
(
int8_t
*
)
&
tObj
,
.
keyType
=
SDB_KEY_VAR_STRING
,
.
insertFp
=
mnodeSuperTableActionInsert
,
...
...
@@ -1456,7 +1456,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
// reserve space
int32_t
contLen
=
sizeof
(
SCMSTableVgroupRspMsg
)
+
32
*
sizeof
(
SCMVgroupInfo
)
+
sizeof
(
SVgroupsInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfTable
;
++
i
)
{
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
SCMSTableVgroupMsg
)
+
(
TSDB_TABLE_
ID
_LEN
)
*
i
;
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
SCMSTableVgroupMsg
)
+
(
TSDB_TABLE_
FNAME
_LEN
)
*
i
;
SSuperTableObj
*
pTable
=
mnodeGetSuperTable
(
stableName
);
if
(
pTable
!=
NULL
&&
pTable
->
vgHash
!=
NULL
)
{
contLen
+=
(
taosHashGetSize
(
pTable
->
vgHash
)
*
sizeof
(
SCMVgroupInfo
)
+
sizeof
(
SVgroupsInfo
));
...
...
@@ -1473,7 +1473,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
char
*
msg
=
(
char
*
)
pRsp
+
sizeof
(
SCMSTableVgroupRspMsg
);
for
(
int32_t
i
=
0
;
i
<
numOfTable
;
++
i
)
{
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
SCMSTableVgroupMsg
)
+
(
TSDB_TABLE_
ID
_LEN
)
*
i
;
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
SCMSTableVgroupMsg
)
+
(
TSDB_TABLE_
FNAME
_LEN
)
*
i
;
SSuperTableObj
*
pTable
=
mnodeGetSuperTable
(
stableName
);
if
(
pTable
==
NULL
)
{
mError
(
"app:%p:%p, stable:%s, not exist while get stable vgroup info"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
stableName
);
...
...
@@ -1820,7 +1820,7 @@ static int32_t mnodeSendDropChildTableMsg(SMnodeMsg *pMsg, bool needReturn) {
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
tstrncpy
(
pDrop
->
tableId
,
pTable
->
info
.
tableId
,
TSDB_TABLE_
ID
_LEN
);
tstrncpy
(
pDrop
->
tableId
,
pTable
->
info
.
tableId
,
TSDB_TABLE_
FNAME
_LEN
);
pDrop
->
vgId
=
htonl
(
pTable
->
vgId
);
pDrop
->
contLen
=
htonl
(
sizeof
(
SMDDropTableMsg
));
pDrop
->
sid
=
htonl
(
pTable
->
sid
);
...
...
@@ -2071,7 +2071,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) {
pMeta
->
sid
=
htonl
(
pTable
->
sid
);
pMeta
->
precision
=
pDb
->
cfg
.
precision
;
pMeta
->
tableType
=
pTable
->
info
.
type
;
tstrncpy
(
pMeta
->
tableId
,
pTable
->
info
.
tableId
,
TSDB_TABLE_
ID
_LEN
);
tstrncpy
(
pMeta
->
tableId
,
pTable
->
info
.
tableId
,
TSDB_TABLE_
FNAME
_LEN
);
if
(
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
{
pMeta
->
sversion
=
htons
(
pTable
->
superTable
->
sversion
);
...
...
@@ -2440,7 +2440,7 @@ static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg) {
pMultiMeta
->
numOfTables
=
0
;
for
(
int32_t
t
=
0
;
t
<
pInfo
->
numOfTables
;
++
t
)
{
char
*
tableId
=
(
char
*
)(
pInfo
->
tableIds
+
t
*
TSDB_TABLE_
ID
_LEN
);
char
*
tableId
=
(
char
*
)(
pInfo
->
tableIds
+
t
*
TSDB_TABLE_
FNAME
_LEN
);
SChildTableObj
*
pTable
=
mnodeGetChildTable
(
tableId
);
if
(
pTable
==
NULL
)
continue
;
...
...
src/plugins/monitor/src/monitorMain.c
浏览文件 @
80d44b2f
...
...
@@ -189,7 +189,7 @@ static void dnodeBuildMonitorSql(char *sql, int32_t cmd) {
snprintf
(
sql
,
SQL_LENGTH
,
"create table if not exists %s.slowquery(ts timestamp, username "
"binary(%d), created_time timestamp, time bigint, sql binary(%d))"
,
tsMonitorDbName
,
TSDB_TABLE_
ID
_LEN
-
1
,
TSDB_SLOW_QUERY_SQL_LEN
);
tsMonitorDbName
,
TSDB_TABLE_
FNAME
_LEN
-
1
,
TSDB_SLOW_QUERY_SQL_LEN
);
}
else
if
(
cmd
==
MONITOR_CMD_CREATE_TB_LOG
)
{
snprintf
(
sql
,
SQL_LENGTH
,
"create table if not exists %s.log(ts timestamp, level tinyint, "
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录