From bf9daf80e9a1dcd18792de8c7edbc3aad8257410 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 1 Nov 2021 12:53:03 +0800 Subject: [PATCH] [TD-10773]: add user configurable option smlChildTableName to specify child table name instead using ID in tag field. --- src/common/inc/tglobal.h | 1 + src/common/src/tglobal.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index c91637b1e8..e77359ef05 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -231,6 +231,7 @@ extern int8_t tsDeadLockKillQuery; // schemaless extern char tsDefaultJSONStrType[]; +extern char tsSmlChildTableName[]; typedef struct { char dir[TSDB_FILENAME_LEN]; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index f3ba69ec40..fe55e2e45a 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -286,6 +286,7 @@ int8_t tsDeadLockKillQuery = 0; // default JSON string type char tsDefaultJSONStrType[7] = "binary"; +char tsSmlChildTableName[TSDB_TABLE_NAME_LEN] = ""; //user defined child table name can be specified in tag value. If set to empty system will generate table name using MD5 hash. int32_t (*monStartSystemFp)() = NULL; void (*monStopSystemFp)() = NULL; @@ -1653,6 +1654,17 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + // child talbe name specified in schemaless tag value + cfg.option = "smlChildTableName"; + cfg.ptr = tsSmlChildTableName; + cfg.valType = TAOS_CFG_VTYPE_STRING; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW | TSDB_CFG_CTYPE_B_CLIENT; + cfg.minValue = 0; + cfg.maxValue = 0; + cfg.ptrLength = tListLen(tsSmlChildTableName); + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + // flush vnode wal file if walSize > walFlushSize and walSize > cache*0.5*blocks cfg.option = "walFlushSize"; cfg.ptr = &tsdbWalFlushSize; -- GitLab