Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
93287850
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看板
提交
93287850
编写于
1月 04, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] refactor.
上级
7128b3cd
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
70 addition
and
44 deletion
+70
-44
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+2
-2
include/os/osSysinfo.h
include/os/osSysinfo.h
+1
-1
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+13
-10
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+3
-3
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+11
-1
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+1
-1
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+2
-2
source/libs/parser/src/dCDAstProcess.c
source/libs/parser/src/dCDAstProcess.c
+31
-19
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+3
-2
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+3
-3
未找到文件。
include/libs/catalog/catalog.h
浏览文件 @
93287850
...
...
@@ -100,13 +100,13 @@ int32_t catalogRenewTableMeta(struct SCatalog* pCatalog, void * pTransporter, co
/**
* Force renew a table's local cached meta data and get the new one.
* @param pCatalog (input, got with catalogGetHandle)
* @param p
Rpc
(input, rpc object)
* @param p
Transporter
(input, rpc object)
* @param pMgmtEps (input, mnode EPs)
* @param pTableName (input, table name, NOT including db name)
* @param pTableMeta(output, table meta data, NEED to free it by calller)
* @return error code
*/
int32_t
catalogRenewAndGetTableMeta
(
struct
SCatalog
*
pCatalog
,
void
*
p
Rpc
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
int32_t
catalogRenewAndGetTableMeta
(
struct
SCatalog
*
pCatalog
,
void
*
p
Transporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
/**
...
...
include/os/osSysinfo.h
浏览文件 @
93287850
...
...
@@ -54,7 +54,7 @@ bool taosGetSysMemory(float *memoryUsedMB);
void
taosPrintOsInfo
();
int
taosSystem
(
const
char
*
cmd
);
void
taosKillSystem
();
int32_t
taosGetSystemU
id
(
char
*
uid
,
int32_t
uidlen
);
int32_t
taosGetSystemU
UID
(
char
*
uid
,
int32_t
uidlen
);
char
*
taosGetCmdlineByPID
(
int
pid
);
void
taosSetCoreDump
(
bool
enable
);
...
...
source/client/src/clientEnv.c
浏览文件 @
93287850
...
...
@@ -419,17 +419,20 @@ int taos_options_imp(TSDB_OPTION option, const char *str) {
*+------------+-----+-----------+---------------+
* @return
*/
static
int32_t
requestSerialId
=
0
;
uint64_t
generateRequestId
()
{
uint64_t
hashId
=
0
;
char
uid
[
64
]
=
{
0
};
int32_t
code
=
taosGetSystemUid
(
uid
,
tListLen
(
uid
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"Failed to get the system uid to generated request id, reason:%s. use ip address instead"
,
tstrerror
(
TAOS_SYSTEM_ERROR
(
errno
)));
}
else
{
hashId
=
MurmurHash3_32
(
uid
,
strlen
(
uid
));
static
uint64_t
hashId
=
0
;
static
int32_t
requestSerialId
=
0
;
if
(
hashId
==
0
)
{
char
uid
[
64
]
=
{
0
};
int32_t
code
=
taosGetSystemUUID
(
uid
,
tListLen
(
uid
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"Failed to get the system uid to generated request id, reason:%s. use ip address instead"
,
tstrerror
(
TAOS_SYSTEM_ERROR
(
errno
)));
}
else
{
hashId
=
MurmurHash3_32
(
uid
,
strlen
(
uid
));
}
}
int64_t
ts
=
taosGetTimestampUs
();
...
...
source/client/src/clientImpl.c
浏览文件 @
93287850
...
...
@@ -140,7 +140,7 @@ int32_t buildRequest(STscObj *pTscObj, const char *sql, int sqlLen, SRequestObj*
(
*
pRequest
)
->
sqlstr
[
sqlLen
]
=
0
;
(
*
pRequest
)
->
sqlLen
=
sqlLen
;
tscDebugL
(
"0x%"
PRIx64
" SQL: %s
"
,
(
*
pRequest
)
->
requestId
,
(
*
pRequest
)
->
sqlstr
);
tscDebugL
(
"0x%"
PRIx64
" SQL: %s
, reqId:0x"
PRIx64
,
(
*
pRequest
)
->
self
,
(
*
pRequest
)
->
sqlstr
,
(
*
pRequest
)
->
requestId
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -443,10 +443,10 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
*/
int32_t
elapsed
=
pRequest
->
metric
.
rsp
-
pRequest
->
metric
.
start
;
if
(
pMsg
->
code
==
TSDB_CODE_SUCCESS
)
{
tscDebug
(
"0x%"
PRIx64
" message:%s, code:%s rspLen:%d, elapsed:%d ms, reqId:0x%"
PRIx64
,
pRequest
->
requestId
,
tscDebug
(
"0x%"
PRIx64
" message:%s, code:%s rspLen:%d, elapsed:%d ms, reqId:0x%"
PRIx64
,
pRequest
->
self
,
TMSG_INFO
(
pMsg
->
msgType
),
tstrerror
(
pMsg
->
code
),
pMsg
->
contLen
,
elapsed
,
pRequest
->
requestId
);
}
else
{
tscError
(
"
reqId:0x%"
PRIx64
" SQL cmd:%s, code:%s rspLen:%d, elapsed time:%d ms, reqId:0x"
PRIx64
,
pRequest
->
requestId
,
tscError
(
"
0x%"
PRIx64
" SQL cmd:%s, code:%s rspLen:%d, elapsed time:%d ms, reqId:0x%"
PRIx64
,
pRequest
->
self
,
TMSG_INFO
(
pMsg
->
msgType
),
tstrerror
(
pMsg
->
code
),
pMsg
->
contLen
,
elapsed
,
pRequest
->
requestId
);
}
...
...
source/client/test/clientTests.cpp
浏览文件 @
93287850
...
...
@@ -496,6 +496,17 @@ TEST(testCase, create_multiple_tables) {
}
taos_free_result
(
pRes
);
// for(int32_t i = 0; i < 10000; ++i) {
// char sql[512] = {0};
// snprintf(sql, tListLen(sql), "create table t_x_%d using st1 tags(2)", i);
// TAOS_RES* pres = taos_query(pConn, sql);
// if (taos_errno(pres) != 0) {
// printf("failed to create table %d\n, reason:%s", i, taos_errstr(pres));
// }
// taos_free_result(pres);
// }
taos_close
(
pConn
);
}
...
...
@@ -506,7 +517,6 @@ TEST(testCase, generated_request_id_test) {
uint64_t
v
=
generateRequestId
();
void
*
result
=
taosHashGet
(
phash
,
&
v
,
sizeof
(
v
));
ASSERT_EQ
(
result
,
nullptr
);
taosHashPut
(
phash
,
&
v
,
sizeof
(
v
),
NULL
,
0
);
}
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
93287850
...
...
@@ -145,7 +145,7 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
clusterObj
.
createdTime
=
taosGetTimestampMs
();
clusterObj
.
updateTime
=
clusterObj
.
createdTime
;
int32_t
code
=
taosGetSystemU
id
(
clusterObj
.
name
,
TSDB_CLUSTER_ID_LEN
);
int32_t
code
=
taosGetSystemU
UID
(
clusterObj
.
name
,
TSDB_CLUSTER_ID_LEN
);
if
(
code
!=
0
)
{
strcpy
(
clusterObj
.
name
,
"tdengine2.0"
);
mError
(
"failed to get name from system, set to default val %s"
,
clusterObj
.
name
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
93287850
...
...
@@ -698,8 +698,8 @@ _return:
CTG_RET
(
code
);
}
int32_t
catalogRenewAndGetTableMeta
(
struct
SCatalog
*
pCatalog
,
void
*
p
Rpc
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
)
{
return
ctgGetTableMetaImpl
(
pCatalog
,
p
Rpc
,
pMgmtEps
,
pTableName
,
true
,
pTableMeta
);
int32_t
catalogRenewAndGetTableMeta
(
struct
SCatalog
*
pCatalog
,
void
*
p
Transporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
)
{
return
ctgGetTableMetaImpl
(
pCatalog
,
p
Transporter
,
pMgmtEps
,
pTableName
,
true
,
pTableMeta
);
}
int32_t
catalogGetTableDistVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
SArray
**
pVgroupList
)
{
...
...
source/libs/parser/src/dCDAstProcess.c
浏览文件 @
93287850
...
...
@@ -326,6 +326,31 @@ typedef struct SVgroupTablesBatch {
SVgroupInfo
info
;
}
SVgroupTablesBatch
;
static
int32_t
doParseSerializeTagValue
(
SSchema
*
pTagSchema
,
int32_t
numOfInputTag
,
SKVRowBuilder
*
pKvRowBuilder
,
SArray
*
pTagValList
,
int32_t
tsPrecision
,
SMsgBuf
*
pMsgBuf
)
{
const
char
*
msg1
=
"illegal value or data overflow"
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
for
(
int32_t
i
=
0
;
i
<
numOfInputTag
;
++
i
)
{
SSchema
*
pSchema
=
&
pTagSchema
[
i
];
char
*
endPtr
=
NULL
;
char
tmpTokenBuf
[
TSDB_MAX_TAGS_LEN
]
=
{
0
};
SKvParam
param
=
{.
builder
=
pKvRowBuilder
,
.
schema
=
pSchema
};
SToken
*
pItem
=
taosArrayGet
(
pTagValList
,
i
);
code
=
parseValueToken
(
&
endPtr
,
pItem
,
pSchema
,
tsPrecision
,
tmpTokenBuf
,
KvRowAppend
,
&
param
,
pMsgBuf
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tdDestroyKVRowBuilder
(
pKvRowBuilder
);
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg1
);
}
}
return
code
;
}
int32_t
doCheckForCreateCTable
(
SSqlInfo
*
pInfo
,
SParseBasicCtx
*
pCtx
,
SMsgBuf
*
pMsgBuf
,
char
**
pOutput
,
int32_t
*
len
)
{
const
char
*
msg1
=
"invalid table name"
;
const
char
*
msg2
=
"tags number not matched"
;
...
...
@@ -354,10 +379,9 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SMsgBuf* p
}
SArray
*
pValList
=
pCreateTableInfo
->
pTagVals
;
size_t
numOfInputTag
=
taosArrayGetSize
(
pValList
);
size_t
numOfInputTag
=
taosArrayGetSize
(
pValList
);
STableMeta
*
pSuperTableMeta
=
NULL
;
code
=
catalogGetTableMeta
(
pCtx
->
pCatalog
,
pCtx
->
pTransporter
,
&
pCtx
->
mgmtEpSet
,
&
name
,
&
pSuperTableMeta
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
...
...
@@ -463,21 +487,9 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SMsgBuf* p
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg2
);
}
for
(
int32_t
i
=
0
;
i
<
numOfInputTag
;
++
i
)
{
SSchema
*
pSchema
=
&
pTagSchema
[
i
];
char
*
endPtr
=
NULL
;
char
tmpTokenBuf
[
TSDB_MAX_TAGS_LEN
]
=
{
0
};
SKvParam
param
=
{.
builder
=
&
kvRowBuilder
,
.
schema
=
pSchema
};
SToken
*
pItem
=
taosArrayGet
(
pValList
,
i
);
code
=
parseValueToken
(
&
endPtr
,
pItem
,
pSchema
,
tinfo
.
precision
,
tmpTokenBuf
,
KvRowAppend
,
&
param
,
pMsgBuf
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg4
);
}
code
=
doParseSerializeTagValue
(
pTagSchema
,
numOfInputTag
,
&
kvRowBuilder
,
pValList
,
tinfo
.
precision
,
pMsgBuf
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
}
...
...
@@ -499,8 +511,8 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SMsgBuf* p
catalogGetTableHashVgroup
(
pCtx
->
pCatalog
,
pCtx
->
pTransporter
,
&
pCtx
->
mgmtEpSet
,
&
tableName
,
&
info
);
struct
SVCreateTbReq
req
=
{
0
};
req
.
type
=
TD_CHILD_TABLE
;
req
.
name
=
strdup
(
tNameGetTableName
(
&
tableName
));
req
.
type
=
TD_CHILD_TABLE
;
req
.
name
=
strdup
(
tNameGetTableName
(
&
tableName
));
req
.
ctbCfg
.
suid
=
pSuperTableMeta
->
uid
;
req
.
ctbCfg
.
pTag
=
row
;
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
93287850
...
...
@@ -372,7 +372,7 @@ int32_t schProcessOnTaskSuccess(SSchJob *job, SSchTask *task) {
SCH_ERR_RET
(
schMoveTaskToSuccList
(
job
,
task
,
&
moved
));
if
(
!
moved
)
{
SCH_TASK_ERR_LOG
(
"task may already moved, status:%d"
,
task
->
status
);
SCH_TASK_ERR_LOG
(
"
task may already moved, status:%d"
,
task
->
status
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -480,7 +480,6 @@ int32_t schProcessOnTaskFailure(SSchJob *job, SSchTask *task, int32_t errCode) {
int32_t
schProcessRspMsg
(
SSchJob
*
job
,
SSchTask
*
task
,
int32_t
msgType
,
char
*
msg
,
int32_t
msgSize
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
switch
(
msgType
)
{
case
TDMT_VND_CREATE_TABLE_RSP
:
{
if
(
rspCode
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -492,6 +491,8 @@ int32_t schProcessRspMsg(SSchJob *job, SSchTask *task, int32_t msgType, char *ms
goto
_task_error
;
}
}
break
;
}
case
TDMT_VND_SUBMIT_RSP
:
{
if
(
rspCode
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/os/src/osSysinfo.c
浏览文件 @
93287850
...
...
@@ -252,7 +252,7 @@ LONG WINAPI FlCrashDump(PEXCEPTION_POINTERS ep) {
void
taosSetCoreDump
()
{
SetUnhandledExceptionFilter
(
&
FlCrashDump
);
}
int32_t
taosGetSystemU
id
(
char
*
uid
,
int32_t
uidlen
)
{
int32_t
taosGetSystemU
UID
(
char
*
uid
,
int32_t
uidlen
)
{
GUID
guid
;
CoCreateGuid
(
&
guid
);
...
...
@@ -452,7 +452,7 @@ int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize) {
}
}
int32_t
taosGetSystemU
id
(
char
*
uid
,
int32_t
uidlen
)
{
int32_t
taosGetSystemU
UID
(
char
*
uid
,
int32_t
uidlen
)
{
uuid_t
uuid
=
{
0
};
uuid_generate
(
uuid
);
// it's caller's responsibility to make enough space for `uid`, that's 36-char + 1-null
...
...
@@ -1070,7 +1070,7 @@ void taosSetCoreDump(bool enable) {
#endif
}
int32_t
taosGetSystemU
id
(
char
*
uid
,
int32_t
uidlen
)
{
int32_t
taosGetSystemU
UID
(
char
*
uid
,
int32_t
uidlen
)
{
int
fd
;
int
len
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录