Merge branch '3.0' of https://github.com/taosdata/TDengine into feat/TS-4243-3.0

This commit is contained in:
Hongze Cheng 2024-02-28 13:55:53 +08:00
commit 8a4b9db172
10 changed files with 38 additions and 26 deletions

View File

@ -234,10 +234,10 @@ int32_t taosCfgDynamicOptions(SConfig *pCfg, char *name, bool forServer);
struct SConfig *taosGetCfg(); struct SConfig *taosGetCfg();
void taosSetAllDebugFlag(int32_t flag); void taosSetGlobalDebugFlag(int32_t flag);
void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal); void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal);
void taosLocalCfgForbiddenToChange(char *name, bool *forbidden); void taosLocalCfgForbiddenToChange(char *name, bool *forbidden);
int8_t taosGranted(int8_t type); int8_t taosGranted(int8_t type);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -705,7 +705,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "monitorIntervalForBasic", tsMonitorIntervalForBasic, 1, 200000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) if (cfgAddInt32(pCfg, "monitorIntervalForBasic", tsMonitorIntervalForBasic, 1, 200000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0)
return -1; return -1;
if (cfgAddBool(pCfg, "monitorForceV2", tsMonitorForceV2, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; if (cfgAddBool(pCfg, "monitorForceV2", tsMonitorForceV2, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
if (cfgAddBool(pCfg, "audit", tsEnableAudit, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1; if (cfgAddBool(pCfg, "audit", tsEnableAudit, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1;
if (cfgAddBool(pCfg, "auditCreateTable", tsEnableAuditCreateTable, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; if (cfgAddBool(pCfg, "auditCreateTable", tsEnableAuditCreateTable, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
if (cfgAddInt32(pCfg, "auditInterval", tsAuditInterval, 500, 200000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; if (cfgAddInt32(pCfg, "auditInterval", tsAuditInterval, 500, 200000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1;
@ -1174,7 +1174,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsMonitorLogProtocol = cfgGetItem(pCfg, "monitorLogProtocol")->bval; tsMonitorLogProtocol = cfgGetItem(pCfg, "monitorLogProtocol")->bval;
tsMonitorIntervalForBasic = cfgGetItem(pCfg, "monitorIntervalForBasic")->i32; tsMonitorIntervalForBasic = cfgGetItem(pCfg, "monitorIntervalForBasic")->i32;
tsMonitorForceV2 = cfgGetItem(pCfg, "monitorForceV2")->i32; tsMonitorForceV2 = cfgGetItem(pCfg, "monitorForceV2")->i32;
tsEnableAudit = cfgGetItem(pCfg, "audit")->bval; tsEnableAudit = cfgGetItem(pCfg, "audit")->bval;
tsEnableAuditCreateTable = cfgGetItem(pCfg, "auditCreateTable")->bval; tsEnableAuditCreateTable = cfgGetItem(pCfg, "auditCreateTable")->bval;
tsAuditInterval = cfgGetItem(pCfg, "auditInterval")->i32; tsAuditInterval = cfgGetItem(pCfg, "auditInterval")->i32;
@ -1263,6 +1263,8 @@ static int32_t taosSetReleaseCfg(SConfig *pCfg) { return 0; }
int32_t taosSetReleaseCfg(SConfig *pCfg); int32_t taosSetReleaseCfg(SConfig *pCfg);
#endif #endif
static void taosSetAllDebugFlag(SConfig *pCfg, int32_t flag);
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd, int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc) { const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc) {
if (tsCfg == NULL) osDefaultInit(); if (tsCfg == NULL) osDefaultInit();
@ -1307,7 +1309,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
taosSetServerLogCfg(pCfg); taosSetServerLogCfg(pCfg);
} }
taosSetAllDebugFlag(cfgGetItem(pCfg, "debugFlag")->i32); taosSetAllDebugFlag(pCfg, cfgGetItem(pCfg, "debugFlag")->i32);
if (taosMulModeMkDir(tsLogDir, 0777, true) != 0) { if (taosMulModeMkDir(tsLogDir, 0777, true) != 0) {
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
@ -1385,7 +1387,7 @@ int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile
taosSetSystemCfg(tsCfg); taosSetSystemCfg(tsCfg);
if (taosSetFileHandlesLimit() != 0) return -1; if (taosSetFileHandlesLimit() != 0) return -1;
taosSetAllDebugFlag(cfgGetItem(tsCfg, "debugFlag")->i32); taosSetAllDebugFlag(tsCfg, cfgGetItem(tsCfg, "debugFlag")->i32);
cfgDumpCfg(tsCfg, tsc, false); cfgDumpCfg(tsCfg, tsc, false);
@ -1478,7 +1480,7 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, char *name) {
} }
if (strncasecmp(name, "debugFlag", 9) == 0) { if (strncasecmp(name, "debugFlag", 9) == 0) {
taosSetAllDebugFlag(pItem->i32); taosSetAllDebugFlag(pCfg, pItem->i32);
return 0; return 0;
} }
@ -1552,7 +1554,7 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, char *name) {
switch (lowcaseName[0]) { switch (lowcaseName[0]) {
case 'd': { case 'd': {
if (strcasecmp("debugFlag", name) == 0) { if (strcasecmp("debugFlag", name) == 0) {
taosSetAllDebugFlag(pItem->i32); taosSetAllDebugFlag(pCfg, pItem->i32);
matched = true; matched = true;
} }
break; break;
@ -1777,11 +1779,13 @@ static void taosCheckAndSetDebugFlag(int32_t *pFlagPtr, char *name, int32_t flag
taosSetDebugFlag(pFlagPtr, name, flag); taosSetDebugFlag(pFlagPtr, name, flag);
} }
void taosSetAllDebugFlag(int32_t flag) { void taosSetGlobalDebugFlag(int32_t flag) { taosSetAllDebugFlag(tsCfg, flag); }
static void taosSetAllDebugFlag(SConfig *pCfg, int32_t flag) {
if (flag <= 0) return; if (flag <= 0) return;
SArray *noNeedToSetVars = NULL; SArray *noNeedToSetVars = NULL;
SConfigItem *pItem = cfgGetItem(tsCfg, "debugFlag"); SConfigItem *pItem = cfgGetItem(pCfg, "debugFlag");
if (pItem != NULL) { if (pItem != NULL) {
pItem->i32 = flag; pItem->i32 = flag;
noNeedToSetVars = pItem->array; noNeedToSetVars = pItem->array;
@ -1831,4 +1835,4 @@ int8_t taosGranted(int8_t type) {
break; break;
} }
return 0; return 0;
} }

View File

@ -68,7 +68,7 @@ static struct {
int64_t startTime; int64_t startTime;
} global = {0}; } global = {0};
static void dmSetDebugFlag(int32_t signum, void *sigInfo, void *context) { taosSetAllDebugFlag(143); } static void dmSetDebugFlag(int32_t signum, void *sigInfo, void *context) { taosSetGlobalDebugFlag(143); }
static void dmSetAssert(int32_t signum, void *sigInfo, void *context) { tsAssert = 1; } static void dmSetAssert(int32_t signum, void *sigInfo, void *context) { tsAssert = 1; }
static void dmStopDnode(int signum, void *sigInfo, void *context) { static void dmStopDnode(int signum, void *sigInfo, void *context) {

View File

@ -216,7 +216,7 @@ int taos_collector_registry_validate_metric_name(taos_collector_registry_t *self
regfree(&r); regfree(&r);
return 0; return 0;
} }
/*
const char *taos_collector_registry_bridge(taos_collector_registry_t *self, char *ts, char *format) { const char *taos_collector_registry_bridge(taos_collector_registry_t *self, char *ts, char *format) {
taos_metric_formatter_clear(self->metric_formatter); taos_metric_formatter_clear(self->metric_formatter);
taos_metric_formatter_load_metrics(self->metric_formatter, self->collectors, ts, format); taos_metric_formatter_load_metrics(self->metric_formatter, self->collectors, ts, format);
@ -229,7 +229,7 @@ const char *taos_collector_registry_bridge(taos_collector_registry_t *self, char
return taos_string_builder_str(self->string_builder_batch); return taos_string_builder_str(self->string_builder_batch);
} }
*/
int taos_collector_registry_clear_batch(taos_collector_registry_t *self){ int taos_collector_registry_clear_batch(taos_collector_registry_t *self){
return taos_string_builder_clear(self->string_builder_batch); return taos_string_builder_clear(self->string_builder_batch);
} }

View File

@ -38,7 +38,7 @@ int taos_gauge_destroy(taos_gauge_t *self) {
self = NULL; self = NULL;
return r; return r;
} }
/*
int taos_gauge_inc(taos_gauge_t *self, const char **label_values) { int taos_gauge_inc(taos_gauge_t *self, const char **label_values) {
TAOS_ASSERT(self != NULL); TAOS_ASSERT(self != NULL);
if (self == NULL) return 1; if (self == NULL) return 1;
@ -86,7 +86,7 @@ int taos_gauge_sub(taos_gauge_t *self, double r_value, const char **label_values
if (sample == NULL) return 1; if (sample == NULL) return 1;
return taos_metric_sample_sub(sample, r_value); return taos_metric_sample_sub(sample, r_value);
} }
*/
int taos_gauge_set(taos_gauge_t *self, double r_value, const char **label_values) { int taos_gauge_set(taos_gauge_t *self, double r_value, const char **label_values) {
TAOS_ASSERT(self != NULL); TAOS_ASSERT(self != NULL);
if (self == NULL) return 1; if (self == NULL) return 1;

View File

@ -63,7 +63,7 @@ int taos_metric_formatter_destroy(taos_metric_formatter_t *self) {
self = NULL; self = NULL;
return ret; return ret;
} }
/*
int taos_metric_formatter_load_help(taos_metric_formatter_t *self, const char *name, const char *help) { int taos_metric_formatter_load_help(taos_metric_formatter_t *self, const char *name, const char *help) {
TAOS_ASSERT(self != NULL); TAOS_ASSERT(self != NULL);
if (self == NULL) return 1; if (self == NULL) return 1;
@ -105,7 +105,7 @@ int taos_metric_formatter_load_type(taos_metric_formatter_t *self, const char *n
return taos_string_builder_add_char(self->string_builder, '\n'); return taos_string_builder_add_char(self->string_builder, '\n');
} }
*/
int taos_metric_formatter_load_l_value(taos_metric_formatter_t *self, const char *name, const char *suffix, int taos_metric_formatter_load_l_value(taos_metric_formatter_t *self, const char *name, const char *suffix,
size_t label_count, const char **label_keys, const char **label_values) { size_t label_count, const char **label_keys, const char **label_values) {
TAOS_ASSERT(self != NULL); TAOS_ASSERT(self != NULL);
@ -156,7 +156,7 @@ int taos_metric_formatter_load_l_value(taos_metric_formatter_t *self, const char
} }
return 0; return 0;
} }
/*
int taos_metric_formatter_load_sample(taos_metric_formatter_t *self, taos_metric_sample_t *sample, int taos_metric_formatter_load_sample(taos_metric_formatter_t *self, taos_metric_sample_t *sample,
char *ts, char *format) { char *ts, char *format) {
TAOS_ASSERT(self != NULL); TAOS_ASSERT(self != NULL);
@ -185,7 +185,7 @@ int taos_metric_formatter_load_sample(taos_metric_formatter_t *self, taos_metric
return taos_string_builder_add_char(self->string_builder, '\n'); return taos_string_builder_add_char(self->string_builder, '\n');
} }
*/
int taos_metric_formatter_clear(taos_metric_formatter_t *self) { int taos_metric_formatter_clear(taos_metric_formatter_t *self) {
TAOS_ASSERT(self != NULL); TAOS_ASSERT(self != NULL);
return taos_string_builder_clear(self->string_builder); return taos_string_builder_clear(self->string_builder);
@ -204,7 +204,7 @@ char *taos_metric_formatter_dump(taos_metric_formatter_t *self) {
} }
return data; return data;
} }
/*
int taos_metric_formatter_load_metric(taos_metric_formatter_t *self, taos_metric_t *metric, char *ts, char *format) { int taos_metric_formatter_load_metric(taos_metric_formatter_t *self, taos_metric_t *metric, char *ts, char *format) {
TAOS_ASSERT(self != NULL); TAOS_ASSERT(self != NULL);
if (self == NULL) return 1; if (self == NULL) return 1;
@ -255,3 +255,4 @@ int taos_metric_formatter_load_metrics(taos_metric_formatter_t *self, taos_map_t
} }
return r; return r;
} }
*/

View File

@ -91,6 +91,7 @@ int taos_metric_sample_add(taos_metric_sample_t *self, double r_value) {
return 0; return 0;
} }
/*
int taos_metric_sample_sub(taos_metric_sample_t *self, double r_value) { int taos_metric_sample_sub(taos_metric_sample_t *self, double r_value) {
TAOS_ASSERT(self != NULL); TAOS_ASSERT(self != NULL);
if (self->type != TAOS_GAUGE) { if (self->type != TAOS_GAUGE) {
@ -99,7 +100,8 @@ int taos_metric_sample_sub(taos_metric_sample_t *self, double r_value) {
} }
#ifdef C11_ATOMIC #ifdef C11_ATOMIC
/*_Atomic*/ double old = atomic_load(&self->r_value); ///_Atomic/
double old = atomic_load(&self->r_value);
for (;;) { for (;;) {
_Atomic double new = ATOMIC_VAR_INIT(old - r_value); _Atomic double new = ATOMIC_VAR_INIT(old - r_value);
if (atomic_compare_exchange_weak(&self->r_value, &old, new)) { if (atomic_compare_exchange_weak(&self->r_value, &old, new)) {
@ -116,6 +118,7 @@ int taos_metric_sample_sub(taos_metric_sample_t *self, double r_value) {
return 0; return 0;
} }
*/
int taos_metric_sample_set(taos_metric_sample_t *self, double r_value) { int taos_metric_sample_set(taos_metric_sample_t *self, double r_value) {
if (self->type != TAOS_GAUGE && self->type != TAOS_COUNTER) { if (self->type != TAOS_GAUGE && self->type != TAOS_COUNTER) {

View File

@ -46,7 +46,9 @@ class TDTestCase(TBase):
# clusterDnodes.starttaosd(1) # clusterDnodes.starttaosd(1)
# time.sleep(5) # time.sleep(5)
autoGen.insert_data(5000, True) autoGen.insert_data(5000, True)
tdSql.execute(f"flush database {self.db}") self.flushDb(True)
# wait flush operation over
time.sleep(5)
# sql = 'show vnodes;' # sql = 'show vnodes;'
# while True: # while True:

View File

@ -214,7 +214,7 @@ function lcovFunc {
'*/clientJniConnector.c' '*/clientTmqConnector.c' '*/version.c' '*/build_version.cc'\ '*/clientJniConnector.c' '*/clientTmqConnector.c' '*/version.c' '*/build_version.cc'\
'*/tthread.c' '*/tversion.c' '*/ctgDbg.c' '*/schDbg.c' '*/qwDbg.c' '*/tencode.h' \ '*/tthread.c' '*/tversion.c' '*/ctgDbg.c' '*/schDbg.c' '*/qwDbg.c' '*/tencode.h' \
'*/shellAuto.c' '*/shellTire.c' '*/shellCommand.c'\ '*/shellAuto.c' '*/shellTire.c' '*/shellCommand.c'\
'*/sql.c' '*/sql.y'\ '*/sql.c' '*/sql.y' '*/smaSnapshot.c' '*/smaCommit.c'\
--branch-coverage --function-coverage -o coverage.info --branch-coverage --function-coverage -o coverage.info
# generate result # generate result

View File

@ -206,6 +206,7 @@ SWords shellCommands[] = {
{"show grants full;", 0, 0, NULL}, {"show grants full;", 0, 0, NULL},
{"show grants logs;", 0, 0, NULL}, {"show grants logs;", 0, 0, NULL},
#ifdef TD_ENTERPRISE #ifdef TD_ENTERPRISE
{"show views;", 0, 0, NULL},
{"split vgroup <vgroup_id>", 0, 0, NULL}, {"split vgroup <vgroup_id>", 0, 0, NULL},
#endif #endif
{"insert into <tb_name> values(", 0, 0, NULL}, {"insert into <tb_name> values(", 0, 0, NULL},
@ -570,6 +571,7 @@ void showHelp() {
split vgroup <vgroup_id>;\n\ split vgroup <vgroup_id>;\n\
show compacts;\n\ show compacts;\n\
show compact \n\ show compact \n\
show views;\n\
show create view <all_table>;"); show create view <all_table>;");
#endif #endif