From b8c6d6c0314d2c79512eff73aa9442327a3183da Mon Sep 17 00:00:00 2001 From: slguan Date: Fri, 8 May 2020 22:05:02 +0800 Subject: [PATCH] failed to get bandwidth --- src/mnode/inc/{mgmtLog.h => mgmtInt.h} | 36 ++++++-------------------- src/mnode/src/mgmtAcct.c | 2 +- src/mnode/src/mgmtBalance.c | 2 +- src/mnode/src/mgmtDb.c | 2 +- src/mnode/src/mgmtDnode.c | 2 +- src/mnode/src/mgmtGrant.c | 2 +- src/mnode/src/mgmtMain.c | 2 +- src/mnode/src/mgmtMnode.c | 2 +- src/mnode/src/mgmtProfile.c | 2 +- src/mnode/src/mgmtSdb.c | 2 +- src/mnode/src/mgmtServer.c | 2 +- src/mnode/src/mgmtShell.c | 2 +- src/mnode/src/mgmtTable.c | 2 +- src/mnode/src/mgmtUser.c | 2 +- src/mnode/src/mgmtVgroup.c | 2 +- src/os/linux/src/linuxSysPara.c | 11 +++++--- src/plugins/monitor/src/monitorMain.c | 8 +++--- 17 files changed, 34 insertions(+), 49 deletions(-) rename src/mnode/inc/{mgmtLog.h => mgmtInt.h} (53%) diff --git a/src/mnode/inc/mgmtLog.h b/src/mnode/inc/mgmtInt.h similarity index 53% rename from src/mnode/inc/mgmtLog.h rename to src/mnode/inc/mgmtInt.h index a99fa22593..17553ade72 100644 --- a/src/mnode/inc/mgmtLog.h +++ b/src/mnode/inc/mgmtInt.h @@ -27,39 +27,19 @@ extern int32_t mdebugFlag; extern int32_t sdbDebugFlag; // mnode log function -#define mError(...) \ - if (mdebugFlag & DEBUG_ERROR) { \ - taosPrintLog("ERROR MND ", 255, __VA_ARGS__); \ - } -#define mWarn(...) \ - if (mdebugFlag & DEBUG_WARN) { \ - taosPrintLog("WARN MND ", mdebugFlag, __VA_ARGS__); \ - } -#define mTrace(...) \ - if (mdebugFlag & DEBUG_TRACE) { \ - taosPrintLog("MND ", mdebugFlag, __VA_ARGS__); \ - } -#define mPrint(...) \ - { taosPrintLog("MND ", 255, __VA_ARGS__); } +#define mError(...) if (mdebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR MND ", 255, __VA_ARGS__); } +#define mWarn(...) if (mdebugFlag & DEBUG_WARN) { taosPrintLog("WARN MND ", mdebugFlag, __VA_ARGS__); } +#define mTrace(...) if (mdebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mdebugFlag, __VA_ARGS__); } +#define mPrint(...) { taosPrintLog("MND ", 255, __VA_ARGS__); } #define mLError(...) monitorSaveLog(2, __VA_ARGS__); mError(__VA_ARGS__) #define mLWarn(...) monitorSaveLog(1, __VA_ARGS__); mWarn(__VA_ARGS__) #define mLPrint(...) monitorSaveLog(0, __VA_ARGS__); mPrint(__VA_ARGS__) -#define sdbError(...) \ - if (sdbDebugFlag & DEBUG_ERROR) { \ - taosPrintLog("ERROR MND-SDB ", 255, __VA_ARGS__); \ - } -#define sdbWarn(...) \ - if (sdbDebugFlag & DEBUG_WARN) { \ - taosPrintLog("WARN MND-SDB ", sdbDebugFlag, __VA_ARGS__); \ - } -#define sdbTrace(...) \ - if (sdbDebugFlag & DEBUG_TRACE) { \ - taosPrintLog("MND-SDB ", sdbDebugFlag, __VA_ARGS__); \ - } -#define sdbPrint(...) \ - { taosPrintLog("MND-SDB ", 255, __VA_ARGS__); } +#define sdbError(...) if (sdbDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR MND-SDB ", 255, __VA_ARGS__); } +#define sdbWarn(...) if (sdbDebugFlag & DEBUG_WARN) { taosPrintLog("WARN MND-SDB ", sdbDebugFlag, __VA_ARGS__); } +#define sdbTrace(...) if (sdbDebugFlag & DEBUG_TRACE) { taosPrintLog("MND-SDB ", sdbDebugFlag, __VA_ARGS__);} +#define sdbPrint(...) { taosPrintLog("MND-SDB ", 255, __VA_ARGS__); } #define sdbLError(...) monitorSaveLog(2, __VA_ARGS__); sdbError(__VA_ARGS__) #define sdbLWarn(...) monitorSaveLog(1, __VA_ARGS__); sdbWarn(__VA_ARGS__) diff --git a/src/mnode/src/mgmtAcct.c b/src/mnode/src/mgmtAcct.c index 9b7815af12..1cacec96ee 100644 --- a/src/mnode/src/mgmtAcct.c +++ b/src/mnode/src/mgmtAcct.c @@ -20,7 +20,7 @@ #include "tutil.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" #include "mgmtDb.h" #include "mgmtSdb.h" diff --git a/src/mnode/src/mgmtBalance.c b/src/mnode/src/mgmtBalance.c index d16a06fc5c..ff5b4008bb 100644 --- a/src/mnode/src/mgmtBalance.c +++ b/src/mnode/src/mgmtBalance.c @@ -19,7 +19,7 @@ #include "tbalance.h" #include "tglobal.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtMnode.h" #include "mgmtDnode.h" #include "mgmtVgroup.h" diff --git a/src/mnode/src/mgmtDb.c b/src/mnode/src/mgmtDb.c index 5cee1f30cd..8c6a80eb61 100644 --- a/src/mnode/src/mgmtDb.c +++ b/src/mnode/src/mgmtDb.c @@ -25,7 +25,7 @@ #include "tbalance.h" #include "tdataformat.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" #include "mgmtDb.h" #include "mgmtDnode.h" diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index 030123b804..a170aa2d02 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -27,7 +27,7 @@ #include "tdataformat.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtDnode.h" #include "mgmtMnode.h" #include "mgmtSdb.h" diff --git a/src/mnode/src/mgmtGrant.c b/src/mnode/src/mgmtGrant.c index 449799ef95..f44b47e20c 100644 --- a/src/mnode/src/mgmtGrant.c +++ b/src/mnode/src/mgmtGrant.c @@ -18,7 +18,7 @@ #include "os.h" #include "taoserror.h" #include "tgrant.h" -#include "mgmtLog.h" +#include "mgmtInt.h" int32_t grantInit() { return TSDB_CODE_SUCCESS; } void grantCleanUp() {} diff --git a/src/mnode/src/mgmtMain.c b/src/mnode/src/mgmtMain.c index aa95381df3..37edddec10 100644 --- a/src/mnode/src/mgmtMain.c +++ b/src/mnode/src/mgmtMain.c @@ -23,7 +23,7 @@ #include "tglobal.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtServer.h" #include "mgmtAcct.h" #include "mgmtDnode.h" diff --git a/src/mnode/src/mgmtMnode.c b/src/mnode/src/mgmtMnode.c index f28e286f79..a78e5574c0 100644 --- a/src/mnode/src/mgmtMnode.c +++ b/src/mnode/src/mgmtMnode.c @@ -24,7 +24,7 @@ #include "tsocket.h" #include "tdataformat.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtMnode.h" #include "mgmtDnode.h" #include "mgmtSdb.h" diff --git a/src/mnode/src/mgmtProfile.c b/src/mnode/src/mgmtProfile.c index 77871f037b..64ac8ed710 100644 --- a/src/mnode/src/mgmtProfile.c +++ b/src/mnode/src/mgmtProfile.c @@ -19,7 +19,7 @@ #include "taoserror.h" #include "tutil.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" #include "mgmtDnode.h" #include "mgmtDb.h" diff --git a/src/mnode/src/mgmtSdb.c b/src/mnode/src/mgmtSdb.c index fe25699b5f..d2a5287f13 100644 --- a/src/mnode/src/mgmtSdb.c +++ b/src/mnode/src/mgmtSdb.c @@ -27,7 +27,7 @@ #include "hashstr.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtMnode.h" #include "mgmtSdb.h" diff --git a/src/mnode/src/mgmtServer.c b/src/mnode/src/mgmtServer.c index 2fa6e68f65..a6b4362cbf 100644 --- a/src/mnode/src/mgmtServer.c +++ b/src/mnode/src/mgmtServer.c @@ -25,7 +25,7 @@ #include "tglobal.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtDb.h" #include "mgmtMnode.h" #include "mgmtProfile.h" diff --git a/src/mnode/src/mgmtShell.c b/src/mnode/src/mgmtShell.c index 7264c85027..3cb0225b97 100644 --- a/src/mnode/src/mgmtShell.c +++ b/src/mnode/src/mgmtShell.c @@ -26,7 +26,7 @@ #include "tcache.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" #include "mgmtDb.h" #include "mgmtDnode.h" diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index e9fdee7a0f..2225e08f58 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -26,7 +26,7 @@ #include "tglobal.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" #include "mgmtDb.h" #include "mgmtDnode.h" diff --git a/src/mnode/src/mgmtUser.c b/src/mnode/src/mgmtUser.c index ecd3c217ca..b0e58a5052 100644 --- a/src/mnode/src/mgmtUser.c +++ b/src/mnode/src/mgmtUser.c @@ -23,7 +23,7 @@ #include "tdataformat.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" #include "mgmtMnode.h" #include "mgmtSdb.h" diff --git a/src/mnode/src/mgmtVgroup.c b/src/mnode/src/mgmtVgroup.c index 6be2a73444..cbe235a26a 100644 --- a/src/mnode/src/mgmtVgroup.c +++ b/src/mnode/src/mgmtVgroup.c @@ -26,7 +26,7 @@ #include "dnode.h" #include "tdataformat.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtDb.h" #include "mgmtDnode.h" #include "mgmtMnode.h" diff --git a/src/os/linux/src/linuxSysPara.c b/src/os/linux/src/linuxSysPara.c index f43ed44a4b..6bab418385 100644 --- a/src/os/linux/src/linuxSysPara.c +++ b/src/os/linux/src/linuxSysPara.c @@ -356,10 +356,15 @@ static bool taosGetCardName(char *ip, char *name) { break; } - if (strcmp(host, ip) == 0) { - strcpy(name, ifa->ifa_name); - ret = true; + if (strcmp(host, "127.0.0.1") == 0) { + continue; } + + // TODO: the ip not config + // if (strcmp(host, ip) == 0) { + strcpy(name, ifa->ifa_name); + ret = true; + // } } freeifaddrs(ifaddr); diff --git a/src/plugins/monitor/src/monitorMain.c b/src/plugins/monitor/src/monitorMain.c index 7836dbae85..35787d1dfe 100644 --- a/src/plugins/monitor/src/monitorMain.c +++ b/src/plugins/monitor/src/monitorMain.c @@ -43,7 +43,7 @@ { taosPrintLog("MON ", 255, __VA_ARGS__); } #define SQL_LENGTH 1024 -#define LOG_LEN_STR 80 +#define LOG_LEN_STR 100 #define IP_LEN_STR 18 #define CHECK_INTERVAL 1000 @@ -148,8 +148,8 @@ static void dnodeBuildMonitorSql(char *sql, int32_t cmd) { if (cmd == MONITOR_CMD_CREATE_DB) { snprintf(sql, SQL_LENGTH, - "create database if not exists %s replica 1 days 10 keep 30 cache 2 " - "blocks 2 maxtables 32 precision 'us'", + "create database if not exists %s replica 1 days 10 keep 30 cache 1 " + "blocks 2 maxtables 16 precision 'us'", tsMonitorDbName); } else if (cmd == MONITOR_CMD_CREATE_MT_DN) { snprintf(sql, SQL_LENGTH, @@ -407,7 +407,7 @@ void monitorSaveLog(int32_t level, const char *const format, ...) { if (tsMonitorConn.state != MONITOR_STATE_INITIALIZED) return; - int32_t len = snprintf(sql, (size_t)max_length, "import into %s.log values(%" PRId64 ", %d,'", tsMonitorDbName, + int32_t len = snprintf(sql, (size_t)max_length, "insert into %s.log values(%" PRId64 ", %d,'", tsMonitorDbName, taosGetTimestampUs(), level); va_start(argpointer, format); -- GitLab