Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
32d2b1cc
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看板
提交
32d2b1cc
编写于
1月 17, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feature/vnode
上级
31ce2705
815f3f06
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
128 addition
and
13 deletion
+128
-13
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+1
-1
source/libs/planner/src/physicalPlanJson.c
source/libs/planner/src/physicalPlanJson.c
+16
-5
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+2
-1
source/libs/transport/test/transportTests.cc
source/libs/transport/test/transportTests.cc
+109
-6
未找到文件。
source/client/test/clientTests.cpp
浏览文件 @
32d2b1cc
...
...
@@ -49,7 +49,7 @@ int main(int argc, char** argv) {
TEST
(
testCase
,
driverInit_Test
)
{
taos_init
();
}
TEST
(
testCase
,
connect_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
"abc1"
,
0
);
if
(
pConn
==
NULL
)
{
printf
(
"failed to connect to server, reason:%s
\n
"
,
taos_errstr
(
NULL
));
}
...
...
source/libs/planner/src/physicalPlanJson.c
浏览文件 @
32d2b1cc
...
...
@@ -30,7 +30,8 @@ static void copyString(const cJSON* json, const char* name, char* dst) {
}
static
int64_t
getNumber
(
const
cJSON
*
json
,
const
char
*
name
)
{
return
cJSON_GetNumberValue
(
cJSON_GetObjectItem
(
json
,
name
));
double
d
=
cJSON_GetNumberValue
(
cJSON_GetObjectItem
(
json
,
name
));
return
(
int64_t
)
d
;
}
static
bool
addObject
(
cJSON
*
json
,
const
char
*
name
,
FToJson
func
,
const
void
*
obj
)
{
...
...
@@ -541,17 +542,27 @@ static const char* jkTimeWindowEndKey = "EndKey";
static
bool
timeWindowToJson
(
const
void
*
obj
,
cJSON
*
json
)
{
const
STimeWindow
*
win
=
(
const
STimeWindow
*
)
obj
;
bool
res
=
cJSON_AddNumberToObject
(
json
,
jkTimeWindowStartKey
,
win
->
skey
);
char
tmp
[
32
]
=
{
0
};
sprintf
(
tmp
,
"%"
PRId64
,
win
->
skey
);
bool
res
=
cJSON_AddStringToObject
(
json
,
jkTimeWindowStartKey
,
tmp
);
if
(
res
)
{
res
=
cJSON_AddNumberToObject
(
json
,
jkTimeWindowEndKey
,
win
->
ekey
);
memset
(
tmp
,
0
,
tListLen
(
tmp
));
sprintf
(
tmp
,
"%"
PRId64
,
win
->
ekey
);
res
=
cJSON_AddStringToObject
(
json
,
jkTimeWindowEndKey
,
tmp
);
}
return
res
;
}
static
bool
timeWindowFromJson
(
const
cJSON
*
json
,
void
*
obj
)
{
STimeWindow
*
win
=
(
STimeWindow
*
)
obj
;
win
->
skey
=
getNumber
(
json
,
jkTimeWindowStartKey
);
win
->
ekey
=
getNumber
(
json
,
jkTimeWindowEndKey
);
char
*
p
=
getString
(
json
,
jkTimeWindowStartKey
);
win
->
skey
=
strtoll
(
p
,
NULL
,
10
);
p
=
getString
(
json
,
jkTimeWindowEndKey
);
win
->
ekey
=
strtoll
(
p
,
NULL
,
10
);
return
true
;
}
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
32d2b1cc
...
...
@@ -1262,7 +1262,8 @@ int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
}
QW_ERR_JRET
(
qwAddTask
(
qWorkerMgmt
,
sId
,
qId
,
tId
,
JOB_TASK_STATUS_EXECUTING
));
QW_DLOG
(
"query task received, reqId:0x%"
PRIx64
", physical plan:%s"
,
qId
,
msg
->
msg
);
code
=
qStringToSubplan
(
msg
->
msg
,
&
plan
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
QW_TASK_ELOG
(
"string to subplan failed, code:%d"
,
code
);
...
...
source/libs/transport/test/transportTests.cc
浏览文件 @
32d2b1cc
...
...
@@ -13,23 +13,126 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef USE_UV
#include <gtest/gtest.h>
#include <chrono>
#include <iostream>
#include <string>
#include <thread>
#include <vector>
#include "transportInt.h"
#include "trpc.h"
using
namespace
std
;
int
main
()
{
SRpcInit
init
=
{.
localPort
=
6030
,
.
label
=
"rpc"
,
.
numOfThreads
=
5
};
void
*
p
=
rpcOpen
(
&
init
);
struct
QueueElem
{
queue
q
;
int
val
;
};
class
QueueObj
{
public:
QueueObj
()
{
// avoid formate
QUEUE_INIT
(
&
head
);
}
void
Push
(
QueueElem
*
el
)
{
// avoid formate
QUEUE_PUSH
(
&
head
,
&
el
->
q
);
}
QueueElem
*
Pop
()
{
QueueElem
*
el
=
NULL
;
if
(
!
IsEmpty
())
{
queue
*
h
=
QUEUE_HEAD
(
&
head
);
el
=
QUEUE_DATA
(
h
,
QueueElem
,
q
);
QUEUE_REMOVE
(
&
el
->
q
);
}
return
el
;
}
bool
IsEmpty
()
{
// avoid formate
return
QUEUE_IS_EMPTY
(
&
head
);
}
void
RmElem
(
QueueElem
*
el
)
{
// impl
QUEUE_REMOVE
(
&
el
->
q
);
}
void
ForEach
(
std
::
vector
<
int
>
&
result
)
{
queue
*
h
;
QUEUE_FOREACH
(
h
,
&
head
)
{
// add more
QueueElem
*
el
=
QUEUE_DATA
(
h
,
QueueElem
,
q
);
result
.
push_back
(
el
->
val
);
}
}
private:
queue
head
;
};
while
(
1
)
{
std
::
cout
<<
"cron task"
<<
std
::
endl
;
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
10
*
1000
));
class
QueueEnv
:
public
::
testing
::
Test
{
protected:
virtual
void
SetUp
()
{
// TODO
q
=
new
QueueObj
();
}
virtual
void
TearDown
()
{
delete
q
;
// formate
}
QueueObj
*
q
;
};
TEST_F
(
QueueEnv
,
testPushAndPop
)
{
// add more test
assert
(
q
->
IsEmpty
());
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
QueueElem
*
el
=
(
QueueElem
*
)
malloc
(
sizeof
(
QueueElem
));
el
->
val
=
i
;
q
->
Push
(
el
);
}
int
i
=
0
;
while
(
!
q
->
IsEmpty
())
{
QueueElem
*
el
=
q
->
Pop
();
assert
(
el
->
val
==
i
++
);
free
(
el
);
}
assert
(
q
->
IsEmpty
());
}
TEST_F
(
QueueEnv
,
testRm
)
{
// add more test
std
::
vector
<
QueueElem
*>
set
;
assert
(
q
->
IsEmpty
());
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
QueueElem
*
el
=
(
QueueElem
*
)
malloc
(
sizeof
(
QueueElem
));
el
->
val
=
i
;
q
->
Push
(
el
);
set
.
push_back
(
el
);
}
for
(
int
i
=
set
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
QueueElem
*
el
=
set
[
i
];
q
->
RmElem
(
el
);
free
(
el
);
}
assert
(
q
->
IsEmpty
());
}
TEST_F
(
QueueEnv
,
testIter
)
{
// add more test
assert
(
q
->
IsEmpty
());
std
::
vector
<
int
>
vals
;
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
QueueElem
*
el
=
(
QueueElem
*
)
malloc
(
sizeof
(
QueueElem
));
el
->
val
=
i
;
q
->
Push
(
el
);
vals
.
push_back
(
i
);
}
std
::
vector
<
int
>
result
;
q
->
ForEach
(
result
);
assert
(
result
.
size
()
==
vals
.
size
());
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录