fix/TD-31520-move-to-vnode-init-stage
This commit is contained in:
parent
bdabe66aab
commit
48055beb1f
|
@ -218,6 +218,7 @@ typedef struct {
|
||||||
} SDmNotifyHandle;
|
} SDmNotifyHandle;
|
||||||
|
|
||||||
int32_t monInit(const SMonCfg *pCfg);
|
int32_t monInit(const SMonCfg *pCfg);
|
||||||
|
void monInitVnode();
|
||||||
void monCleanup();
|
void monCleanup();
|
||||||
void monRecordLog(int64_t ts, ELogLevel level, const char *content);
|
void monRecordLog(int64_t ts, ELogLevel level, const char *content);
|
||||||
int32_t monGetLogs(SMonLogs *logs);
|
int32_t monGetLogs(SMonLogs *logs);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cos.h"
|
#include "cos.h"
|
||||||
|
#include "monitor.h"
|
||||||
#include "vnd.h"
|
#include "vnd.h"
|
||||||
|
|
||||||
static volatile int32_t VINIT = 0;
|
static volatile int32_t VINIT = 0;
|
||||||
|
@ -26,6 +27,8 @@ int vnodeInit(int nthreads, StopDnodeFp stopDnodeFp) {
|
||||||
TAOS_CHECK_RETURN(vnodeAsyncOpen(nthreads));
|
TAOS_CHECK_RETURN(vnodeAsyncOpen(nthreads));
|
||||||
TAOS_CHECK_RETURN(walInit(stopDnodeFp));
|
TAOS_CHECK_RETURN(walInit(stopDnodeFp));
|
||||||
|
|
||||||
|
monInitVnode();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1904,8 +1904,8 @@ _exit:
|
||||||
(void)atomic_add_fetch_64(&pVnode->statis.nInsertSuccess, pSubmitRsp->affectedRows);
|
(void)atomic_add_fetch_64(&pVnode->statis.nInsertSuccess, pSubmitRsp->affectedRows);
|
||||||
(void)atomic_add_fetch_64(&pVnode->statis.nBatchInsert, 1);
|
(void)atomic_add_fetch_64(&pVnode->statis.nBatchInsert, 1);
|
||||||
|
|
||||||
if (tsEnableMonitor && pSubmitRsp->affectedRows > 0 && strlen(pOriginalMsg->info.conn.user) > 0 &&
|
if (tsEnableMonitor && tsMonitorFqdn[0] != 0 && tsMonitorPort != 0 && pSubmitRsp->affectedRows > 0 &&
|
||||||
tsInsertCounter != NULL) {
|
strlen(pOriginalMsg->info.conn.user) > 0 && tsInsertCounter != NULL) {
|
||||||
const char *sample_labels[] = {VNODE_METRIC_TAG_VALUE_INSERT_AFFECTED_ROWS,
|
const char *sample_labels[] = {VNODE_METRIC_TAG_VALUE_INSERT_AFFECTED_ROWS,
|
||||||
pVnode->monitor.strClusterId,
|
pVnode->monitor.strClusterId,
|
||||||
pVnode->monitor.strDnodeId,
|
pVnode->monitor.strDnodeId,
|
||||||
|
|
|
@ -128,7 +128,11 @@ int32_t monInit(const SMonCfg *pCfg) {
|
||||||
|
|
||||||
monInitMonitorFW();
|
monInitMonitorFW();
|
||||||
|
|
||||||
if (tsEnableMonitor && tsInsertCounter == NULL) {
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void monInitVnode() {
|
||||||
|
if (tsEnableMonitor && tsMonitorFqdn[0] != 0 && tsMonitorPort != 0 && tsInsertCounter == NULL) {
|
||||||
taos_counter_t *counter = NULL;
|
taos_counter_t *counter = NULL;
|
||||||
int32_t label_count = 7;
|
int32_t label_count = 7;
|
||||||
const char *sample_labels[] = {VNODE_METRIC_TAG_NAME_SQL_TYPE, VNODE_METRIC_TAG_NAME_CLUSTER_ID,
|
const char *sample_labels[] = {VNODE_METRIC_TAG_NAME_SQL_TYPE, VNODE_METRIC_TAG_NAME_CLUSTER_ID,
|
||||||
|
@ -147,8 +151,6 @@ int32_t monInit(const SMonCfg *pCfg) {
|
||||||
} else {
|
} else {
|
||||||
uError("failed to set insert counter, already set");
|
uError("failed to set insert counter, already set");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void monCleanup() {
|
void monCleanup() {
|
||||||
|
|
Loading…
Reference in New Issue