From 7614a982adb0bfd84d09096506a707313bc4a045 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 8 Dec 2021 21:02:53 +0800 Subject: [PATCH] [TS-854]: add forceDataRow option in taos.cfg --- packaging/cfg/taos.cfg | 3 +++ src/client/src/tscParseInsert.c | 6 ++++++ src/common/inc/tglobal.h | 1 + src/common/src/tglobal.c | 11 +++++++++++ src/util/inc/tconfig.h | 2 +- 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg index 3ae4e9941e..c16410a4fe 100644 --- a/packaging/cfg/taos.cfg +++ b/packaging/cfg/taos.cfg @@ -284,3 +284,6 @@ keepColumnName 1 # 0 no query allowed, queries are disabled # queryBufferSize -1 +# +# + diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index b8d7e8a32b..1902e3aa25 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -44,6 +44,12 @@ static int32_t parseBoundColumns(SInsertStatementParam *pInsertParam, SParsedDat int initMemRowBuilder(SMemRowBuilder *pBuilder, uint32_t nRows, uint32_t nCols, uint32_t nBoundCols, int32_t allNullLen) { ASSERT(nRows >= 0 && nCols > 0 && (nBoundCols <= nCols)); + + if (tsForceDataRow) { + pBuilder->memRowType = SMEM_ROW_DATA; + return TSDB_CODE_SUCCESS; + } + if (nRows > 0) { // already init(bind multiple rows by single column) if (pBuilder->compareStat == ROW_COMPARE_NEED && (pBuilder->rowInfo != NULL)) { diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index ffa89b8c39..b2fed24aaf 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -46,6 +46,7 @@ extern int32_t tsDnodeId; extern int tsRpcTimer; extern int tsRpcMaxTime; extern int tsRpcForceTcp; // all commands go to tcp protocol if this is enabled +extern int32_t tsForceDataRow; // use SDataRow forcibly extern int32_t tsMaxConnections; extern int32_t tsMaxShellConns; extern int32_t tsShellActivityTimer; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 50d3fcd1a9..7d6db5fde4 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -54,6 +54,7 @@ int32_t tsDnodeId = 0; int32_t tsRpcTimer = 300; int32_t tsRpcMaxTime = 600; // seconds; int32_t tsRpcForceTcp = 0; // disable this, means query, show command use udp protocol as default +int32_t tsForceDataRow = 0; // disable this at default int32_t tsMaxShellConns = 50000; int32_t tsMaxConnections = 5000; int32_t tsShellActivityTimer = 3; // second @@ -691,6 +692,16 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + cfg.option = "forceDataRow"; + cfg.ptr = &tsForceDataRow; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_SHOW; + cfg.minValue = 0; + cfg.maxValue = 1; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + cfg.option = "statusInterval"; cfg.ptr = &tsStatusInterval; cfg.valType = TAOS_CFG_VTYPE_INT32; diff --git a/src/util/inc/tconfig.h b/src/util/inc/tconfig.h index e2165ec1a3..b3d7fcd0a0 100644 --- a/src/util/inc/tconfig.h +++ b/src/util/inc/tconfig.h @@ -20,7 +20,7 @@ extern "C" { #endif -#define TSDB_CFG_MAX_NUM 122 +#define TSDB_CFG_MAX_NUM 123 #define TSDB_CFG_PRINT_LEN 23 #define TSDB_CFG_OPTION_LEN 24 #define TSDB_CFG_VALUE_LEN 41 -- GitLab