Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ac6f6292
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看板
提交
ac6f6292
编写于
6月 01, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] handle file id overflow problem
上级
c454def8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
13 deletion
+53
-13
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+9
-1
tests/examples/c/demo.c
tests/examples/c/demo.c
+42
-11
tests/script/general/import/commit.sim
tests/script/general/import/commit.sim
+2
-1
未找到文件。
src/tsdb/src/tsdbRead.c
浏览文件 @
ac6f6292
...
@@ -365,8 +365,16 @@ static bool hasMoreDataInCache(STsdbQueryHandle* pHandle) {
...
@@ -365,8 +365,16 @@ static bool hasMoreDataInCache(STsdbQueryHandle* pHandle) {
}
}
static
int32_t
getFileIdFromKey
(
TSKEY
key
,
int32_t
daysPerFile
)
{
static
int32_t
getFileIdFromKey
(
TSKEY
key
,
int32_t
daysPerFile
)
{
if
(
key
==
TSKEY_INITIAL_VAL
)
{
return
INT32_MIN
;
}
int64_t
fid
=
(
int64_t
)(
key
/
(
daysPerFile
*
tsMsPerDay
[
0
]));
// set the starting fileId
int64_t
fid
=
(
int64_t
)(
key
/
(
daysPerFile
*
tsMsPerDay
[
0
]));
// set the starting fileId
if
(
fid
>
INT32_MAX
)
{
if
(
fid
<
0L
&&
llabs
(
fid
)
>
INT32_MAX
)
{
// data value overflow for INT32
fid
=
INT32_MIN
;
}
if
(
fid
>
0L
&&
fid
>
INT32_MAX
)
{
fid
=
INT32_MAX
;
fid
=
INT32_MAX
;
}
}
...
...
tests/examples/c/demo.c
浏览文件 @
ac6f6292
...
@@ -16,11 +16,12 @@
...
@@ -16,11 +16,12 @@
// TAOS standard API example. The same syntax as MySQL, but only a subet
// TAOS standard API example. The same syntax as MySQL, but only a subet
// to compile: gcc -o demo demo.c -ltaos
// to compile: gcc -o demo demo.c -ltaos
#include <pthread.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <unistd.h>
#include <taos.h> // TAOS header file
#include <taos.h> // TAOS header file
#include <unistd.h>
void
taosMsleep
(
int
mseconds
);
void
taosMsleep
(
int
mseconds
);
...
@@ -49,19 +50,52 @@ static int32_t doQuery(TAOS* taos, const char* sql) {
...
@@ -49,19 +50,52 @@ static int32_t doQuery(TAOS* taos, const char* sql) {
return
0
;
return
0
;
}
}
void
*
oneLoader
(
void
*
param
)
{
TAOS
*
conn
=
(
TAOS
*
)
param
;
for
(
int32_t
i
=
0
;
i
<
20000
;
++
i
)
{
// doQuery(conn, "show databases");
doQuery
(
conn
,
"use test"
);
// doQuery(conn, "describe t12");
// doQuery(conn, "show tables");
// doQuery(conn, "create table if not exists abc (ts timestamp, k int)");
// doQuery(conn, "select * from t12");
}
return
0
;
}
static
__attribute__
((
unused
))
void
multiThreadTest
(
int32_t
numOfThreads
,
void
*
conn
)
{
pthread_attr_t
thattr
;
pthread_attr_init
(
&
thattr
);
pthread_attr_setdetachstate
(
&
thattr
,
PTHREAD_CREATE_JOINABLE
);
pthread_t
*
threadId
=
malloc
(
sizeof
(
pthread_t
)
*
numOfThreads
);
for
(
int
i
=
0
;
i
<
numOfThreads
;
++
i
)
{
pthread_create
(
&
threadId
[
i
],
NULL
,
oneLoader
,
conn
);
}
for
(
int32_t
i
=
0
;
i
<
numOfThreads
;
++
i
)
{
pthread_join
(
threadId
[
i
],
NULL
);
}
pthread_attr_destroy
(
&
thattr
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
TAOS
*
taos
;
TAOS
*
taos
;
char
qstr
[
1024
];
char
qstr
[
1024
];
TAOS_RES
*
result
;
TAOS_RES
*
result
;
// connect to server
// connect to server
if
(
argc
<
2
)
{
if
(
argc
<
2
)
{
printf
(
"please input server-ip
\n
"
);
printf
(
"please input server-ip
\n
"
);
return
0
;
return
0
;
}
}
taos_options
(
TSDB_OPTION_CONFIGDIR
,
"
~/sec
/cfg"
);
taos_options
(
TSDB_OPTION_CONFIGDIR
,
"
/home/lisa/Documents/workspace/TDinternal/community/sim/tsim
/cfg"
);
// init TAOS
// init TAOS
taos_init
();
taos_init
();
...
@@ -73,15 +107,12 @@ int main(int argc, char *argv[]) {
...
@@ -73,15 +107,12 @@ int main(int argc, char *argv[]) {
}
}
printf
(
"success to connect to server
\n
"
);
printf
(
"success to connect to server
\n
"
);
doQuery
(
taos
,
"create database if not exists test"
);
// multiThreadTest(1, taos);
doQuery
(
taos
,
"use test"
);
doQuery
(
taos
,
"select max(c1), min(c2), sum(c3), avg(c4), first(c7), last(c8), first(c9) from lm2_db0.lm2_stb0 where ts >= 1537146000000 and ts <= 1543145400000 interval(5m) fill(value, -1, -2) group by t1 limit 2 offset 10;"
);
doQuery
(
taos
,
"select count(*) from m1 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 1:1:59' interval(500a) fill(value, 99)"
);
// for(int32_t i = 0; i < 100000; ++i) {
// doQuery(taos, "insert into t1 values(now, 2)");
// doQuery(taos, "create table t1(ts timestamp, k binary(12), f nchar(2))");
// for(int32_t i = 0; i< 100000; ++i) {
// doQuery(taos, "select m1.ts,m1.a from m1, m2 where m1.ts=m2.ts and m1.a=m2.b;");
// usleep(500000);
// }
// }
// doQuery(taos, "create table t1(ts timestamp, k binary(12), f nchar(2))");
// doQuery(taos, "insert into tm0 values('2020-1-1 1:1:1', 'abc')");
// doQuery(taos, "insert into tm0 values('2020-1-1 1:1:1', 'abc')");
// doQuery(taos, "create table if not exists tm0 (ts timestamp, k int);");
// doQuery(taos, "create table if not exists tm0 (ts timestamp, k int);");
...
...
tests/script/general/import/commit.sim
浏览文件 @
ac6f6292
...
@@ -78,7 +78,8 @@ sleep 5000
...
@@ -78,7 +78,8 @@ sleep 5000
print ========= step4
print ========= step4
sql select * from ic2db.tb;
sql select * from ic2db.tb;
if $rows != 13 then
if $rows != 13 then
print expect 13, actual:$rows
return -1
return -1
endi
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录