[TD-2325]<feature>: enable configure if 50% cpu will be used in query processing.
This commit is contained in:
parent
5015365172
commit
0fe731af0f
|
@ -251,7 +251,7 @@
|
||||||
# cqDebugFlag 131
|
# cqDebugFlag 131
|
||||||
|
|
||||||
# enable/disable recording the SQL in taos client
|
# enable/disable recording the SQL in taos client
|
||||||
# tscEnableRecordSql 0
|
# enableRecordSql 0
|
||||||
|
|
||||||
# generate core file when service crash
|
# generate core file when service crash
|
||||||
# enableCoreFile 1
|
# enableCoreFile 1
|
||||||
|
@ -264,3 +264,6 @@
|
||||||
|
|
||||||
# enable/disable stream (continuous query)
|
# enable/disable stream (continuous query)
|
||||||
# stream 1
|
# stream 1
|
||||||
|
|
||||||
|
# only 50% CPU resources will be used in query processing
|
||||||
|
# halfCoresForQuery 0
|
||||||
|
|
|
@ -56,6 +56,7 @@ extern char tsTempDir[];
|
||||||
|
|
||||||
//query buffer management
|
//query buffer management
|
||||||
extern int32_t tsQueryBufferSize; // maximum allowed usage buffer for each data node during query processing
|
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
|
// client
|
||||||
extern int32_t tsTableMetaKeepTimer;
|
extern int32_t tsTableMetaKeepTimer;
|
||||||
|
|
|
@ -107,6 +107,9 @@ int64_t tsMaxRetentWindow = 24 * 3600L; // maximum time window tolerance
|
||||||
// positive value (in MB)
|
// positive value (in MB)
|
||||||
int32_t tsQueryBufferSize = -1;
|
int32_t tsQueryBufferSize = -1;
|
||||||
|
|
||||||
|
// only 50% cpu will be used in query processing in dnode
|
||||||
|
int32_t tsHalfCoresForQuery = 0;
|
||||||
|
|
||||||
// db parameters
|
// db parameters
|
||||||
int32_t tsCacheBlockSize = TSDB_DEFAULT_CACHE_BLOCK_SIZE;
|
int32_t tsCacheBlockSize = TSDB_DEFAULT_CACHE_BLOCK_SIZE;
|
||||||
int32_t tsBlocksPerVnode = TSDB_DEFAULT_TOTAL_BLOCKS;
|
int32_t tsBlocksPerVnode = TSDB_DEFAULT_TOTAL_BLOCKS;
|
||||||
|
@ -884,6 +887,16 @@ static void doInitGlobalConfig(void) {
|
||||||
cfg.unitType = TAOS_CFG_UTYPE_BYTE;
|
cfg.unitType = TAOS_CFG_UTYPE_BYTE;
|
||||||
taosInitConfigOption(cfg);
|
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
|
// locale & charset
|
||||||
cfg.option = "timezone";
|
cfg.option = "timezone";
|
||||||
cfg.ptr = tsTimezone;
|
cfg.ptr = tsTimezone;
|
||||||
|
@ -1290,7 +1303,7 @@ static void doInitGlobalConfig(void) {
|
||||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||||
taosInitConfigOption(cfg);
|
taosInitConfigOption(cfg);
|
||||||
|
|
||||||
cfg.option = "tscEnableRecordSql";
|
cfg.option = "enableRecordSql";
|
||||||
cfg.ptr = &tsTscEnableRecordSql;
|
cfg.ptr = &tsTscEnableRecordSql;
|
||||||
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
||||||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG;
|
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG;
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
#include "taoserror.h"
|
#include "taoserror.h"
|
||||||
#include "tconfig.h"
|
#include "tconfig.h"
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
#include "tkey.h"
|
|
||||||
#include "tulog.h"
|
#include "tulog.h"
|
||||||
#include "tsocket.h"
|
|
||||||
#include "tsystem.h"
|
#include "tsystem.h"
|
||||||
#include "tutil.h"
|
#include "tutil.h"
|
||||||
|
|
||||||
|
|
|
@ -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);
|
vDebug("vgId:%d, QInfo:%p, dnode continues to exec query", pVnode->vgId, *qhandle);
|
||||||
|
|
||||||
|
// In the retrieve blocking model, only 50% CPU will be used in query processing
|
||||||
#if _NON_BLOCKING_RETRIEVE
|
if (tsHalfCoresForQuery) {
|
||||||
|
qTableQuery(*qhandle); // do execute query
|
||||||
|
qReleaseQInfo(pVnode->qMgmt, (void **)&qhandle, false);
|
||||||
|
} else {
|
||||||
bool freehandle = false;
|
bool freehandle = false;
|
||||||
bool buildRes = qTableQuery(*qhandle); // do execute query
|
bool buildRes = qTableQuery(*qhandle); // do execute query
|
||||||
|
|
||||||
|
@ -297,7 +300,6 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
|
||||||
} else {
|
} else {
|
||||||
void *h1 = qGetResultRetrieveMsg(*qhandle);
|
void *h1 = qGetResultRetrieveMsg(*qhandle);
|
||||||
assert(h1 == NULL);
|
assert(h1 == NULL);
|
||||||
|
|
||||||
freehandle = qQueryCompleted(*qhandle);
|
freehandle = qQueryCompleted(*qhandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,10 +308,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
|
||||||
if (freehandle || (!buildRes)) {
|
if (freehandle || (!buildRes)) {
|
||||||
qReleaseQInfo(pVnode->qMgmt, (void **)&qhandle, freehandle);
|
qReleaseQInfo(pVnode->qMgmt, (void **)&qhandle, freehandle);
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
qTableQuery(*qhandle); // do execute query
|
|
||||||
qReleaseQInfo(pVnode->qMgmt, (void **)&qhandle, false);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
@ -375,14 +374,16 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
|
||||||
freeHandle = true;
|
freeHandle = true;
|
||||||
} else { // result is not ready, return immediately
|
} else { // result is not ready, return immediately
|
||||||
assert(buildRes == true);
|
assert(buildRes == true);
|
||||||
#if _NON_BLOCKING_RETRIEVE
|
|
||||||
|
// Only effects in the non-blocking model
|
||||||
|
if (!tsHalfCoresForQuery) {
|
||||||
if (!buildRes) {
|
if (!buildRes) {
|
||||||
assert(pRead->rpcHandle != NULL);
|
assert(pRead->rpcHandle != NULL);
|
||||||
|
|
||||||
qReleaseQInfo(pVnode->qMgmt, (void **)&handle, false);
|
qReleaseQInfo(pVnode->qMgmt, (void **)&handle, false);
|
||||||
return TSDB_CODE_QRY_NOT_READY;
|
return TSDB_CODE_QRY_NOT_READY;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
// ahandle is the sqlObj pointer
|
// ahandle is the sqlObj pointer
|
||||||
code = vnodeDumpQueryResult(pRet, pVnode, handle, &freeHandle, pRead->rpcHandle);
|
code = vnodeDumpQueryResult(pRet, pVnode, handle, &freeHandle, pRead->rpcHandle);
|
||||||
|
|
Loading…
Reference in New Issue