Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8fc2bb8d
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8fc2bb8d
编写于
12月 04, 2020
作者:
H
haojun Liao
提交者:
GitHub
12月 04, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4428 from taosdata/feature/query
Feature/query
上级
8c9c4050
7090b3fe
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
78 addition
and
45 deletion
+78
-45
packaging/cfg/taos.cfg
packaging/cfg/taos.cfg
+4
-1
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+17
-4
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+14
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+6
-2
src/util/src/tconfig.c
src/util/src/tconfig.c
+0
-2
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+36
-35
未找到文件。
packaging/cfg/taos.cfg
浏览文件 @
8fc2bb8d
...
...
@@ -251,7 +251,7 @@
# cqDebugFlag 131
# enable/disable recording the SQL in taos client
#
tscE
nableRecordSql 0
#
e
nableRecordSql 0
# generate core file when service crash
# enableCoreFile 1
...
...
@@ -264,3 +264,6 @@
# enable/disable stream (continuous query)
# stream 1
# only 50% CPU resources will be used in query processing
# halfCoresForQuery 0
src/client/src/tscParseInsert.c
浏览文件 @
8fc2bb8d
...
...
@@ -630,11 +630,17 @@ int32_t tscAllocateMemIfNeed(STableDataBlocks *pDataBlock, int32_t rowSize, int3
return
TSDB_CODE_SUCCESS
;
}
static
void
tsSetBlockInfo
(
SSubmitBlk
*
pBlocks
,
const
STableMeta
*
pTableMeta
,
int32_t
numOfRows
)
{
static
int32_t
tsSetBlockInfo
(
SSubmitBlk
*
pBlocks
,
const
STableMeta
*
pTableMeta
,
int32_t
numOfRows
)
{
pBlocks
->
tid
=
pTableMeta
->
id
.
tid
;
pBlocks
->
uid
=
pTableMeta
->
id
.
uid
;
pBlocks
->
sversion
=
pTableMeta
->
sversion
;
if
(
pBlocks
->
numOfRows
+
numOfRows
>=
INT16_MAX
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
else
{
pBlocks
->
numOfRows
+=
numOfRows
;
return
TSDB_CODE_SUCCESS
;
}
}
// data block is disordered, sort it in ascending order
...
...
@@ -722,7 +728,11 @@ static int32_t doParseInsertStatement(SSqlObj *pSql, void *pTableList, char **st
}
SSubmitBlk
*
pBlocks
=
(
SSubmitBlk
*
)(
dataBuf
->
pData
);
tsSetBlockInfo
(
pBlocks
,
pTableMeta
,
numOfRows
);
code
=
tsSetBlockInfo
(
pBlocks
,
pTableMeta
,
numOfRows
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"too many rows in sql, total number of rows should be less than 32767"
,
*
str
);
return
code
;
}
dataBuf
->
vgId
=
pTableMeta
->
vgroupInfo
.
vgId
;
dataBuf
->
numOfTables
=
1
;
...
...
@@ -1384,7 +1394,10 @@ static int doPackSendDataBlock(SSqlObj *pSql, int32_t numOfRows, STableDataBlock
STableMeta
*
pTableMeta
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
)
->
pTableMeta
;
SSubmitBlk
*
pBlocks
=
(
SSubmitBlk
*
)(
pTableDataBlocks
->
pData
);
tsSetBlockInfo
(
pBlocks
,
pTableMeta
,
numOfRows
);
code
=
tsSetBlockInfo
(
pBlocks
,
pTableMeta
,
numOfRows
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"too many rows in sql, total number of rows should be less than 32767"
,
NULL
);
}
if
((
code
=
tscMergeTableDataBlocks
(
pSql
,
pCmd
->
pDataBlocks
))
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
...
...
src/common/inc/tglobal.h
浏览文件 @
8fc2bb8d
...
...
@@ -56,6 +56,7 @@ extern char tsTempDir[];
//query buffer management
extern
int32_t
tsQueryBufferSize
;
// maximum allowed usage buffer for each data node during query processing
extern
int32_t
tsHalfCoresForQuery
;
// only 50% will be used in query processing
// client
extern
int32_t
tsTableMetaKeepTimer
;
...
...
src/common/src/tglobal.c
浏览文件 @
8fc2bb8d
...
...
@@ -107,6 +107,9 @@ int64_t tsMaxRetentWindow = 24 * 3600L; // maximum time window tolerance
// positive value (in MB)
int32_t
tsQueryBufferSize
=
-
1
;
// only 50% cpu will be used in query processing in dnode
int32_t
tsHalfCoresForQuery
=
0
;
// db parameters
int32_t
tsCacheBlockSize
=
TSDB_DEFAULT_CACHE_BLOCK_SIZE
;
int32_t
tsBlocksPerVnode
=
TSDB_DEFAULT_TOTAL_BLOCKS
;
...
...
@@ -884,6 +887,16 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_BYTE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"halfCoresForQuery"
;
cfg
.
ptr
=
&
tsHalfCoresForQuery
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
1
;
cfg
.
ptrLength
=
1
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
// locale & charset
cfg
.
option
=
"timezone"
;
cfg
.
ptr
=
tsTimezone
;
...
...
@@ -1290,7 +1303,7 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"
tscE
nableRecordSql"
;
cfg
.
option
=
"
e
nableRecordSql"
;
cfg
.
ptr
=
&
tsTscEnableRecordSql
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
...
...
src/query/src/qExecutor.c
浏览文件 @
8fc2bb8d
...
...
@@ -1372,8 +1372,12 @@ static int32_t setGroupResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, char *pDat
}
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pResultRow
->
key
==
NULL
)
{
pResultRow
->
key
=
malloc
(
varDataTLen
(
pData
));
varDataCopy
(
pResultRow
->
key
,
pData
);
}
else
{
assert
(
memcmp
(
pResultRow
->
key
,
pData
,
varDataTLen
(
pData
))
==
0
);
}
}
else
{
pResultRow
->
win
.
skey
=
v
;
pResultRow
->
win
.
ekey
=
v
;
...
...
src/util/src/tconfig.c
浏览文件 @
8fc2bb8d
...
...
@@ -19,9 +19,7 @@
#include "taoserror.h"
#include "tconfig.h"
#include "tglobal.h"
#include "tkey.h"
#include "tulog.h"
#include "tsocket.h"
#include "tsystem.h"
#include "tutil.h"
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
8fc2bb8d
...
...
@@ -275,8 +275,11 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
vDebug
(
"vgId:%d, QInfo:%p, dnode continues to exec query"
,
pVnode
->
vgId
,
*
qhandle
);
#if _NON_BLOCKING_RETRIEVE
// In the retrieve blocking model, only 50% CPU will be used in query processing
if
(
tsHalfCoresForQuery
)
{
qTableQuery
(
*
qhandle
);
// do execute query
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
qhandle
,
false
);
}
else
{
bool
freehandle
=
false
;
bool
buildRes
=
qTableQuery
(
*
qhandle
);
// do execute query
...
...
@@ -295,9 +298,8 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// NOTE: set return code to be TSDB_CODE_QRY_HAS_RSP to notify dnode to return msg to client
code
=
TSDB_CODE_QRY_HAS_RSP
;
}
else
{
void
*
h1
=
qGetResultRetrieveMsg
(
*
qhandle
);
void
*
h1
=
qGetResultRetrieveMsg
(
*
qhandle
);
assert
(
h1
==
NULL
);
freehandle
=
qQueryCompleted
(
*
qhandle
);
}
...
...
@@ -306,10 +308,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if
(
freehandle
||
(
!
buildRes
))
{
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
qhandle
,
freehandle
);
}
#else
qTableQuery
(
*
qhandle
);
// do execute query
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
qhandle
,
false
);
#endif
}
}
return
code
;
...
...
@@ -375,14 +374,16 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
freeHandle
=
true
;
}
else
{
// result is not ready, return immediately
assert
(
buildRes
==
true
);
#if _NON_BLOCKING_RETRIEVE
// Only effects in the non-blocking model
if
(
!
tsHalfCoresForQuery
)
{
if
(
!
buildRes
)
{
assert
(
pRead
->
rpcHandle
!=
NULL
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
false
);
return
TSDB_CODE_QRY_NOT_READY
;
}
#endif
}
// ahandle is the sqlObj pointer
code
=
vnodeDumpQueryResult
(
pRet
,
pVnode
,
handle
,
&
freeHandle
,
pRead
->
rpcHandle
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录