Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
5b239316
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5b239316
编写于
10月 24, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1739]
上级
36ae97a0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
82 addition
and
12 deletion
+82
-12
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+5
-2
src/common/src/tglobal.c
src/common/src/tglobal.c
+24
-8
src/inc/query.h
src/inc/query.h
+0
-1
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+51
-0
src/util/inc/tconfig.h
src/util/inc/tconfig.h
+1
-1
未找到文件。
src/common/inc/tglobal.h
浏览文件 @
5b239316
...
...
@@ -44,14 +44,17 @@ extern int32_t tsMaxShellConns;
extern
int32_t
tsShellActivityTimer
;
extern
uint32_t
tsMaxTmrCtrl
;
extern
float
tsNumOfThreadsPerCore
;
extern
float
tsRatioOfQueryThreads
;
extern
float
tsRatioOfQueryThreads
;
// todo remove it
extern
int8_t
tsDaylight
;
extern
char
tsTimezone
[];
extern
char
tsLocale
[];
extern
char
tsCharset
[];
// default encode string
extern
char
tsCharset
[];
// default encode string
extern
int32_t
tsEnableCoreFile
;
extern
int32_t
tsCompressMsgSize
;
//query buffer management
extern
int32_t
tsQueryBufferSize
;
// maximum allowed usage buffer for each data node during query processing
// client
extern
int32_t
tsTableMetaKeepTimer
;
extern
int32_t
tsMaxSQLStringLen
;
...
...
src/common/src/tglobal.c
浏览文件 @
5b239316
...
...
@@ -45,14 +45,14 @@ int32_t tsEnableTelemetryReporting = 1;
char
tsEmail
[
TSDB_FQDN_LEN
]
=
{
0
};
// common
int32_t
tsRpcTimer
=
1000
;
int32_t
tsRpcMaxTime
=
600
;
// seconds;
int32_t
tsMaxShellConns
=
5000
;
int32_t
tsRpcTimer
=
1000
;
int32_t
tsRpcMaxTime
=
600
;
// seconds;
int32_t
tsMaxShellConns
=
5000
;
int32_t
tsMaxConnections
=
5000
;
int32_t
tsShellActivityTimer
=
3
;
// second
float
tsNumOfThreadsPerCore
=
1
.
0
;
float
tsRatioOfQueryThreads
=
0
.
5
;
int8_t
tsDaylight
=
0
;
int32_t
tsShellActivityTimer
=
3
;
// second
float
tsNumOfThreadsPerCore
=
1
.
0
f
;
float
tsRatioOfQueryThreads
=
0
.
5
f
;
int8_t
tsDaylight
=
0
;
char
tsTimezone
[
TSDB_TIMEZONE_LEN
]
=
{
0
};
char
tsLocale
[
TSDB_LOCALE_LEN
]
=
{
0
};
char
tsCharset
[
TSDB_LOCALE_LEN
]
=
{
0
};
// default encode string
...
...
@@ -99,6 +99,12 @@ float tsStreamComputDelayRatio = 0.1f;
int32_t
tsProjectExecInterval
=
10000
;
// every 10sec, the projection will be executed once
int64_t
tsMaxRetentWindow
=
24
*
3600L
;
// maximum time window tolerance
// the maximum allowed query buffer size during query processing for each data node.
// -1 no limit (default)
// 0 no query allowed, queries are disabled
// positive value (in MB)
int32_t
tsQueryBufferSize
=
-
1
;
// db parameters
int32_t
tsCacheBlockSize
=
TSDB_DEFAULT_CACHE_BLOCK_SIZE
;
int32_t
tsBlocksPerVnode
=
TSDB_DEFAULT_TOTAL_BLOCKS
;
...
...
@@ -676,7 +682,7 @@ static void doInitGlobalConfig(void) {
cfg
.
minValue
=
TSDB_MIN_CACHE_BLOCK_SIZE
;
cfg
.
maxValue
=
TSDB_MAX_CACHE_BLOCK_SIZE
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_M
b
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_M
B
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"blocks"
;
...
...
@@ -839,6 +845,16 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"queryBufferSize"
;
cfg
.
ptr
=
&
tsQueryBufferSize
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
-
1
;
cfg
.
maxValue
=
10000000000000
;
//10TB
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_BYTE
;
taosInitConfigOption
(
cfg
);
// locale & charset
cfg
.
option
=
"timezone"
;
cfg
.
ptr
=
tsTimezone
;
...
...
src/inc/query.h
浏览文件 @
5b239316
...
...
@@ -78,7 +78,6 @@ int32_t qKillQuery(qinfo_t qinfo);
int32_t
qQueryCompleted
(
qinfo_t
qinfo
);
/**
* destroy query info structure
* @param qHandle
...
...
src/inc/taoserror.h
浏览文件 @
5b239316
...
...
@@ -230,6 +230,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_NOT_READY, 0, 0x0707, "Query not
TAOS_DEFINE_ERROR
(
TSDB_CODE_QRY_HAS_RSP
,
0
,
0x0708
,
"Query should response"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_QRY_IN_EXEC
,
0
,
0x0709
,
"Multiple retrieval of this query"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW
,
0
,
0x070A
,
"Too many time window in query"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_QRY_NOT_ENOUGH_BUFFER
,
0
,
0x070B
,
"Query buffer limit has reached"
)
// grant
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_EXPIRED
,
0
,
0x0800
,
"License expired"
)
...
...
src/query/src/qExecutor.c
浏览文件 @
5b239316
...
...
@@ -194,6 +194,8 @@ static void buildTagQueryResult(SQInfo *pQInfo);
static
int32_t
setAdditionalInfo
(
SQInfo
*
pQInfo
,
void
*
pTable
,
STableQueryInfo
*
pTableQueryInfo
);
static
int32_t
flushFromResultBuf
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SGroupResInfo
*
pGroupResInfo
);
static
int32_t
checkForQueryBuf
(
int32_t
numOfTables
);
static
void
releaseQueryBuf
(
int32_t
numOfTables
);
bool
doFilterData
(
SQuery
*
pQuery
,
int32_t
elemPos
)
{
for
(
int32_t
k
=
0
;
k
<
pQuery
->
numOfFilterCols
;
++
k
)
{
...
...
@@ -6492,6 +6494,8 @@ static void freeQInfo(SQInfo *pQInfo) {
qDebug
(
"QInfo:%p start to free QInfo"
,
pQInfo
);
releaseQueryBuf
(
pQInfo
->
tableqinfoGroupInfo
.
numOfTables
);
teardownQueryRuntimeEnv
(
&
pQInfo
->
runtimeEnv
);
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
...
...
@@ -6726,6 +6730,11 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
assert
(
0
);
}
code
=
checkForQueryBuf
(
tableGroupInfo
.
numOfTables
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// not enough query buffer, abort
goto
_over
;
}
(
*
pQInfo
)
=
createQInfoImpl
(
pQueryMsg
,
pGroupbyExpr
,
pExprs
,
&
tableGroupInfo
,
pTagColumnInfo
,
isSTableQuery
);
pExprs
=
NULL
;
pGroupbyExpr
=
NULL
;
...
...
@@ -7127,6 +7136,48 @@ static void buildTagQueryResult(SQInfo* pQInfo) {
setQueryStatus
(
pQuery
,
QUERY_COMPLETED
);
}
static
int64_t
getQuerySupportBufSize
(
int32_t
numOfTables
)
{
size_t
s1
=
sizeof
(
STableQueryInfo
);
size_t
s2
=
sizeof
(
SHashNode
);
// size_t s3 = sizeof(STableCheckInfo); buffer consumption in tsdb
return
(
s1
+
s2
)
*
1
.
5
*
numOfTables
;
}
int32_t
checkForQueryBuf
(
int32_t
numOfTables
)
{
int64_t
t
=
getQuerySupportBufSize
(
numOfTables
);
if
(
tsQueryBufferSize
<
0
)
{
return
true
;
}
else
if
(
tsQueryBufferSize
>
0
)
{
while
(
1
)
{
int64_t
s
=
tsQueryBufferSize
;
int64_t
remain
=
s
-
t
;
if
(
remain
>=
0
)
{
if
(
atomic_val_compare_exchange_64
(
&
tsQueryBufferSize
,
s
,
remain
)
==
s
)
{
return
TSDB_CODE_SUCCESS
;
}
}
else
{
return
TSDB_CODE_QRY_NOT_ENOUGH_BUFFER
;
}
}
}
// disable query processing if the value of tsQueryBufferSize is zero.
return
TSDB_CODE_QRY_NOT_ENOUGH_BUFFER
;
}
void
releaseQueryBuf
(
int32_t
numOfTables
)
{
if
(
tsQueryBufferSize
<=
0
)
{
return
;
}
int64_t
t
=
getQuerySupportBufSize
(
numOfTables
);
// restore value is not enough buffer available
atomic_add_fetch_64
(
&
tsQueryBufferSize
,
t
);
}
void
*
qGetResultRetrieveMsg
(
qinfo_t
qinfo
)
{
SQInfo
*
pQInfo
=
(
SQInfo
*
)
qinfo
;
assert
(
pQInfo
!=
NULL
);
...
...
src/util/inc/tconfig.h
浏览文件 @
5b239316
...
...
@@ -53,7 +53,7 @@ enum {
TAOS_CFG_UTYPE_NONE
,
TAOS_CFG_UTYPE_PERCENT
,
TAOS_CFG_UTYPE_GB
,
TAOS_CFG_UTYPE_M
b
,
TAOS_CFG_UTYPE_M
B
,
TAOS_CFG_UTYPE_BYTE
,
TAOS_CFG_UTYPE_SECOND
,
TAOS_CFG_UTYPE_MS
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录