Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
6dc19fcf
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看板
提交
6dc19fcf
编写于
4月 16, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/query' into feature/mpeer
上级
d255b599
ff672582
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
66 addition
and
25 deletion
+66
-25
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+2
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+2
-3
src/client/src/tscSql.c
src/client/src/tscSql.c
+2
-0
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+33
-1
src/inc/taos.h
src/inc/taos.h
+1
-0
src/kit/shell/inc/shell.h
src/kit/shell/inc/shell.h
+1
-1
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+6
-4
src/kit/shell/src/shellLinux.c
src/kit/shell/src/shellLinux.c
+10
-3
src/kit/shell/src/shellMain.c
src/kit/shell/src/shellMain.c
+1
-1
src/util/src/hash.c
src/util/src/hash.c
+8
-11
未找到文件。
src/client/src/tscAsync.c
浏览文件 @
6dc19fcf
...
@@ -45,9 +45,10 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const
...
@@ -45,9 +45,10 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
pSql
->
signature
=
pSql
;
pSql
->
signature
=
pSql
;
pSql
->
param
=
param
;
pSql
->
pTscObj
=
pObj
;
pSql
->
pTscObj
=
pObj
;
pSql
->
maxRetry
=
TSDB_VNODES_SUPPORT
;
pSql
->
fp
=
fp
;
pSql
->
fp
=
fp
;
pSql
->
param
=
param
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
tscError
(
"failed to malloc payload"
);
tscError
(
"failed to malloc payload"
);
...
...
src/client/src/tscServer.c
浏览文件 @
6dc19fcf
...
@@ -269,8 +269,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
...
@@ -269,8 +269,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
return
;
return
;
}
else
{
}
else
{
tscWarn
(
"%p it shall renew table meta, code:%s, retry:%d"
,
pSql
,
tstrerror
(
rpcMsg
->
code
),
++
pSql
->
retry
);
tscWarn
(
"%p it shall renew table meta, code:%s, retry:%d"
,
pSql
,
tstrerror
(
rpcMsg
->
code
),
++
pSql
->
retry
);
pSql
->
maxRetry
=
TSDB_VNODES_SUPPORT
*
2
;
// todo move away
pSql
->
res
.
code
=
rpcMsg
->
code
;
// keep the previous error code
pSql
->
res
.
code
=
rpcMsg
->
code
;
// keep the previous error code
if
(
pSql
->
retry
>
pSql
->
maxRetry
)
{
if
(
pSql
->
retry
>
pSql
->
maxRetry
)
{
tscError
(
"%p max retry %d reached, give up"
,
pSql
,
pSql
->
maxRetry
);
tscError
(
"%p max retry %d reached, give up"
,
pSql
,
pSql
->
maxRetry
);
...
@@ -327,7 +326,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
...
@@ -327,7 +326,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
* There is not response callback function for submit response.
* There is not response callback function for submit response.
* The actual inserted number of points is the first number.
* The actual inserted number of points is the first number.
*/
*/
if
(
rpcMsg
->
msgType
==
TSDB_MSG_TYPE_SUBMIT_RSP
)
{
if
(
rpcMsg
->
msgType
==
TSDB_MSG_TYPE_SUBMIT_RSP
&&
pRes
->
pRsp
!=
NULL
)
{
SShellSubmitRspMsg
*
pMsg
=
(
SShellSubmitRspMsg
*
)
pRes
->
pRsp
;
SShellSubmitRspMsg
*
pMsg
=
(
SShellSubmitRspMsg
*
)
pRes
->
pRsp
;
pMsg
->
code
=
htonl
(
pMsg
->
code
);
pMsg
->
code
=
htonl
(
pMsg
->
code
);
pMsg
->
numOfRows
=
htonl
(
pMsg
->
numOfRows
);
pMsg
->
numOfRows
=
htonl
(
pMsg
->
numOfRows
);
...
...
src/client/src/tscSql.c
浏览文件 @
6dc19fcf
...
@@ -129,6 +129,8 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
...
@@ -129,6 +129,8 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
pSql
->
pTscObj
=
pObj
;
pSql
->
pTscObj
=
pObj
;
pSql
->
signature
=
pSql
;
pSql
->
signature
=
pSql
;
pSql
->
maxRetry
=
TSDB_VNODES_SUPPORT
;
tsem_init
(
&
pSql
->
rspSem
,
0
,
0
);
tsem_init
(
&
pSql
->
rspSem
,
0
,
0
);
pObj
->
pSql
=
pSql
;
pObj
->
pSql
=
pSql
;
...
...
src/client/src/tscSystem.c
浏览文件 @
6dc19fcf
...
@@ -171,17 +171,49 @@ void taos_init_imp() {
...
@@ -171,17 +171,49 @@ void taos_init_imp() {
if
(
0
==
tscEmbedded
){
if
(
0
==
tscEmbedded
){
taosTmrReset
(
tscCheckDiskUsage
,
10
,
NULL
,
tscTmr
,
&
tscCheckDiskUsageTmr
);
taosTmrReset
(
tscCheckDiskUsage
,
10
,
NULL
,
tscTmr
,
&
tscCheckDiskUsageTmr
);
}
}
int64_t
refreshTime
=
tsMetricMetaKeepTimer
<
tsMeterMetaKeepTimer
?
tsMetricMetaKeepTimer
:
tsMeterMetaKeepTimer
;
int64_t
refreshTime
=
tsMetricMetaKeepTimer
<
tsMeterMetaKeepTimer
?
tsMetricMetaKeepTimer
:
tsMeterMetaKeepTimer
;
refreshTime
=
refreshTime
>
2
?
2
:
refreshTime
;
refreshTime
=
refreshTime
>
2
?
2
:
refreshTime
;
refreshTime
=
refreshTime
<
1
?
1
:
refreshTime
;
refreshTime
=
refreshTime
<
1
?
1
:
refreshTime
;
if
(
tscCacheHandle
==
NULL
)
tscCacheHandle
=
taosCacheInit
(
tscTmr
,
refreshTime
);
if
(
tscCacheHandle
==
NULL
)
{
tscCacheHandle
=
taosCacheInit
(
tscTmr
,
refreshTime
);
}
tscTrace
(
"client is initialized successfully"
);
tscTrace
(
"client is initialized successfully"
);
}
}
void
taos_init
()
{
pthread_once
(
&
tscinit
,
taos_init_imp
);
}
void
taos_init
()
{
pthread_once
(
&
tscinit
,
taos_init_imp
);
}
void
taos_cleanup
()
{
if
(
tscCacheHandle
!=
NULL
)
{
taosCacheCleanup
(
tscCacheHandle
);
}
if
(
tscQhandle
!=
NULL
)
{
taosCleanUpScheduler
(
tscQhandle
);
tscQhandle
=
NULL
;
}
taosCloseLogger
();
if
(
pVnodeConn
!=
NULL
)
{
rpcClose
(
pVnodeConn
);
pVnodeConn
=
NULL
;
}
if
(
pTscMgmtConn
!=
NULL
)
{
rpcClose
(
pTscMgmtConn
);
pTscMgmtConn
=
NULL
;
}
if
(
tsGlobalConfig
!=
NULL
)
{
tfree
(
tsGlobalConfig
);
}
taosTmrCleanUp
(
tscTmr
);
}
static
int
taos_options_imp
(
TSDB_OPTION
option
,
const
char
*
pStr
)
{
static
int
taos_options_imp
(
TSDB_OPTION
option
,
const
char
*
pStr
)
{
SGlobalConfig
*
cfg
=
NULL
;
SGlobalConfig
*
cfg
=
NULL
;
...
...
src/inc/taos.h
浏览文件 @
6dc19fcf
...
@@ -52,6 +52,7 @@ typedef struct taosField {
...
@@ -52,6 +52,7 @@ typedef struct taosField {
#endif
#endif
DLL_EXPORT
void
taos_init
();
DLL_EXPORT
void
taos_init
();
DLL_EXPORT
void
taos_cleanup
();
DLL_EXPORT
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...);
DLL_EXPORT
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...);
DLL_EXPORT
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
void
taos_close
(
TAOS
*
taos
);
DLL_EXPORT
void
taos_close
(
TAOS
*
taos
);
...
...
src/kit/shell/inc/shell.h
浏览文件 @
6dc19fcf
...
@@ -71,7 +71,7 @@ extern void* shellLoopQuery(void* arg);
...
@@ -71,7 +71,7 @@ extern void* shellLoopQuery(void* arg);
extern
void
taos_error
(
TAOS
*
con
);
extern
void
taos_error
(
TAOS
*
con
);
extern
int
regex_match
(
const
char
*
s
,
const
char
*
reg
,
int
cflags
);
extern
int
regex_match
(
const
char
*
s
,
const
char
*
reg
,
int
cflags
);
void
shellReadCommand
(
TAOS
*
con
,
char
command
[]);
void
shellReadCommand
(
TAOS
*
con
,
char
command
[]);
void
shellRunCommand
(
TAOS
*
con
,
char
*
command
);
int32_t
shellRunCommand
(
TAOS
*
con
,
char
*
command
);
void
shellRunCommandOnServer
(
TAOS
*
con
,
char
command
[]);
void
shellRunCommandOnServer
(
TAOS
*
con
,
char
command
[]);
void
read_history
();
void
read_history
();
void
write_history
();
void
write_history
();
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
6dc19fcf
...
@@ -166,10 +166,10 @@ void shellReplaceCtrlChar(char *str) {
...
@@ -166,10 +166,10 @@ void shellReplaceCtrlChar(char *str) {
*
pstr
=
'\0'
;
*
pstr
=
'\0'
;
}
}
void
shellRunCommand
(
TAOS
*
con
,
char
*
command
)
{
int32_t
shellRunCommand
(
TAOS
*
con
,
char
*
command
)
{
/* If command is empty just return */
/* If command is empty just return */
if
(
regex_match
(
command
,
"^[
\t
;]*$"
,
REG_EXTENDED
))
{
if
(
regex_match
(
command
,
"^[
\t
;]*$"
,
REG_EXTENDED
))
{
return
;
return
0
;
}
}
/* Update the history vector. */
/* Update the history vector. */
...
@@ -193,11 +193,11 @@ void shellRunCommand(TAOS *con, char *command) {
...
@@ -193,11 +193,11 @@ void shellRunCommand(TAOS *con, char *command) {
if
(
regex_match
(
command
,
"^[
\t
]*(quit|q|exit)[
\t
;]*$"
,
REG_EXTENDED
|
REG_ICASE
))
{
if
(
regex_match
(
command
,
"^[
\t
]*(quit|q|exit)[
\t
;]*$"
,
REG_EXTENDED
|
REG_ICASE
))
{
taos_close
(
con
);
taos_close
(
con
);
write_history
();
write_history
();
exitShell
()
;
return
-
1
;
}
else
if
(
regex_match
(
command
,
"^[
\t
]*clear[
\t
;]*$"
,
REG_EXTENDED
|
REG_ICASE
))
{
}
else
if
(
regex_match
(
command
,
"^[
\t
]*clear[
\t
;]*$"
,
REG_EXTENDED
|
REG_ICASE
))
{
// If clear the screen.
// If clear the screen.
system
(
"clear"
);
system
(
"clear"
);
return
;
return
0
;
}
else
if
(
regex_match
(
command
,
"^[
\t
]*source[
\t
]+[^ ]+[
\t
;]*$"
,
REG_EXTENDED
|
REG_ICASE
))
{
}
else
if
(
regex_match
(
command
,
"^[
\t
]*source[
\t
]+[^ ]+[
\t
;]*$"
,
REG_EXTENDED
|
REG_ICASE
))
{
/* If source file. */
/* If source file. */
char
*
c_ptr
=
strtok
(
command
,
" ;"
);
char
*
c_ptr
=
strtok
(
command
,
" ;"
);
...
@@ -209,6 +209,8 @@ void shellRunCommand(TAOS *con, char *command) {
...
@@ -209,6 +209,8 @@ void shellRunCommand(TAOS *con, char *command) {
}
else
{
}
else
{
shellRunCommandOnServer
(
con
,
command
);
shellRunCommandOnServer
(
con
,
command
);
}
}
return
0
;
}
}
void
shellRunCommandOnServer
(
TAOS
*
con
,
char
command
[])
{
void
shellRunCommandOnServer
(
TAOS
*
con
,
char
command
[])
{
...
...
src/kit/shell/src/shellLinux.c
浏览文件 @
6dc19fcf
...
@@ -295,6 +295,7 @@ void *shellLoopQuery(void *arg) {
...
@@ -295,6 +295,7 @@ void *shellLoopQuery(void *arg) {
tscError
(
"failed to malloc command"
);
tscError
(
"failed to malloc command"
);
return
NULL
;
return
NULL
;
}
}
while
(
1
)
{
while
(
1
)
{
// Read command from shell.
// Read command from shell.
...
@@ -304,11 +305,16 @@ void *shellLoopQuery(void *arg) {
...
@@ -304,11 +305,16 @@ void *shellLoopQuery(void *arg) {
reset_terminal_mode
();
reset_terminal_mode
();
// Run the command
// Run the command
shellRunCommand
(
con
,
command
);
if
(
shellRunCommand
(
con
,
command
)
!=
0
)
{
break
;
}
}
}
tfree
(
command
);
exitShell
();
pthread_cleanup_pop
(
1
);
pthread_cleanup_pop
(
1
);
return
NULL
;
return
NULL
;
}
}
...
@@ -487,6 +493,7 @@ void showOnScreen(Command *cmd) {
...
@@ -487,6 +493,7 @@ void showOnScreen(Command *cmd) {
void
cleanup_handler
(
void
*
arg
)
{
tcsetattr
(
0
,
TCSANOW
,
&
oldtio
);
}
void
cleanup_handler
(
void
*
arg
)
{
tcsetattr
(
0
,
TCSANOW
,
&
oldtio
);
}
void
exitShell
()
{
void
exitShell
()
{
tcsetattr
(
0
,
TCSANOW
,
&
oldtio
);
/*int32_t ret =*/
tcsetattr
(
STDIN_FILENO
,
TCSANOW
,
&
oldtio
);
taos_cleanup
();
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
src/kit/shell/src/shellMain.c
浏览文件 @
6dc19fcf
...
@@ -95,7 +95,7 @@ int main(int argc, char* argv[]) {
...
@@ -95,7 +95,7 @@ int main(int argc, char* argv[]) {
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
/* Interupt handler. */
/* Inter
r
upt handler. */
struct
sigaction
act
;
struct
sigaction
act
;
memset
(
&
act
,
0
,
sizeof
(
struct
sigaction
));
memset
(
&
act
,
0
,
sizeof
(
struct
sigaction
));
...
...
src/util/src/hash.c
浏览文件 @
6dc19fcf
...
@@ -101,8 +101,6 @@ static void doUpdateHashTable(SHashObj *pHashObj, SHashNode *pNode) {
...
@@ -101,8 +101,6 @@ static void doUpdateHashTable(SHashObj *pHashObj, SHashNode *pNode) {
if
(
pNode
->
next
)
{
if
(
pNode
->
next
)
{
(
pNode
->
next
)
->
prev
=
pNode
;
(
pNode
->
next
)
->
prev
=
pNode
;
}
}
pTrace
(
"key:%s %p update hash table"
,
pNode
->
key
,
pNode
);
}
}
/**
/**
...
@@ -153,18 +151,18 @@ static void taosHashTableResize(SHashObj *pHashObj) {
...
@@ -153,18 +151,18 @@ static void taosHashTableResize(SHashObj *pHashObj) {
SHashNode
*
pNode
=
NULL
;
SHashNode
*
pNode
=
NULL
;
SHashNode
*
pNext
=
NULL
;
SHashNode
*
pNext
=
NULL
;
int32_t
newSize
=
pHashObj
->
capacity
<<
1
U
;
int32_t
newSize
=
pHashObj
->
capacity
<<
1
u
;
if
(
newSize
>
HASH_MAX_CAPACITY
)
{
if
(
newSize
>
HASH_MAX_CAPACITY
)
{
pTrace
(
"current capacity:%d, maximum capacity:%d, no resize applied due to limitation is reached"
,
//
pTrace("current capacity:%d, maximum capacity:%d, no resize applied due to limitation is reached",
pHashObj
->
capacity
,
HASH_MAX_CAPACITY
);
//
pHashObj->capacity, HASH_MAX_CAPACITY);
return
;
return
;
}
}
int64_t
st
=
taosGetTimestampUs
();
//
int64_t st = taosGetTimestampUs();
SHashEntry
**
pNewEntry
=
realloc
(
pHashObj
->
hashList
,
sizeof
(
SHashEntry
*
)
*
newSize
);
SHashEntry
**
pNewEntry
=
realloc
(
pHashObj
->
hashList
,
sizeof
(
SHashEntry
*
)
*
newSize
);
if
(
pNewEntry
==
NULL
)
{
if
(
pNewEntry
==
NULL
)
{
pTrace
(
"cache resize failed due to out of memory, capacity remain:%d"
,
pHashObj
->
capacity
);
//
pTrace("cache resize failed due to out of memory, capacity remain:%d", pHashObj->capacity);
return
;
return
;
}
}
...
@@ -230,10 +228,9 @@ static void taosHashTableResize(SHashObj *pHashObj) {
...
@@ -230,10 +228,9 @@ static void taosHashTableResize(SHashObj *pHashObj) {
}
}
}
}
int64_t
et
=
taosGetTimestampUs
();
// int64_t et = taosGetTimestampUs();
// pTrace("hash table resize completed, new capacity:%d, load factor:%f, elapsed time:%fms", pHashObj->capacity,
pTrace
(
"hash table resize completed, new capacity:%d, load factor:%f, elapsed time:%fms"
,
pHashObj
->
capacity
,
// ((double)pHashObj->size) / pHashObj->capacity, (et - st) / 1000.0);
((
double
)
pHashObj
->
size
)
/
pHashObj
->
capacity
,
(
et
-
st
)
/
1000
.
0
);
}
}
/**
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录