Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2e03fd72
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看板
提交
2e03fd72
编写于
6月 01, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] support microsecond database options.
上级
7ed62985
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
30 addition
and
24 deletion
+30
-24
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-1
src/common/src/tglobal.c
src/common/src/tglobal.c
+3
-2
src/inc/taosdef.h
src/inc/taosdef.h
+4
-9
src/inc/tsdb.h
src/inc/tsdb.h
+3
-2
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+7
-4
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+6
-2
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+5
-3
未找到文件。
src/common/inc/tglobal.h
浏览文件 @
2e03fd72
...
...
@@ -49,7 +49,7 @@ extern int32_t tsTotalMemoryMB;
extern
int32_t
tsVersion
;
extern
int32_t
tscEmbedded
;
extern
int64_t
tsMsPerDay
[
2
];
extern
int64_t
tsMsPerDay
[
3
];
extern
char
tsFirst
[];
extern
char
tsSecond
[];
...
...
src/common/src/tglobal.c
浏览文件 @
2e03fd72
...
...
@@ -55,11 +55,12 @@ int32_t tsEnableCoreFile = 0;
int32_t
tscEmbedded
=
0
;
/*
* minmum scale for whole system, millisecond by default
* min
i
mum scale for whole system, millisecond by default
* for TSDB_TIME_PRECISION_MILLI: 86400000L
* TSDB_TIME_PRECISION_MICRO: 86400000000L
* TSDB_TIME_PRECISION_NANO: 86400000000000L
*/
int64_t
tsMsPerDay
[]
=
{
86400000L
,
86400000000L
};
int64_t
tsMsPerDay
[]
=
{
86400000L
,
86400000000L
,
86400000000000L
};
char
tsFirst
[
TSDB_EP_LEN
]
=
{
0
};
char
tsSecond
[
TSDB_EP_LEN
]
=
{
0
};
...
...
src/inc/taosdef.h
浏览文件 @
2e03fd72
...
...
@@ -91,6 +91,7 @@ extern const int32_t TYPE_BYTES[11];
#define TSDB_TIME_PRECISION_MILLI 0
#define TSDB_TIME_PRECISION_MICRO 1
#define TSDB_TIME_PRECISION_NANO 2
#define TSDB_TIME_PRECISION_MILLI_STR "ms"
#define TSDB_TIME_PRECISION_MICRO_STR "us"
...
...
@@ -285,9 +286,9 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_MAX_COMMIT_TIME 40960
#define TSDB_DEFAULT_COMMIT_TIME 3600
#define TSDB_MIN_PRECISION TSDB_PRECISION_MILLI
#define TSDB_MAX_PRECISION TSDB_PRECISION_NANO
#define TSDB_DEFAULT_PRECISION TSDB_PRECISION_MILLI
#define TSDB_MIN_PRECISION TSDB_
TIME_
PRECISION_MILLI
#define TSDB_MAX_PRECISION TSDB_
TIME_
PRECISION_NANO
#define TSDB_DEFAULT_PRECISION TSDB_
TIME_
PRECISION_MILLI
#define TSDB_MIN_COMP_LEVEL 0
#define TSDB_MAX_COMP_LEVEL 2
...
...
@@ -356,12 +357,6 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TAOS_QTYPE_WAL 2
#define TAOS_QTYPE_CQ 3
typedef
enum
{
TSDB_PRECISION_MILLI
,
TSDB_PRECISION_MICRO
,
TSDB_PRECISION_NANO
}
EPrecisionType
;
typedef
enum
{
TSDB_SUPER_TABLE
=
0
,
// super table
TSDB_CHILD_TABLE
=
1
,
// table created from super table
...
...
src/inc/tsdb.h
浏览文件 @
2e03fd72
...
...
@@ -64,13 +64,14 @@ typedef struct {
int8_t
compression
;
}
STsdbCfg
;
typedef
void
TsdbRepoT
;
// use void to hide implementation details from outside
void
tsdbSetDefaultCfg
(
STsdbCfg
*
pCfg
);
STsdbCfg
*
tsdbCreateDefaultCfg
();
void
tsdbFreeCfg
(
STsdbCfg
*
pCfg
);
STsdbCfg
*
tsdbGetCfg
(
const
TsdbRepoT
*
repo
);
// --------- TSDB REPOSITORY DEFINITION
typedef
void
TsdbRepoT
;
// use void to hide implementation details from outside
int
tsdbCreateRepo
(
char
*
rootDir
,
STsdbCfg
*
pCfg
,
void
*
limiter
);
int32_t
tsdbDropRepo
(
TsdbRepoT
*
repo
);
TsdbRepoT
*
tsdbOpenRepo
(
char
*
rootDir
,
STsdbAppH
*
pAppH
);
...
...
src/query/inc/qExecutor.h
浏览文件 @
2e03fd72
...
...
@@ -136,7 +136,7 @@ typedef struct SQuery {
int64_t
intervalTime
;
int64_t
slidingTime
;
// sliding time for sliding window query
char
slidingTimeUnit
;
// interval data type, used for daytime revise
int
8_t
precision
;
int
16_t
precision
;
int16_t
numOfOutput
;
int16_t
fillType
;
int16_t
checkBuffer
;
// check if the buffer is full during scan each block
...
...
src/query/src/qExecutor.c
浏览文件 @
2e03fd72
...
...
@@ -3964,10 +3964,12 @@ static SFillColInfo* taosCreateFillColInfo(SQuery* pQuery) {
}
int32_t
doInitQInfo
(
SQInfo
*
pQInfo
,
void
*
param
,
void
*
tsdb
,
int32_t
vgId
,
bool
isSTableQuery
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
pQuery
->
precision
=
tsdbGetCfg
(
tsdb
)
->
precision
;
setScanLimitationByResultBuffer
(
pQuery
);
changeExecuteScanOrder
(
pQuery
,
false
);
...
...
@@ -5422,7 +5424,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList,
pQuery
->
slidingTimeUnit
=
pQueryMsg
->
slidingTimeUnit
;
pQuery
->
fillType
=
pQueryMsg
->
fillType
;
pQuery
->
numOfTags
=
pQueryMsg
->
numOfTags
;
// todo do not allocate ??
pQuery
->
colList
=
calloc
(
numOfCols
,
sizeof
(
SSingleColumnFilterInfo
));
if
(
pQuery
->
colList
==
NULL
)
{
...
...
@@ -5491,7 +5493,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList,
int
tableIndex
=
0
;
STimeWindow
window
=
pQueryMsg
->
window
;
taosArraySort
(
pTableIdList
,
compareTableIdInfo
);
taosArraySort
(
pTableIdList
,
compareTableIdInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfGroups
;
++
i
)
{
SArray
*
pa
=
taosArrayGetP
(
groupInfo
->
pGroupList
,
i
);
size_t
s
=
taosArrayGetSize
(
pa
);
...
...
@@ -5960,7 +5962,8 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
(
*
pRsp
)
->
offset
=
0
;
(
*
pRsp
)
->
useconds
=
0
;
}
(
*
pRsp
)
->
precision
=
htons
(
pQuery
->
precision
);
if
(
pQuery
->
rec
.
rows
>
0
&&
code
==
TSDB_CODE_SUCCESS
)
{
code
=
doDumpQueryResult
(
pQInfo
,
(
*
pRsp
)
->
data
);
}
else
{
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
2e03fd72
...
...
@@ -9,8 +9,7 @@
#include "ttime.h"
#include <sys/stat.h>
#define TSDB_DEFAULT_PRECISION TSDB_PRECISION_MILLI // default precision
#define IS_VALID_PRECISION(precision) (((precision) >= TSDB_PRECISION_MILLI) && ((precision) <= TSDB_PRECISION_NANO))
#define IS_VALID_PRECISION(precision) (((precision) >= TSDB_TIME_PRECISION_MILLI) && ((precision) <= TSDB_TIME_PRECISION_NANO))
#define TSDB_DEFAULT_COMPRESSION TWO_STAGE_COMP
#define IS_VALID_COMPRESSION(compression) (((compression) >= NO_COMPRESSION) && ((compression) <= TWO_STAGE_COMP))
#define TSDB_MIN_ID 0
...
...
@@ -79,6 +78,11 @@ void tsdbFreeCfg(STsdbCfg *pCfg) {
if
(
pCfg
!=
NULL
)
free
(
pCfg
);
}
STsdbCfg
*
tsdbGetCfg
(
const
TsdbRepoT
*
repo
)
{
assert
(
repo
!=
NULL
);
return
&
((
STsdbRepo
*
)
repo
)
->
config
;
}
/**
* Create a new TSDB repository
* @param rootDir the TSDB repository root directory
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
2e03fd72
...
...
@@ -364,12 +364,13 @@ static bool hasMoreDataInCache(STsdbQueryHandle* pHandle) {
return
true
;
}
static
int32_t
getFileIdFromKey
(
TSKEY
key
,
int32_t
daysPerFile
)
{
static
int32_t
getFileIdFromKey
(
TSKEY
key
,
int32_t
daysPerFile
,
int32_t
precision
)
{
assert
(
precision
>=
TSDB_TIME_PRECISION_MICRO
||
precision
<=
TSDB_TIME_PRECISION_NANO
);
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
[
precision
]));
// set the starting fileId
if
(
fid
<
0L
&&
llabs
(
fid
)
>
INT32_MAX
)
{
// data value overflow for INT32
fid
=
INT32_MIN
;
}
...
...
@@ -1297,7 +1298,8 @@ static bool getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle) {
// find the start data block in file
if
(
!
pQueryHandle
->
locateStart
)
{
pQueryHandle
->
locateStart
=
true
;
int32_t
fid
=
getFileIdFromKey
(
pQueryHandle
->
window
.
skey
,
pQueryHandle
->
pTsdb
->
config
.
daysPerFile
);
STsdbCfg
*
pCfg
=
&
pQueryHandle
->
pTsdb
->
config
;
int32_t
fid
=
getFileIdFromKey
(
pQueryHandle
->
window
.
skey
,
pCfg
->
daysPerFile
,
pCfg
->
precision
);
tsdbInitFileGroupIter
(
pFileHandle
,
&
pQueryHandle
->
fileIter
,
pQueryHandle
->
order
);
tsdbSeekFileGroupIter
(
&
pQueryHandle
->
fileIter
,
fid
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录