diff --git a/CMakeLists.txt b/CMakeLists.txt index 489cb5b197a0d4a1e09f8167a435cce382148fec..75f98f96bcb26ae12fd32b56f2533db3001c6ae5 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ ENDIF () SET(TD_ACCOUNT FALSE) SET(TD_ADMIN FALSE) SET(TD_GRANT FALSE) +SET(TD_USB_DONGLE FALSE) SET(TD_MQTT FALSE) SET(TD_TSDB_PLUGINS FALSE) SET(TD_STORAGE FALSE) diff --git a/cmake/define.inc b/cmake/define.inc index e0cdfd3efc6be2673dc60a53f035e132f5a20a55..bb6b285f268a6476c79fb599e76b1fd0435173b5 100755 --- a/cmake/define.inc +++ b/cmake/define.inc @@ -13,6 +13,10 @@ IF (TD_GRANT) ADD_DEFINITIONS(-D_GRANT) ENDIF () +IF (TD_USB_DONGLE) + ADD_DEFINITIONS(-D_USB_DONGLE) +ENDIF () + IF (TD_MQTT) ADD_DEFINITIONS(-D_MQTT) ENDIF () diff --git a/cmake/install.inc b/cmake/install.inc index 9dfe8d0ac6c4dd73b090c60605595f6be3abc478..9ecd9bcd4fa722dd039170ef30220679cedf65b1 100755 --- a/cmake/install.inc +++ b/cmake/install.inc @@ -1,8 +1,7 @@ IF (TD_LINUX) SET(TD_MAKE_INSTALL_SH "${TD_COMMUNITY_DIR}/packaging/tools/make_install.sh") INSTALL(CODE "MESSAGE(\"make install script: ${TD_MAKE_INSTALL_SH}\")") - INSTALL(CODE "execute_process(COMMAND chmod 777 ${TD_MAKE_INSTALL_SH})") - INSTALL(CODE "execute_process(COMMAND ${TD_MAKE_INSTALL_SH} ${TD_COMMUNITY_DIR} ${PROJECT_BINARY_DIR} Linux ${TD_VER_NUMBER})") + INSTALL(CODE "execute_process(COMMAND bash ${TD_MAKE_INSTALL_SH} ${TD_COMMUNITY_DIR} ${PROJECT_BINARY_DIR} Linux ${TD_VER_NUMBER})") ELSEIF (TD_WINDOWS) IF (TD_POWER) SET(CMAKE_INSTALL_PREFIX C:/PowerDB) @@ -41,6 +40,5 @@ ELSEIF (TD_WINDOWS) ELSEIF (TD_DARWIN) SET(TD_MAKE_INSTALL_SH "${TD_COMMUNITY_DIR}/packaging/tools/make_install.sh") INSTALL(CODE "MESSAGE(\"make install script: ${TD_MAKE_INSTALL_SH}\")") - INSTALL(CODE "execute_process(COMMAND chmod 777 ${TD_MAKE_INSTALL_SH})") - INSTALL(CODE "execute_process(COMMAND ${TD_MAKE_INSTALL_SH} ${TD_COMMUNITY_DIR} ${PROJECT_BINARY_DIR} Darwin ${TD_VER_NUMBER})") + INSTALL(CODE "execute_process(COMMAND bash ${TD_MAKE_INSTALL_SH} ${TD_COMMUNITY_DIR} ${PROJECT_BINARY_DIR} Darwin ${TD_VER_NUMBER})") ENDIF () diff --git a/src/connector/grafanaplugin b/src/connector/grafanaplugin index edad746514b2a53a8cf6061c93b98b52a5388692..9ae793ad2d567eb11d10627b65698f612542e988 160000 --- a/src/connector/grafanaplugin +++ b/src/connector/grafanaplugin @@ -1 +1 @@ -Subproject commit edad746514b2a53a8cf6061c93b98b52a5388692 +Subproject commit 9ae793ad2d567eb11d10627b65698f612542e988 diff --git a/src/dnode/CMakeLists.txt b/src/dnode/CMakeLists.txt index 0ac2f4d6876259d826f62cbd7dc5fa2d30b6553b..d9c4a84234184b14d272854838625e023dd55cea 100644 --- a/src/dnode/CMakeLists.txt +++ b/src/dnode/CMakeLists.txt @@ -39,6 +39,10 @@ IF (TD_GRANT) TARGET_LINK_LIBRARIES(taosd grant) ENDIF () +IF (TD_USB_DONGLE) + TARGET_LINK_LIBRARIES(taosd usb_dongle) +ENDIF () + IF (TD_MQTT) TARGET_LINK_LIBRARIES(taosd mqtt) ENDIF () diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index c6f6e976f65e66360e750ebdb5e056d79c8923a8..0dc10385cfbf648ce90f3dabaf87c9a2ea189b6f 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -23,6 +23,7 @@ #include "twal.h" #include "tfs.h" #include "tsync.h" +#include "tgrant.h" #include "dnodeStep.h" #include "dnodePeer.h" #include "dnodeModule.h" @@ -88,6 +89,7 @@ static SStep tsDnodeSteps[] = { {"dnode-statustmr", dnodeInitStatusTimer,dnodeCleanupStatusTimer}, {"dnode-telemetry", dnodeInitTelemetry, dnodeCleanupTelemetry}, {"dnode-script", scriptEnvPoolInit, scriptEnvPoolCleanup}, + {"dnode-grant", grantInit, grantCleanUp}, }; static SStep tsDnodeCompactSteps[] = { diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index 9602e16483f3a367117f998cc619dbe408859d93..00471bbf042e147a210fb575e7372d9696c33617 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -927,9 +927,12 @@ static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg) { pCreate->maxRowsPerFileBlock = htonl(pCreate->maxRowsPerFileBlock); int32_t code; +#ifdef GRANT_CHECK_WRITE if (grantCheck(TSDB_GRANT_TIME) != TSDB_CODE_SUCCESS) { code = TSDB_CODE_GRANT_EXPIRED; - } else if (!pMsg->pUser->writeAuth) { + } // else +#endif + if (!pMsg->pUser->writeAuth) { code = TSDB_CODE_MND_NO_RIGHTS; } else { code = mnodeCreateDb(pMsg->pUser->pAcct, pCreate, pMsg); diff --git a/src/mnode/src/mnodeFunc.c b/src/mnode/src/mnodeFunc.c index 253958efbe9a0d81d0542217447eaf750e10caf9..7f3963fc7e39f75bca5b1090907ff49d7e10a504 100644 --- a/src/mnode/src/mnodeFunc.c +++ b/src/mnode/src/mnodeFunc.c @@ -191,9 +191,11 @@ static int32_t mnodeUpdateFunc(SFuncObj *pFunc, void *pMsg) { } */ int32_t mnodeCreateFunc(SAcctObj *pAcct, char *name, int32_t codeLen, char *codeScript, char *path, uint8_t outputType, int16_t outputLen, int32_t funcType, int32_t bufSize, SMnodeMsg *pMsg) { +#ifdef GRANT_CHECK_WRITE if (grantCheck(TSDB_GRANT_TIME) != TSDB_CODE_SUCCESS) { return TSDB_CODE_GRANT_EXPIRED; } +#endif if (!pMsg->pUser->writeAuth) { return TSDB_CODE_MND_NO_RIGHTS; diff --git a/src/mnode/src/mnodeMain.c b/src/mnode/src/mnodeMain.c index df3c49165ca00262016006e4450eb1ba574a5525..31de22ae41877dce95a83fab0d4cacd4c574706b 100644 --- a/src/mnode/src/mnodeMain.c +++ b/src/mnode/src/mnodeMain.c @@ -55,7 +55,7 @@ static SStep tsMnodeSteps[] = { {"mnodes", mnodeInitMnodes, mnodeCleanupMnodes}, {"sdb", sdbInit, sdbCleanUp}, {"balance", bnInit, bnCleanUp}, - {"grant", grantInit, grantCleanUp}, + // {"grant", grantInit, grantCleanUp}, {"show", mnodeInitShow, mnodeCleanUpShow} }; diff --git a/src/mnode/src/mnodeWrite.c b/src/mnode/src/mnodeWrite.c index 9a993dfaafab725847a43097497287fbe5642511..a954ecb5c2a746e252f0905eb86d8dd8f1a1fbee 100644 --- a/src/mnode/src/mnodeWrite.c +++ b/src/mnode/src/mnodeWrite.c @@ -65,14 +65,16 @@ int32_t mnodeProcessWrite(SMnodeMsg *pMsg) { return TSDB_CODE_MND_MSG_NOT_PROCESSED; } +#ifdef GRANT_CHECK_WRITE int32_t code = grantCheck(TSDB_GRANT_TIME); if (code != TSDB_CODE_SUCCESS) { mError("msg:%p, app:%p type:%s not processed, reason:%s", pMsg, pMsg->rpcMsg.ahandle, taosMsg[pMsg->rpcMsg.msgType], tstrerror(code)); return code; } +#endif - code = mnodeInitMsg(pMsg); + int32_t code = mnodeInitMsg(pMsg); if (code != TSDB_CODE_SUCCESS) { mError("msg:%p, app:%p type:%s not processed, reason:%s", pMsg, pMsg->rpcMsg.ahandle, taosMsg[pMsg->rpcMsg.msgType], tstrerror(code)); diff --git a/src/os/src/detail/osTime.c b/src/os/src/detail/osTime.c index 9271ca5ab522dd82908ae301358613a19fb8d968..ba77885f02dddf6af6ee6ee7478d1087299a563b 100644 --- a/src/os/src/detail/osTime.c +++ b/src/os/src/detail/osTime.c @@ -380,7 +380,7 @@ int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrec assert(toPrecision == TSDB_TIME_PRECISION_MILLI || toPrecision == TSDB_TIME_PRECISION_MICRO || toPrecision == TSDB_TIME_PRECISION_NANO); - double tempResult = time; + double tempResult = (double)time; switch(fromPrecision) { case TSDB_TIME_PRECISION_MILLI: { switch (toPrecision) { diff --git a/src/plugins/blm3 b/src/plugins/blm3 index f56aa0f485d7bb6aebbcefc2007eeecdccb767c8..ba539ce69dc4fe53536e9b0517fe75917dce5c46 160000 --- a/src/plugins/blm3 +++ b/src/plugins/blm3 @@ -1 +1 @@ -Subproject commit f56aa0f485d7bb6aebbcefc2007eeecdccb767c8 +Subproject commit ba539ce69dc4fe53536e9b0517fe75917dce5c46 diff --git a/src/vnode/src/vnodeRead.c b/src/vnode/src/vnodeRead.c index 64f87ba5caddbb8b9cf90c2a13fa4029a9821ab0..e8495cac6d7de10018757876fba3674bda0e6231 100644 --- a/src/vnode/src/vnodeRead.c +++ b/src/vnode/src/vnodeRead.c @@ -20,6 +20,7 @@ #include "tglobal.h" #include "query.h" #include "vnodeStatus.h" +#include "tgrant.h" int32_t vNumOfExistedQHandle; // current initialized and existed query handle in current dnode @@ -55,6 +56,11 @@ int32_t vnodeProcessRead(void *vparam, SVReadMsg *pRead) { } static int32_t vnodeCheckRead(SVnodeObj *pVnode) { + if (grantCheck(TSDB_GRANT_TIME) != TSDB_CODE_SUCCESS) { + vDebug("vgId:%d, grant expired, refCount:%d pVnode:%p", pVnode->vgId, pVnode->refCount, pVnode); + return TSDB_CODE_GRANT_EXPIRED; + } + if (!vnodeInReadyStatus(pVnode)) { vDebug("vgId:%d, vnode status is %s, refCount:%d pVnode:%p", pVnode->vgId, vnodeStatus[pVnode->status], pVnode->refCount, pVnode); diff --git a/tests/pytest/tools/taosdemoTestTblAlt.py b/tests/pytest/tools/taosdemoTestTblAlt.py index 70df535f59cbb97469b7a73e4e230d9a8671bfc7..89c1b92e140cb1e19b549d3248693153e116c52e 100644 --- a/tests/pytest/tools/taosdemoTestTblAlt.py +++ b/tests/pytest/tools/taosdemoTestTblAlt.py @@ -54,27 +54,36 @@ class TDTestCase: binPath = buildPath + "/build/bin/" if(threadID == 0): - os.system("%staosdemo -y -t %d -n %d -b INT,INT,INT,INT -m t" % + print("%staosdemo -y -t %d -n %d -b INT,INT,INT,INT" % + (binPath, self.numberOfTables, self.numberOfRecords)) + os.system("%staosdemo -y -t %d -n %d -b INT,INT,INT,INT" % (binPath, self.numberOfTables, self.numberOfRecords)) if(threadID == 1): time.sleep(2) print("use test") - while True: + max_try = 100 + count = 0 + while (count < max_try): try: tdSql.execute("use test") break except Exception as e: tdLog.info("use database test failed") - time.sleep(1) + time.sleep(2) + count += 1 + print("try %d times" % count) continue # check if all the tables have heen created - while True: + count = 0 + while (count < max_try): try: tdSql.query("show tables") except Exception as e: tdLog.info("show tables test failed") - time.sleep(1) + time.sleep(2) + count += 1 + print("try %d times" % count) continue rows = tdSql.queryRows @@ -83,13 +92,17 @@ class TDTestCase: break time.sleep(1) # check if there are any records in the last created table - while True: + count = 0 + while (count < max_try): print("query started") + print("try %d times" % count) try: - tdSql.query("select * from test.t7") + tdSql.query("select * from test.d7") except Exception as e: tdLog.info("select * test failed") time.sleep(2) + count += 1 + print("try %d times" % count) continue rows = tdSql.queryRows @@ -100,8 +113,8 @@ class TDTestCase: print("alter table test.meters add column c10 int") tdSql.execute("alter table test.meters add column c10 int") - print("insert into test.t7 values (now, 1, 2, 3, 4, 0)") - tdSql.execute("insert into test.t7 values (now, 1, 2, 3, 4, 0)") + print("insert into test.d7 values (now, 1, 2, 3, 4, 0)") + tdSql.execute("insert into test.d7 values (now, 1, 2, 3, 4, 0)") def run(self): tdSql.prepare()