diff --git a/src/plugins/monitor/src/monMain.c b/src/plugins/monitor/src/monMain.c index 33b95642b9d2757942d14d7608e7ae5169784f42..dac264e4180303a974271b0978449c502c86479d 100644 --- a/src/plugins/monitor/src/monMain.c +++ b/src/plugins/monitor/src/monMain.c @@ -1092,28 +1092,16 @@ static void monSaveDnodesInfo() { static int32_t checkCreateVgroupTable(int32_t vgId) { char subsql[256]; - bool create_table = false; int32_t code = TSDB_CODE_SUCCESS; memset(subsql, 0, sizeof(subsql)); - snprintf(subsql, 255, "describe %s.vgroup_%d", tsMonitorDbName, vgId); + snprintf(subsql, sizeof(subsql), "create table if not exists %s.vgroup_%d using %s.vgroups_info tags(%d)", + tsMonitorDbName, vgId, tsMonitorDbName, vgId); TAOS_RES *result = taos_query(tsMonitor.conn, subsql); code = taos_errno(result); - if (code != 0) { - create_table = true; - snprintf(subsql, sizeof(subsql), "create table if not exists %s.vgroup_%d using %s.vgroups_info tags(%d)", - tsMonitorDbName, vgId, tsMonitorDbName, vgId); - monError("table vgroup_%d not exist, create table vgroup_%d", vgId, vgId); - } taos_free_result(result); - if (create_table == true) { - result = taos_query(tsMonitor.conn, subsql); - code = taos_errno(result); - taos_free_result(result); - } - return code; }